Spine returns data at linux prompt but not on Cacti!!

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Spine returns data at linux prompt but not on Cacti!!

Post by gasperazzo »

Here I'm again...

So, i created a script_query to graph information about pagefiles of windows box using wmic.

When I run the ./spine at the linux server, the outpu is ok.
10/15/2008 09:06:47 AM - SPINE: Poller[0] Host[3] DS[28] SCRIPT: perl /usr/local/apache2-2.2.9/htdocs/cacti/scripts/myscripts/query_wmi_pagefile.pl serverName get Used C:pagefile.sys, output: 42
But when i look for the Cactis log I have some errors like that:
10/15/2008 09:15:03 AM - SPINE: Poller[0] Host[3] DS[29] WARNING: Result from SCRIPT not valid. Partial Result: ...
10/15/2008 09:15:03 AM - SPINE: Poller[0] Host[3] ERROR: Empty result [serverName]: 'perl /usr/local/apache2-2.2.9/htdocs/cacti/scripts/myscripts/query_wmi_pagefile.pl serverName get Used E:pagefile.sys'
Trying to use cmd.php:
10/15/2008 09:25:06 AM - CMDPHP: Poller[0] Host[3] DS[29] WARNING: Result from CMD not valid. Partial Result:
10/15/2008 09:25:05 AM - CMDPHP: Poller[0] Host[3] DS[29] CMD: perl /usr/local/apache2-2.2.9/htdocs/cacti/scripts/myscripts/query_wmi_pagefile.pl serverName get Size E:pagefile.sys, output: U
When I run the
perl /usr/local/apache2-2.2.9/htdocs/cacti/scripts/myscripts/query_wmi_pagefile.pl serverName get Size E:pagefile.sys
at my linux Server, the results are ok.

Tried to use escape caracters "\" in the input ID that was passed to the data query (C\:pagefile\.sys) but doesn't work!

Can anyone help-me?
Thanks.
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

Changed the script and XML of the data query.

put the complet path to the perl at XML:
<interfaces>
<name>Get Windows PageFile</name>
<description>Queries a Windows Server for a list of pagefiles via WMI.</description>
<script_path>/usr/bin/perl |path_cacti|/scripts/myscripts/query_wmi_pagefile.pl</script_path>
<arg_prepend>|host_hostname|</arg_prepend>
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
<output_delimeter>;</output_delimeter>
<index_order>ID</index_order>
<index_order_type>alphabetic</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>

<fields>
<ID>
<name>PageFile ID</name>
<direction>input</direction>
<query_name>ID</query_name>
</ID>
<Description>
<name>PageFile Description</name>
<direction>input</direction>
<query_name>Description</query_name>
</Description>
<Size>
<name>PageFile Size</name>
<direction>output</direction>
<query_name>Size</query_name>
</Size>
<Used>
<name>PageFile Used</name>
<direction>output</direction>
<query_name>Used</query_name>
</Used>
</fields>

</interfaces>
Change the script pl to not return special caracters... Like that:
10/15/2008 11:15:06 AM - SPINE: Poller[0] Host[5] ERROR: Empty result [bms601]: '/usr/bin/perl /usr/local/apache2-2.2.9/htdocs/cacti/scripts/myscripts/query_wmi_pagefile.pl serverName get Size Epagefilesys'
10/15/2008 11:15:06 AM - SPINE: Poller[0] Host[5] DS[38] SCRIPT: /usr/bin/perl /usr/local/apache2-2.2.9/htdocs/cacti/scripts/myscripts/query_wmi_pagefile.pl serverName get Used Epagefilesys, output: U


Still getting errors! :(
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Make sure, that the perl script runs under cactiuser and has all path of external commands explicitely given
Reinhard
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

Hey Gandalf,

I'm running the script at cactiuser without errors. See:
cactiuser@linux:/usr/local/apache2/htdocs/cacti/scripts/myscripts> /usr/bin/perl /usr/local/apache2-2.2.9/htdocs/cacti/scripts/myscripts/query_wmi_pagefile.pl serverName get Size C:pagefile.sys
50
Also, executed ./spine with cactiuser:
10/15/2008 02:16:13 PM - SPINE: Poller[0] Host[3] DS[49] SCRIPT: /usr/bin/perl /usr/local/apache2-2.2.9/htdocs/cacti/scripts/myscripts/query_wmi_pagefile.pl serverName get Used C:pagefile.sys, output: 41
I created an script more simple to query number of process then created a data input method... I`m surprise because i get the same error! So, i think that the problem is not my data query...

Could scripts had an special attribute? That is my folder that contain my scripts:
drwxr-xr-x 2 root root 128 Oct 15 14:00 .
drwxr-xr-x 3 root root 760 Oct 14 17:01 ..
-rw-r--r-- 1 root root 9469 Oct 15 12:42 query_wmi_pagefile.pl
-rw-r--r-- 1 root root 771 Oct 15 14:00 query_wmi_process.pl
Thanks for your time.
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

Tried to change the user of the crontab entry to root without sucesse.. Get the same errors.

The output lines of the pl script:
chomp($resultado);
print "num_process:$resultado\n";
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

I ran the crontab line at the prompt with cactiuser and worked fine... No errors are presented in the Cacti's log.

Now I don't know what I can try anymore.

:cry:
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

Found the problem...

When I realize a system call like that, Cacti don't get the output of the script... So, why? I don't know....
my $strExec = "wmic -U $credential //$computer \"select NumberOfProcesses from $Win32_Class\"";
@PageFileName = `$strExec`;
I'll try to test another ways to take a system call...

:-?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

You may want to talk to BSOD2600. He's the Windows Guy ...
Reinhard
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

I don't think that issue is a windows issue... Because i`m running cacti at a Suse Linux 10.1...

I solved the problem changing the method of collect output of system calls through perl scripts.

Thanks Gandalf...!!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

gasperazzo wrote:I don't think that issue is a windows issue... Because i`m running cacti at a Suse Linux 10.1...

I solved the problem changing the method of collect output of system calls through perl scripts.

Thanks Gandalf...!!
You did change the wmic thingy? That would be why I requested BSOD2600 knowledge ...
Reinhard
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

No, i don't changed the wmic query... I changed the method of Perl running system calls.

I don't use
@file = `command`;
anymore.

I'm using:
open(FILE,comand);
@file = <FILE>;
close(FILE);
For windows issue, i think i know something! :) ... But for Linux, perl, packages, distributions, source codes issues... Its a new world for me!

Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest