I created a small script on the remote host that echos a static value:
Code: Select all
#!/bin/sh
AMOUNT=4
echo $AMOUNT
Code: Select all
exec 1.3.6.1.4.1.1 staticconf /etc/snmp/scripts/staticscript.sh
Code: Select all
/etc/init.d/snmpd restart
Code: Select all
snmpwalk -c public -v1 remotehostname SNMPv2-SMI::enterprises.1.101.1
Code: Select all
NMPv2-SMI::enterprises.1.101.1 = STRING: "4"
Code: Select all
#!/bin/bash
# fetch data from snmp output
RAWDATA=$(snmpwalk -v 1 -c public rogers SNMPv2-SMI::enterprises.1.101.1)
# remove quotes as thaey cause problems when cutting with echo
RAWDATA=$(echo $RAWDATA | sed 's/\"//g')
# cut data from snmp output
PUREDATA=$(echo ${RAWDATA#SNMPv2-SMI::enterprises.1.101.1 = STRING:*})
# put out pure data
echo $PUREDATA
Code: Select all
4
I created a data template. Name of the data template is "static mail data template". As data source name I inserted "|host_description| - static", data input method is "static input method" and Internal Data Source Name for the data source item is "static_item". (You might see that I am heading to some special mail server statistics that are not included in the standard snmp output)
I created a graph template and inserted "static mail graph template" as name. Its title is "|host_description| - static mail". I added graph template item #1 "static mail data template" and text format "static_value".
I created a device and added the tatic mail graph template. When I now click on the "edit" link in the Associated Graph Templates list and open the debug mode it says:
Code: Select all
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="CENSORED - static mail" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
LINE1::"static_value"
RRDTool Says:
ERROR: can't parse ':static_value'