[HOWTO] Using Data Queries and Data Input Methods

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Post by Leddy »

Thanks so much for this in depth write up.

I've actually taught myself how to implement cacti differently. I prefer this approach better.

My question is I have a DIM that will save 7 items. I created a graph to monitor 2 of those items and it worked great. My problem is that I created another graph to display 2 more of those items. However the .pl script is now getting called twice and creating 2 different.

How can I use this method of graphing hosts and only call my script once and have multiple graphs based on different variables returned?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Create the first Graph as usual (from Create Graphs for this Host). The goto Graph Management and Add. Select the wanted Graph Template and Host. Next step: select the correct data sources. This will use existing data sources instead of generating new ones
Reinhard
Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Post by Leddy »

Hmm I had tried that. I noticed there was 2 sets of data sources in the drop down, so I selected the opposite one. It still polled twice. I've decided for this graph to seperate it logically into their own scripts. I'll have to try again next time on a different DIM.

Thanks
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

You may get rid of the duplicated rrd: Select both Data Sources and copy down the names of the according rrds. Simply replace one of the filenames by the other one. Then run php rebuild_poller_ccache.php or Clear Poller Cache
Reinhard
Leddy
Cacti User
Posts: 93
Joined: Sun May 15, 2005 6:55 pm

Post by Leddy »

I finally got it working. Not sure what I did previously. Following your steps worked great. I've just been battling "NaN"'s all day :(

I think recreating the Graph Template resolved that issue. Must have been a Dat Source inconsistency.

*clap* *clap*

Thanks, keep up the good work
Geier0815
Posts: 13
Joined: Mon May 22, 2006 8:21 am

Post by Geier0815 »

Hello lvm,

it's a nice HowTo you wrote, but I've got problems with it. I've created an graph for traffic but the measures seemd to be wrong. I've downloaded a 1GB File to the computer and wget told me that the average downloadrate was 4.95 MB/s. cacti shows a rate of 40k. Do you have an Idea where I can look whats going wrong?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

First, pay attention to bits and Bytes. wget reports in Bytes, cacti (usually) in bits.
Second, pay attention to the timespan of a reading. Cacti takes its readings every 300 sec. But if you perform a download that only lasts for some seconds, during download time the traffic is high, but averaged over 300 sec it will be much lower
Reinhard
Geier0815
Posts: 13
Joined: Mon May 22, 2006 8:21 am

Post by Geier0815 »

lvm wrote:First, pay attention to bits and Bytes. wget reports in Bytes, cacti (usually) in bits.
In your HowTo you use ifInOctets and ifOutOctets and so do I.
Second, pay attention to the timespan of a reading. Cacti takes its readings every 300 sec. But if you perform a download that only lasts for some seconds, during download time the traffic is high, but averaged over 300 sec it will be much lower
Reinhard
I've downloaded a 1GB File 2 times, so the download takes more than 5 minutes.
And the third point is that a graph created by 'Internet - traffic (bytes/sec)' shows exaktly the same form but right measures (nearly 3,5M) and i can't find any diffrent between the two data templates or the graph templates. I'm completely mystified.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please post a screenshot of the failing Graph along with the CDEFs used within
Reinhard
Geier0815
Posts: 13
Joined: Mon May 22, 2006 8:21 am

Post by Geier0815 »

First screenshot shows the both traffic graphs when traffic is low. You see that both are equal.
The second screenshot was made after loading three times a 1GB file, you see the form of both are equal but the measures differ.

CDEFs where on both set to 'none' or you mean something that I couldn't found.
Attachments
cacti_hoher_load.jpg
cacti_hoher_load.jpg (67 KiB) Viewed 29655 times
cacti_niedriger_load.jpg
cacti_niedriger_load.jpg (74.6 KiB) Viewed 29655 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please click on both graphs to see a little wrench next to the newly generated graphs. Click this to see the whole rrdtool graph statement and post both. I'll request the next step then
Reinhard
Geier0815
Posts: 13
Joined: Mon May 22, 2006 8:21 am

Post by Geier0815 »

testserver6 test-traffic:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="testserver6 - Test-traffic" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes per second" \
DEF:a="/usr/share/cacti/rra/testserver6_ifinoctets_35.rrd":ifInOctets:AVERAGE \
DEF:b="/usr/share/cacti/rra/testserver6_ifinoctets_35.rrd":ifOutOctets:AVERAGE \
LINE2:a#FF00FF:"incomming" \
LINE1:b#4123A1:"output data"
For the other graph:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="testserver6 - Traffic - 213.178.71.76 (eth0)" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bytes per second" \
DEF:a="/usr/share/cacti/rra/testserver6_traffic_in_33.rrd":traffic_in:AVERAGE \
DEF:b="/usr/share/cacti/rra/testserver6_traffic_in_33.rrd":traffic_out:AVERAGE \
AREA:a#00CF00:"Inbound" \
GPRINT:a:LAST:" Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:b#002A97:"Outbound" \
GPRINT:b:LAST:"Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s"
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Would you please post a screenshot of both Data Sources like the attached?
Reinhard
Attachments
Data source
Data source
Bildschirmfoto-4.png (35.16 KiB) Viewed 29592 times
Geier0815
Posts: 13
Joined: Mon May 22, 2006 8:21 am

Post by Geier0815 »

Here the screenshots, first this with the wrong measures:
Attachments
cacti_datasource_traffic.jpg
cacti_datasource_traffic.jpg (104.04 KiB) Viewed 29585 times
cacti_datasource_test_traffic.jpg
cacti_datasource_test_traffic.jpg (68.19 KiB) Viewed 29585 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I can't make sense of it. Looks like my own stuff (that works). Is it possible to switch Settings -> Logging Level to DEBUG for one polling cycle and post the part belonging to both data templates (the polling including the OID fetched and the data returned and the "rrdtool update" part)?
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest