WARNING : result from CMD Not valid

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
Stepin
Posts: 1
Joined: Mon Jan 17, 2011 9:05 am

WARNING : result from CMD Not valid

Post by Stepin »

Hello all,

I spent a lot of time trying to make my script working, debugging it, but it's still generating errors in CACTI.

1) What i would like to do :
execute my SHELL script with a command line argument (beeing a "hostname").

2) What the script does :
Lookups ip address from the hostname specified in the command line argument, and makes an snmpget with a specific OID (querying for the counter of my printers)

3) What my script looks like :

Code: Select all

#! /bin/bash
# Retry the IP address of the hostname
LOOKUP=$(/usr/bin/nmblookup -U 10.33.0.7 -R $1 | awk '{print $1}' | sed -n '2p')

# Check for errors. If "name_query", the host isn't online
if [ $LOOKUP != "name_query" ]; then
	COUNTER=$(/usr/bin/snmpget -v1 -Cf -c public $LOOKUP 1.3.6.1.2.1.43.10.2.1.4.1.1 | awk '{print $4}')
	echo $COUNTER
fi
4) Error
When lunching php poller.php, i get lots of errors, and regarding my script, i can see :
"USAGE : -u serveur -z blalbalbablbl" which is the default page for nmblookup when you don't specify the hostname to lookup (like you're not giving the R value here : nmblookup -U xx.Xxx.xx.xx -R)
Then i got the same default page with SNMPGET, and the error "missing object name". That means it lunchs my script with no ipaddress (LOOKUP variable is empty), and as a result, it supposes the OID is the host, asking then "where is my object name ?".

5) It works in my shell command line but i cannot get it working in Cacti.
I created the data input method, with "host" as the input, and "counter" as the output.
The data source is created.

I don't know what to do. I can't find anywhere what are the commands executed
by poller.php. This way i could tell wether or not cacti is lunching my script and ommiting the <hostname> value !

Can you enlight me please ? Thanks
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: WARNING : result from CMD Not valid

Post by gandalf »

Please post a screenshot of the definition for the Data Input Method
It seems that you are not passing the host to be queried to the script
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests