[SOLVED] Perl Scripts Issue

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

If you switch back to the cmd.php poller, does everything work?
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

It does not. Cacti Log file says that there is a PHP BUG, cmd.php must be written with small letters and full path, but in graph management it does not show graphics at all.
Cacti user
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

That is a dumb logic bug. I've got instructions in my FAQ (in my installation guide) on how to fix that. Once thats fixed, then see how the cmd.php poller works.
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

In first time, I add $guess = strtolower($guess);

And it worked.

I have changed also:
if (version_compare("5.2.0", PHP_VERSION, "<")) {
to:
if (version_compare("5.2.0", PHP_VERSION, ">=")) {

There is no message "Empty result', but there is no graph at all too.
In Cacti log there is no any errors related to this data source too.

What can I do next ?
Cacti user
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Alright so now when you run cmd.php there aren't any errors right? with the logging level set to debug, you should see stuff scrolling across the screen and in the log file. Do you?
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

Yes, but nothing related to data source that I am interested in.
The difference between the CACTID mode is that graph not showing at all(there was a graph with CACTID, but without values in it) , but there is not Error message of type 'Empty result...'.
Does it matter that my host is dummy host i.e. 'SNMP not in use' ?
Cacti user
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Yes, that could be a problem. Cacti should poll that device every time.

So do any of your graphs work or just the perl script one is broken?
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

Everything is working fine through SNMP (script servers, SNMP, SNMP Query) and I have many pretty graphs, but these with perl scripts does not work.
Cacti user
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Ah alright. Lets stick with the cmd.php poller until everything works. Then migrate over to cactid.

1) Have you read on the documentation site on how to properly create a script/template?

2) What is the output of your script when you manually run it?

3) With cacti logging level set to debug, what is the output of the script when cacti runs it?
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

The only record related to my script I found was:

11/14/2007 01:32:48 PM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_item (local_data_id,host_id,action,hostname, snmp_community,snmp_version,snmp_timeout,snmp_username,snmp_password,snmp_port,rrd_name,rrd_path, rrd_num,arg1,arg2,arg3) values (14748,429,1,'Sofia', '','2','6000', '','','161', '','C:\\Inetpub\\Wwwroot\\cacti\\rra\\sofia_weather_min_14748.rrd', '1','c:/perl/bin/perl.exe C:/Inetpub/Wwwroot/cacti/scripts/dnsresponsetime.pl -s 10.15.200.5 -h dir.bg -t 9 -i 300 -r -d 10','','')"

The script is giving the results started in command prompt:

C:\Inetpub\Wwwroot\cacti\scripts>dnsresponsetime.pl -s 10.15.200.5 -h dir.bg -i 15 -r
avg:2 max:68 median:2 min:0 iter:1932

and yes I have read the documentation about how to write scripts for CACTI.

Interesting is that with cmd.php I do not receive any errors in my log file.

Also the data source:
C:/Inetpub/Wwwroot/cacti/rra/sofia_weather_min_14748.rrd
which is my data source for the script results is not present in this folder C:/Inetpub/Wwwroot/cacti/rra/

Only when I am using CACTID it is there, but then I am getting the 'Empty result...' message.
Cacti user
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

It appears cacti is running the script with different arguments from what you manually ran. Does that make a difference?

Make sure the script and perl.exe have the correct permissions to the IUSR_ and IIS_WPG accounts have read/execute rights.
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

I run the script with different parameters for purpose, but it shows the results as is in Data Input Methods.
Also I have assured that it has read&execute permissions for IIS_WPG and IUSR(Internet Guest Account) accounts.
Cacti user
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Alright, fire up sysinternals filemon during a polling session. Makes it easier to see whats going on if you set the filter highlighting to 'denied'. Post the log as an attachment.
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

I'll post the results in monday, because I had not enough time to organize it.
Cacti user
terziyski
Cacti User
Posts: 93
Joined: Thu Nov 02, 2006 6:02 am
Location: Bulgaria
Contact:

Post by terziyski »

Here it is as an attachment the FILEMON log file from 2 pool intervals.
There is no highlited lines, because there is no DENIED status messages.
Attachments
LOG.zip
(90.94 KiB) Downloaded 165 times
Cacti user
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest