[solved] Selected processes script not working

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

Moderators: Developers, Moderators

Post Reply
exseven
Posts: 13
Joined: Tue Jun 24, 2008 9:57 am

[solved] Selected processes script not working

Post by exseven »

Hello, hopefully comebody can help with this. I cant get this script to work currently. I am trying to graph my current vsftpd sessions.

the script i am using is http://forums.cacti.net/viewtopic.php?t ... t=proc_cnt

If i run the script from the command line i get the proper number of processes running

Code: Select all

# sh proc_cnt.sh ftpsecure
3
i enabled debugging in the logs and this is what i get for this data source

Code: Select all

# tail -f cacti.log |grep 'proc_cnt\|DS\[25\]'
06/24/2008 10:55:03 AM - CMDPHP: Poller[0] Host[1] DS[25] WARNING: Result from CMD not valid.  Partial Result: 
06/24/2008 10:55:03 AM - CMDPHP: Poller[0] Host[1] DS[25] CMD: /usr/local/share/cacti/scripts/proc_cnt.sh ftpsecure, output: U
06/24/2008 10:55:03 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (25, 'proc_cnt', '2008-06-24 10:55:02', 'U')"
06/24/2008 10:55:03 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "delete from poller_output where local_data_id='25' and rrd_name='proc_cnt' and time='2008-06-24 10:55:02'"
06/24/2008 10:55:03 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/less_cogeco_net_proc_cnt_25.rrd --template proc_cnt 1214319302:U
i dont understand why the output it 'U', not even sure where this is coming from.
any ideas?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

U is set by cacti if the command fails. U stand for Unknown.
Please make sure, that all commands used by the script are given by /full/path/to/command
Reinhard
exseven
Posts: 13
Joined: Tue Jun 24, 2008 9:57 am

Post by exseven »

ok, ive gone through the shell script and changed to absolute paths... still doesn't work. i'm not sure where its going wrong. i have tried to dumb down the script a bit, changed the shell (from bash to sh - works when i run 'sh proc_cnt.sh ftpsecure')

i tried changing the input string under data input methods to start with /bin/sh as well as just sh

also tried full path to the script instead of <path_cacti>, still no further.


less# tail -f ../log/cacti.log | grep "DS\[25\]\|proc_cnt"
06/24/2008 06:25:04 PM - CMDPHP: Poller[0] Host[1] DS[25] WARNING: Result from CMD not valid. Partial Result:
06/24/2008 06:25:04 PM - CMDPHP: Poller[0] Host[1] DS[25] CMD: /usr/local/share/cacti/scripts/proc_cnt.sh ftpsecure, output: U
06/24/2008 06:25:04 PM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (25, 'proc_cnt', '2008-06-24 18:25:03', 'U')"
06/24/2008 06:25:05 PM - CMDPHP: Poller[0] DEBUG: SQL Exec: "delete from poller_output where local_data_id='25' and rrd_name='proc_cnt' and time='2008-06-24 18:25:03'"
06/24/2008 06:25:05 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/less_cogeco_net_proc_cnt_25.rrd --template proc_cnt 1214346303:U
^C

less# cat proc_cnt.sh
#!/bin/sh
PROCNAME=$1
NUM=`/bin/ps ax | /usr/bin/grep "$PROCNAME" | /usr/bin/wc -l`
OUT=$(($NUM - 3))
/bin/echo -n "$OUT" | /usr/bin/awk '{ printf("%i", $1) }'





Ok fixed, thanks for the help :) using the NaN walkthough in your signature i ran php -q cmd.php 1 25 and it told me permision denied, changed ownership and still no good.

changed file from 644 to 755 and its working now :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest