[HOWTO] Add new MIB Variables to Cacti

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

..::BFS::..
Cacti User
Posts: 52
Joined: Fri Mar 12, 2004 3:01 am
Location: Beusichem
Contact:

Post by ..::BFS::.. »

I've tried to set up my own xml file for a snmp query. I can see that I get some results:

Code: Select all

+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at 'C:\Apache2\htdocs\cacti/resource/snmp_queries/pix_con.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.4..9.9.147.1.2.2.2.1.3.40.6'
+ Located input field 'pixConIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.4..9.9.147.1.2.2.2.1.3.40.6'
+ Found item [pixConIndex='Cisco PIX Firewall Version 6.3(3)'] index: 0 [from value]
+ Found item [pixConIndex='OID: enterprises.9.1.417'] index: 0 [from value]
+ Found item [pixConIndex='1538432800'] index: 0 [from value]
+ Found item [pixConIndex='Quaere'] index: 0 [from value]
+ Found item [pixConIndex='eurutpix01'] index: 0 [from value]
+ Found item [pixConIndex='Nieuwegein'] index: 0 [from value]
+ Found item [pixConIndex='4'] index: 0 [from value]
+ Found item [pixConIndex='2'] index: 0 [from value]
+ Found item [pixConIndex='1'] index: 1 [from value]
+ Found item [pixConIndex='2'] index: 2 [from value]
+ Found item [pixConIndex='PIX Firewall outside interface'] index: 1 [from value]
+ Found item [pixConIndex='PIX Firewall inside interface'] index: 2 [from value]
+ Found item [pixConIndex='ethernetCsmacd(6)'] index: 1 [from value]
+ Found item [pixConIndex='ethernetCsmacd(6)'] index: 2 [from value]
+ Found item [pixConIndex='1500'] index: 1 [from value]
+ Found item [pixConIndex='1500'] index: 2 [from value]
+ Found item [pixConIndex='10000000'] index: 1 [from value]
+ Found item [pixConIndex='100000000'] index: 2 [from value]
+ Found item [pixConIndex='00:0F:23:7F:21:93'] index: 1 [from value]
+ Found item [pixConIndex='00:0F:23:7F:21:95'] index: 2 [from value]
+ Found item [pixConIndex='up(1)'] index: 1 [from value]
+ Found item [pixConIndex='up(1)'] index: 2 [from value]
+ Found item [pixConIndex='up(1)'] index: 1 [from value]
+ Found item [pixConIndex='up(1)'] index: 2 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='0'] index: 2 [from value]
+ Found item [pixConIndex='3557631982'] index: 1 [from value]
+ Found item [pixConIndex='1698275673'] index: 2 [from value]
+ Found item [pixConIndex='7004427'] index: 1 [from value]
+ Found item [pixConIndex='5141609'] index: 2 [from value]
+ Found item [pixConIndex='7'] index: 1 [from value]
+ Found item [pixConIndex='352586'] index: 2 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='0'] index: 2 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='0'] index: 2 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='8'] index: 2 [from value]
+ Found item [pixConIndex='1835331528'] index: 1 [from value]
+ Found item [pixConIndex='3332800856'] index: 2 [from value]
+ Found item [pixConIndex='6450319'] index: 1 [from value]
+ Found item [pixConIndex='5628972'] index: 2 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='0'] index: 2 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='0'] index: 2 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='0'] index: 2 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='0'] index: 2 [from value]
+ Found item [pixConIndex='OID: .ccitt.zeroDotZero'] index: 1 [from value]
+ Found item [pixConIndex='OID: .ccitt.zeroDotZero'] index: 2 [from value]
+ Found item [pixConIndex='10.0.0.1'] index: 1 [from value]
+ Found item [pixConIndex='192.168.1.3'] index: 3 [from value]
+ Found item [pixConIndex='1'] index: 1 [from value]
+ Found item [pixConIndex='2'] index: 3 [from value]
+ Found item [pixConIndex='255.255.255.0'] index: 1 [from value]
+ Found item [pixConIndex='255.255.255.0'] index: 3 [from value]
+ Found item [pixConIndex='0'] index: 1 [from value]
+ Found item [pixConIndex='0'] index: 3 [from value]
+ Found item [pixConIndex='65535'] index: 1 [from value]
+ Found item [pixConIndex='65535'] index: 3 [from value]
+ Found data query XML file at 'C:\Apache2\htdocs\cacti/resource/snmp_queries/pix_con.xml'
+ Found data query XML file at 'C:\Apache2\htdocs\cacti/resource/snmp_queries/pix_con.xml'
+ Found data query XML file at 'C:\Apache2\htdocs\cacti/resource/snmp_queries/pix_con.xml'
I do get a graph but it's empty. I probably did something wrong but can't see what I'm missing.

Attached are my pix_con.xml and the graph I get...
Attachments
pix_con.xml
(1.18 KiB) Downloaded 682 times
Pix_con_test.JPG
Pix_con_test.JPG (110.2 KiB) Viewed 16857 times
Lux
Cacti User
Posts: 195
Joined: Tue Nov 11, 2003 10:57 am
Location: Luxembourg

Post by Lux »

Your XMP file looks a bit strange to me. You've listed completely different OIDs for your index and for your 5minute connections. The index should normally be on the same branch of the OID tree as the variables that you want to graph.

Take another look at the OIDs and ensure that they are the ones that you want to use.

Mike
..::BFS::..
Cacti User
Posts: 52
Joined: Fri Mar 12, 2004 3:01 am
Location: Beusichem
Contact:

Post by ..::BFS::.. »

But it should write data to the graphs souldn't it? Maybe useless data but as you can see there's no data at all in de graphs.
svenu_ind
Posts: 3
Joined: Thu Nov 25, 2004 10:41 am

Informational/HOWTO's

Post by svenu_ind »

Hi
I have followed the instructions mentioned by you. After the step6 i.e After adding the graph template to the data query . When I checked the data associated templates.

There was a warning message

"variable passed to each () is not an array or object in /var/www/html/cacti/data queries.php"

When I try to add device selecting the device I created it gives me the
same error.

Any Clue ?

Please help
monachus
Posts: 42
Joined: Mon Sep 06, 2004 1:27 am
Location: New York, NY
Contact:

Detailed HOW-TO for XML/Data Queries

Post by monachus »

I wrote this today to better document the steps I had to take to create (and understand) a Data Query and the subsequent objects. This is for my company, so that others can do it without having to unravel the steps. I did it for an Alteon AceDirector, which is the other reason I'm posting it - there seems to be an absence of Alteon information up here.

My thanks to Lux for the original How-To, and to whomever wrote the Cacti Manual for the snippets I jacked from there.

I hope that it's useful to you all.
Attachments
Cacti_Data_Queries.zip
Detailed docs on XML Data Queries and Cacti. Contains a single MS-Word document.
(13.78 KiB) Downloaded 2281 times
Adrian Goins - President / CEO
Arces Network, LLC
http://www.arces.net
Guest

Post by Guest »

Thanks monachus and everyone else. Really nice work.
User avatar
MagnaChef
Cacti User
Posts: 164
Joined: Tue Nov 25, 2003 3:58 pm
Location: Buffalo, NY

Post by MagnaChef »

I have a question similar to one that was previously asked. I am trying to monitor a Novell proxy server. Specifically, I need to monitor the variable proxyStatsConnectActiveConnections. Seeing as this is a general service on the machine, there is no indexing - the index is always zero. Is there a way that I can just define the <oid_index> to be zero, and then put the oid that I need to poll?

Thanks.
monachus
Posts: 42
Joined: Mon Sep 06, 2004 1:27 am
Location: New York, NY
Contact:

SNMP w/ no Index

Post by monachus »

Use "Get SNMP Data" as your Data Query Method instead of "Get SNMP Data (Indexed)" and put in the OID. You should be able to do this without writing a whole gnarly script and XML template.
Adrian Goins - President / CEO
Arces Network, LLC
http://www.arces.net
User avatar
MagnaChef
Cacti User
Posts: 164
Joined: Tue Nov 25, 2003 3:58 pm
Location: Buffalo, NY

Post by MagnaChef »

Is there a HOWTO for adding a data source that will only poll a specific OID. I tried adding a data source named "Get SNMP Data" instead of "Get SNMP Data (indexed)" but all that shows up in the drop down is Get SNMP Data (indexed)"
monachus
Posts: 42
Joined: Mon Sep 06, 2004 1:27 am
Location: New York, NY
Contact:

Post by monachus »

Data Template

1. Create a Data template for proxyStatsConnectActiveConnections. Call it "Proxy DT - Active Connections"
2. Set the Name to "|host_description| - Active Connections"
3. Set the Data Input Method to "Get SNMP Data"
4. Set the Internal Data Source Name to "num_conns"
5. Give it a Max of 200000 (or whatever)
6. Make it a Gauge
7. Save
8. After saving, you'll have new options. Enter your OID into the OID field
9. Click Save

Graph Template

1. Create a Graph Template. Call it "Proxy GT - Active Connections"
2. Set the Name to "|host_description| - Active Connections"
3. Save
4. In the screen that follows, select "Add" from Graph Template Items in the top right.
5. In the next screen, choose your DT from above.
6. Add some colors and stuff for the graph output
7. Save

If you have a Host Template for this type of device, you can add the GT you just created to the Host Template and it will always appear. Alternatively, just go to your device and add the GT to the Device Information screen. When you go to "Create Graphs for this Host," you should have the Graph Template there. Check it and save.

Ta Da!

It should be noted that I'm _not_ a Cacti expert. I get my information from looking at the scripts that have been provided and figuring out the rest. It's not that difficult, and I encourage everyone to spend a few hours looking over what already works. It helps to name your templates with a name that says what they are (GT, DT, HT), so that it clarifies which your adding to what.
Adrian Goins - President / CEO
Arces Network, LLC
http://www.arces.net
User avatar
MagnaChef
Cacti User
Posts: 164
Joined: Tue Nov 25, 2003 3:58 pm
Location: Buffalo, NY

Post by MagnaChef »

Thank You very much!

This was exactly what I was looking for! :D

-Dan
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

Does anyone have a copy of that word doc? I am hoping that it will help me with getting the graph to actualy populate.
monachus
Posts: 42
Joined: Mon Sep 06, 2004 1:27 am
Location: New York, NY
Contact:

Post by monachus »

download the zip file and extract it. the word doc is inside.
Adrian Goins - President / CEO
Arces Network, LLC
http://www.arces.net
ajeskey
Cacti User
Posts: 93
Joined: Mon Mar 28, 2005 4:31 pm
Location: Boston, MA

Post by ajeskey »

when ever i click on the download link i just get prompted to save the download.php

I wouldn't have asked if i could just click the link :)
monachus
Posts: 42
Joined: Mon Sep 06, 2004 1:27 am
Location: New York, NY
Contact:

Post by monachus »

something's wrong w/ your browser. email me directly at <snipped> and i'll send you the file.
Last edited by monachus on Thu Apr 07, 2005 10:19 pm, edited 1 time in total.
Adrian Goins - President / CEO
Arces Network, LLC
http://www.arces.net
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests