can run scripts from cmd line, but no output in cacti

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

Moderators: Developers, Moderators

Post Reply
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

can run scripts from cmd line, but no output in cacti

Post by egarnel »

I think I am very close to getting this to work, but the graphs & rrd are not populating.


from shell:
[cactiuser@show scripts]$ cd /var/www/html/cacti/scripts/
[cactiuser@show scripts]$ ./sendmail.pl
11

copied from cacti console cron output

perl /var/www/html/cacti/scripts/sendmail.pl 11

here is a dump from the rrd file:
<!-- 2003-01-06 07:10:00 CST / 1041858600 --> <row><v> N
aN </v></row>
<!-- 2003-01-06 07:15:00 CST / 1041858900 --> <row><v> N
aN </v></row>
.....

Here is the data input info:

Name: Get number of Sendmail Procs
Input string: perl <path_cacti>/scripts/sendmail.pl
Output string: <Sendmail>
===============================
Current Data Input Source Fields
Name Data Name Input/Output Update RRA
Sendmail_procs sendmail Output Yes
=============================
Data Input Source Configuration
Name: Sendmail_procs
Data name: sendmail
Output selected and Use for RRA is checked

rrdtool Data Source Configuration
perl /var/www/html/cacti/scripts/sendmail.pl
/usr/local/rrdtool/bin/rrdtool update /var/www/html/cacti/rra/sendmail.rrd --template sendmail N:12


graph source output:

/usr/local/rrdtool/bin/rrdtool graph - \
--imgformat=PNG \
--start="-86400" \
--title="Sendmail Processes" \
--rigid \
--base=1000 \
--height=100 \
--width=400 \
--upper-limit=100 \
--lower-limit=0 \
--vertical-label="Sendmail Processes" \
DEF:a="/var/www/html/cacti/rra/sendmail.rrd":sendmail:AVERAGE \
AREA:a#FF0000:"Number of Processes" \
GPRINT:a:LAST:"Current%8.2lf %s"

Thanks in advance for your help
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

Can you post header of rrd dump (the part preceeding your lines with NaN values).

- bulek
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

rrdtool dump results: top portion

Post by egarnel »

/usr/local/rrdtool/bin/rrdtool dump sendmail.rrd |more
<!-- Round Robin Database Dump -->
<rrd>
<version> 0001 </version>
<step> 300 </step> <!-- Seconds -->
<lastupdate> 1042053942 </lastupdate> <!-- 2003-01-08 13:25:42 CST -->

<ds>
<name> sendmail </name>
<type> GAUGE </type>
<minimal_heartbeat> 600 </minimal_heartbeat>
<min> 0.0000000000e+00 </min>
<max> 1.0000000000e+00 </max>

<!-- PDP Status -->
<last_ds> UNKN </last_ds>
<value> 0.0000000000e+00 </value>
<unknown_sec> 42 </unknown_sec>
</ds>

<!-- Round Robin Archives -->
<rra>
<cf> AVERAGE </cf>
<pdp_per_row> 1 </pdp_per_row> <!-- 300 seconds -->
<xff> 5.0000000000e-01 </xff>

<cdp_prep>
<ds><value> NaN </value> <unknown_datapoints> 0 </unkno
wn_datapoints></ds>
</cdp_prep>
<database>
<!-- 2003-01-06 11:30:00 CST / 1041874200 --> <row><v> N
aN </v></row>
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

Maximum Value in DS settings has been set to 1. This causes any value greater than 1 to be discarded by rrdtool.

- bulek
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

dump shows the same after changing max in DS

Post by egarnel »

Just for grins, I changed the Max value from 20 to 500 in the Data Source field under cacti console and made sure to check update rra.
after 2 iterations of php cmd.php, the dump still shows the MAX as 1...


confused...
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

Hopefully resolving your confusion :) let me notice that in case of changing rrd files parameters it is httpd that makes direct changes (not cmd.php). It is often misconfiguration... you need to set correct permissions for your web/httpd user to allow rrd files modifications.

- bulek
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Post by egarnel »

the rra and log dirs:
drwxrw-r-x 2 cactiuser users 12K Jan 8 13:56 rra
drwxrw-r-x 2 cactiuser users 4.0K Dec 27 15:45 log

the files within rra:
-rw-r--r-- 1 cactiuser users 47K Jan 8 14:10 sendmail.rrd
-rw-r--r-- 1 cactiuser users 138K Jan 8 14:10 system_loadavg.rrd
-rw-r--r-- 1 cactiuser users 47K Jan 8 14:10 system_mem_buffers.rrd
-rw-r--r-- 1 cactiuser users 47K Jan 8 14:10 system_mem_free.rrd
.....
So what you are saying is that apache needs to have write access as well as cactiuser? or users needs write access and apache needs to be in that group?

I am missing something..... other rrds are getting updated with the current ownership and perms...
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

Ok, maybe I was not clear enough. All changes in rrd files (creation, updates) are performed by cmd.php. You are probably using cactiuser user in crontab to run cmd.php. There one exception when you change rrd file settings (like changing Maximum Value or DS Type). In this case apache updates the settings (not data) in rrd files. If your apache user has not rights to write in rrd directory then regardles of changes in cacti DS settings your rrd files remain unchanged.

Sumarizing - yes, both cactiuser and apache should have write rights in rrd directory.

- bulek
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

got it!

Post by egarnel »

I was able to modify the max value via rrdtool
/usr/local/rrdtool/bin/rrdtool tune sendmail.rrd --maximum sendmail:200

Sure enough, the graphs started showing after a few minutes.

Thank you for all your help and insight
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests