How can i call the device IPAddress in the scripts

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

Moderators: Moderators, Developers

Post Reply
Author
Message
zhangchegn
Posts: 1
Joined: Sat Oct 12, 2013 9:00 pm

How can i call the device IPAddress in the scripts

#1 Post by zhangchegn » Tue Apr 15, 2014 10:04 am

here is my scripts,very simple,get the router's routes number
#!/bin/sh
echo `snmpgetnext -v 2c -c Data2006Mana xx.xx.xx.xx IP-FORWARD-MIB::ipCidrRouteNumber | cut -d ' ' -f4`

here is the problem:
when i create a graph use this script, the graph works well. but when i create a graph template use this script[2], the graph can't display values,rrd tool says OK.
[2]
#!/bin/sh
echo `snmpgetnext -v 2c -c Data2006Mana $hostname IP-FORWARD-MIB::ipCidrRouteNumber | cut -d ' ' -f4`


how can i call the device ip address in the scriptes?

xbolshe
Posts: 13
Joined: Sun Mar 17, 2013 2:44 am

Re: How can i call the device IPAddress in the scripts

#2 Post by xbolshe » Fri May 02, 2014 5:29 am

Probably like this:

#!/bin/sh
echo `snmpgetnext -v 2c -c Data2006Mana $1 IP-FORWARD-MIB::ipCidrRouteNumber | cut -d ' ' -f4`

and the following in Data Input Methods:

<path_cacti>/scripts/my_script.sh <hostname>

Post Reply