No localhost graphs on new install

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

dunxd
Posts: 18
Joined: Wed Sep 23, 2009 5:51 am
Location: London, UK

Post by dunxd »

Where is the data on a different line from the OID? As far as I can see the command doesn't return an OID at all.

This is the cacti supplied script I am running here. Groundwork don't supply Cacti as part of the Community Edition.
peecee
Cacti User
Posts: 146
Joined: Tue Feb 26, 2008 7:26 am

Post by peecee »

dunxd wrote:Where is the data on a different line from the OID? As far as I can see the command doesn't return an OID at all.

This is the cacti supplied script I am running here. Groundwork don't supply Cacti as part of the Community Edition.
You supplied the information:

Code: Select all

[nagios@sm01 cacti]$ perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scrpts/linux_memory.pl MemFree:
442188
See how the 442188 is on a separate line? If it were compliant, the 442188 would be on the same line as the rest of the command, like this:

Code: Select all

[nagios@sm01 cacti]$ perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scrpts/linux_memory.pl MemFree:442188
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

dunxd,

I suspect that something GW did hosed this script. Just cause we maintain an OSS project, doesn't mean someone else can't screw it up. However, if I'm wrong, we would like to know about it. Obtain the script from the official 0.8.7e sources and run it to verify. If the problem still exists, open a bug here: http://bugs.cacti.net

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
dunxd
Posts: 18
Joined: Wed Sep 23, 2009 5:51 am
Location: London, UK

Post by dunxd »

Ok - that is clearer. I'm used to seeing output appear on a different line from the input, so wasn't looking for that.

The script I have been running was downloaded from your sourceforge project last week - as I said previously Groundwork don't supply cacti as part of the Community Edition.

The script is very short:

Code: Select all

#!/usr/bin/perl

open(PROCESS, "cat /proc/meminfo | grep -w $ARGV[0] |");
foreach (<PROCESS>) {
        if ($_ =~ /($ARGV[0].*\s)(.*[0-9])( kB)/) {
                print $2;
        }
}
close(PROCESS);
I don't really see where an extra linefeed could slip in there.

If I do

Code: Select all

perl scripts/linux_memory.pl MemFree: > result
the file result does not begin with any new line character. Could PuTTY from a windows machine add an extra CR?
dunxd
Posts: 18
Joined: Wed Sep 23, 2009 5:51 am
Location: London, UK

Post by dunxd »

Just to muddy the waters a little. I was trying to understand what was going on by running poller.php from the command line - I had to change the schedule from 5 minutes to 1 minute (and update cron accordingly). The first time I ran poller.php after this I got valid data instead of the U. Subsequent runs however, got U instead of a value.

I then tried running cmd.php from command line, and get valid data:

Code: Select all

[nagios@sm01 cacti]$ /usr/local/groundwork/php/bin/php /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/cmd.php
09/28/2009 11:55:18 AM - POLLER: Poller[0] WARNING: Poller[0] Host[1] Ping Time was not numeric
09/28/2009 11:55:18 AM - CMDPHP: Poller[0] Host[1] PING: Ping not performed due to setting.
09/28/2009 11:55:18 AM - CMDPHP: Poller[0] Host[1] DS[3] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/linux_memory.pl MemFree:, output: 331024
09/28/2009 11:55:18 AM - CMDPHP: Poller[0] Time: 0.0998 s, Theads: N/A, Hosts: 1
This is repeatable (cmd.php seems to go through each polling command one at a time - they all get valid outputs.

I think the line feed issue is a red herring - if it were the problem then wouldn't the error occur when running cmd.php as well?
dunxd
Posts: 18
Joined: Wed Sep 23, 2009 5:51 am
Location: London, UK

Post by dunxd »

Hi there - still here and still having the same problem.

I've setup Cacti to use RHEL binaries for rrdtool etc - so really, although Groundwork is running on this box, I don't see any reason why it should have any effect on Cacti doing its thing. Cacti was installed from a download from Cacti.net.

From the Cacti Poller Cache, I can see the scripts that are run to get statistics.

If I run those on command line I get the following (this is copied from PuTTY as is, so all newlines are as displayed on the screen):

Code: Select all

[root@sm01 cacti-0.8.7e]# perl scripts/loadavg_multi.pl
1min:1.08 5min:1.02 10min:0.95[root@sm01 cacti-0.8.7e]# perl scripts/unix_users.pl
1[root@sm01 cacti-0.8.7e]# perl scripts/linux_memory.pl MemFree:
141900[root@sm01 cacti-0.8.7e]# perl scripts/linux_memory.pl SwapFree:
17767784[root@sm01 cacti-0.8.7e]# perl scripts/unix_processes
As you can see there is a newline after the command is run, followed by the output of the command. It has been suggested earlier in this thread that this newline breaks Cacti's ability to parse the output. This is marked in the cacti log by the presence of U.

The most recent Cacti log shows the following:

Code: Select all

10/26/2009 03:35:03 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/rra/localhost_mem_buffers_3.rrd --template mem_buffers 1256571302:U
10/26/2009 03:35:03 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/rra/localhost_mem_swap_4.rrd --template mem_swap 1256571302:U
10/26/2009 03:35:03 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/rra/localhost_load_1min_5.rrd --template 1256571302:U
10/26/2009 03:35:03 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/rra/localhost_users_6.rrd --template users 1256571302:U
10/26/2009 03:35:03 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/rra/localhost_proc_7.rrd --template proc 1256571302:U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Time: 0.0395 s, Theads: N/A, Hosts: 1
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[7] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/unix_processes.pl, output: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[7] WARNING: Result from CMD not valid. Partial Result: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[6] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/unix_users.pl , output: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[6] WARNING: Result from CMD not valid. Partial Result: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[5] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/loadavg_multi.pl, output: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[5] WARNING: Result from CMD not valid. Partial Result: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[4] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/linux_memory.pl SwapFree:, output: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[4] WARNING: Result from CMD not valid. Partial Result: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[3] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/linux_memory.pl MemFree:, output: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] DS[3] WARNING: Result from CMD not valid. Partial Result: U
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] Host[1] PING: Ping not performed due to setting.
10/26/2009 03:35:02 PM - POLLER: Poller[0] WARNING: Poller[0] Host[1] Ping Time was not numeric
10/26/2009 03:35:02 PM - CMDPHP: Poller[0] WARNING: sockets support not enabled in PHP, falling back to SNMP ping
10/26/2009 03:35:02 PM - POLLER: Poller[0] NOTE: There are no items in your poller for this polling cycle!
10/26/2009 03:35:02 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/local/groundwork/php/bin/php, ARGS: -q "/usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/cmd.php" 1 1]
10/26/2009 03:35:01 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: /usr/local/groundwork/php/bin/php, ARGS: -q "/usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/cmd.php" 0 0]
10/26/2009 03:35:01 PM - POLLER: Poller[0] NOTE: Poller Int: '300', Cron Int: '300', Time Since Last: '300', Max Runtime '298', Poller Runs: '1'
10/26/2009 03:30:02 PM - SYSTEM STATS: Time:1.2513 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:5 RRDsProcessed:5
When I invoke cmd.php from the command line, the output indicates that the checks are working fine:

Code: Select all

[nagios@sm01 cacti-0.8.7e]$ php cmd.php
10/26/2009 03:46:55 PM - POLLER: Poller[0] WARNING: Poller[0] Host[1] Ping Time was not numeric
10/26/2009 03:46:55 PM - CMDPHP: Poller[0] Host[1] PING: Ping not performed due to setting.
10/26/2009 03:46:55 PM - CMDPHP: Poller[0] Host[1] DS[3] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/linux_memory.pl MemFree:, output: 126552
10/26/2009 03:46:55 PM - CMDPHP: Poller[0] Host[1] DS[4] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/linux_memory.pl SwapFree:, output: 17767784
10/26/2009 03:46:55 PM - CMDPHP: Poller[0] Host[1] DS[5] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/loadavg_multi.pl, output: 1min:1.37 5min:1.11 10min:1.00
10/26/2009 03:46:55 PM - CMDPHP: Poller[0] Host[1] DS[6] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/unix_users.pl , output: 1
10/26/2009 03:46:55 PM - CMDPHP: Poller[0] Host[1] DS[7] CMD: perl /usr/local/groundwork/apache2/htdocs/cacti-0.8.7e/scripts/unix_processes.pl, output: 127
10/26/2009 03:46:55 PM - CMDPHP: Poller[0] Time: 0.1986 s, Theads: N/A, Hosts: 1
So why is this not working when invoked by Cacti?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Missing or wrong paths to commands used in those scripts may be a root cause
R.
dunxd
Posts: 18
Joined: Wed Sep 23, 2009 5:51 am
Location: London, UK

Post by dunxd »

Thanks for the reply Gandalf.

Apache is running as the user named nagios. If I login as nagios and run cmd.php, I get valid output for each check (which I am not seeing when running. That suggests that the paths are ok for apache's user and in the scripts.

However, perhaps I am making a wrong assumption here. What would be the best way of confirming your suggestion (and fixing the problem if that is what is happening)?

D
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests