Cacti can't parse my data [solved]

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
xxlray
Posts: 3
Joined: Tue Jun 16, 2009 9:47 am

Cacti can't parse my data [solved]

Post by xxlray »

I am new to cacti and so I wanted to start by monitoring a static value on a remote host. These are the steps I made:

I created a small script on the remote host that echos a static value:

Code: Select all

#!/bin/sh

AMOUNT=4
echo $AMOUNT
I added an entry in the /etc/snmp/snmp.conf of the remote host:

Code: Select all

exec 1.3.6.1.4.1.1 staticconf /etc/snmp/scripts/staticscript.sh
I restarted snmp on the remote host:

Code: Select all

/etc/init.d/snmpd restart
I changed to the cacti host and did an snmpwalk:

Code: Select all

snmpwalk -c public -v1 remotehostname SNMPv2-SMI::enterprises.1.101.1
The output was:

Code: Select all

NMPv2-SMI::enterprises.1.101.1 = STRING: "4"
I created a script to parse the data on the cacti host in /usr/share/cacti/scripts/:

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
When executed manually it produces the output:

Code: Select all

4
I switched to the GUI of cacti and created an input method. As name I inserted "static input method" (without quotes). Input type is "Script/Command" and Path "<path_cacti>/scripts/get_static_value.sh". I definded neither input fields nor output fields.

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'
Could anybody please tell me how to get this running?
Last edited by xxlray on Wed Jun 17, 2009 5:03 am, edited 1 time in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

The graph template seems to be broken. At least, the generated rrdtool command is not correct. I suppse that a DEF statement is missing. You will create such a statement by defining a graph item related to a valid data source
Reinhard
xxlray
Posts: 3
Joined: Tue Jun 16, 2009 9:47 am

Post by xxlray »

Thank you for your answer.
I deleted the graph template as well as the data template and created new ones.
When I entered the debug mode it displayed the error:

Code: Select all

RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="statig graph template" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
DEF:a="/usr/share/cacti/rra/rogers_static_item_841.rrd":static_item:AVERAGE \
LINE1:a#F51D30:"" 
RRDTool Says:
ERROR: opening '/usr/share/cacti/rra/CENSORED_static_item_841.rrd': No such file or directory
But this was wrong /usr/share/cacti/rra/CENSORED_static_item_841.rrd existed:

Code: Select all

ls -l /usr/share/cacti/rra/ | grep CENSORED_static_item_841.rrd
-rw-r--r--  1 usertest users  56220 Jun 17 10:45 CENSORED_static_item_841.rrd
I had to change the owner of the rrd file:

Code: Select all

chown usertest.root /usr/share/cacti/rra/CENSORED_static_item_841.rrd
Now there is no error message in debug mode.
The graph form can be seen but after waiting for about 15 minutes no values are graphed. There is no curve that can be seen. Shouldn't there be a straight line?

e: I beg your pardon. Everything seems to work. The line was just to thin to see it when it was short. Now that the line is longer it can be seen.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests