dhcpd-snmp

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

Moderators: Moderators, Developers

Author
Message
CdG
Posts: 17
Joined: Tue Jun 20, 2006 9:04 am

dhcpd-snmp

#1 Post by CdG » Tue Jun 20, 2006 9:22 am

Hi all,

I've created a template to monitor dhcp usage using the dhcpd-snmp you can find at:

http://www.net-track.ch/opensource/dhcpd-snmp/

The perlscript creates a configfile for dhcpd-snmp from dhcpd.conf.

Please see if you like it.

CdG
Attachments
dhcpd-snmp.zip
(4.3 KiB) Downloaded 5435 times

CdG
Posts: 17
Joined: Tue Jun 20, 2006 9:04 am

#2 Post by CdG » Tue Jun 20, 2006 10:22 am

<Sigh>

of course I forgot to include the snmp_queries xml-file.
Attachments
dhcpd-snmp.xml
(1.76 KiB) Downloaded 4218 times

dw
Posts: 1
Joined: Thu Aug 03, 2006 9:31 am

#3 Post by dw » Thu Aug 03, 2006 10:04 am

I came a cross this post and was pleased to see some one made a nice .xml file for using the package dhcp-snmp. I haven't found anything else that could help me.



I downloaded the .xml file and tried importing it, cacti didn't show me the messages I was hoping to see "adding template ...", you probably know waht I mean.

I'm using the latest cact at the moment, which is 0.8.6h.

After some experimenting with the .xml file I finally noticed it's not a .xml template for a graph or data objects. It actually is a .xml "data query template" file. Which I placed at the <path_cacti>/resource/snmp_queries/ location and added it as a query file to cacti.

As you might have noticed I'm "new" to cacti, because I recently installed it and still getting new ideas to put into cacti.

I've been toying around with all kinds of different ways to get the info I wanted out of SNMP and finally managed to generate a nice graph.

I just finished the template and haven't had much testing yet.. The graph is included at this post.



I also included my graph template, so people who're interessted on this topic can try it out themselves. Maybe more experianced people could have a look at this and comment to this?

Before I forget: Tnx CdG for posting this .xml file, it did help me alot to go
investigate and understand cacti a bit more :)

,
DW
Attachments
cacti_graph_template_dhcp_snmp.xml
My first cacti template :)
(25.45 KiB) Downloaded 2716 times
graph_image.php.png
My dhcp-snmp graph
graph_image.php.png (23.42 KiB) Viewed 68789 times

fhuber
Posts: 1
Joined: Mon Aug 07, 2006 4:51 am

Modified Data Template

#4 Post by fhuber » Mon Aug 07, 2006 4:57 am

Hi!

I checked out your template and modified it, so that all data sources are put together in one template. IMHO it is a little bit more handy.

Now you can create more pools in dhcpd-snmp.conf and when creating graphs, a list of available pools is autocreated by get-snmp-data (indexed).

Fhuber
Attachments
cacti_graph_template_dhcp_statistics_snmp.xml
Modified data template (all data sources in one template)
(19.6 KiB) Downloaded 3026 times

User avatar
egarnel
Cacti Pro User
Posts: 703
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

#5 Post by egarnel » Wed Aug 09, 2006 10:04 am

Ok, I am trying this out.

I have the snmp part working fine, but I am a little confused on which xml file goes where...

Does the xml file inlcluded in the zip go under <cacti>/resource/snmp_queries ? that is where I put it.
and which of the posted xml files needs to be imported? I imported the last one for multple scopes without any problems.
Also, do I need to spec any custom data when creating the graph (OID, etc...)
So far this is what I get with graph debugging on

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="dhcp2 - DHCP |query_dhcpSnmpPoolDescription| Statistics" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="# leases" \
--slope-mode \
DEF:a="/var/www/html/rra/dhcp2_poolactive_1169.rrd":PoolActive:AVERAGE \
DEF:b="/var/www/html/rra/dhcp2_poolactive_1169.rrd":PoolAvailable:AVERAGE \
DEF:c="/var/www/html/rra/dhcp2_poolactive_1169.rrd":PoolExpire:AVERAGE \
DEF:d="/var/www/html/rra/dhcp2_poolactive_1169.rrd":PoolSize:AVERAGE \
LINE2:a#4444FF:"Active leases"  \
GPRINT:a:LAST:"   Current\:%8.2lf%s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf%s\n"  \
LINE2:b#00CF00:"Available leases"  \
GPRINT:b:LAST:"Current\:%8.2lf%s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf%s\n"  \
LINE2:c#F51D30:"Expired leases"  \
GPRINT:c:LAST:"  Current\:%8.2lf%s"  \
GPRINT:c:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:c:MAX:"Maximum\:%8.2lf%s\n"  \
LINE2:d#CCBB00:"Pool size"  \
GPRINT:d:LAST:"       Current\:%8.2lf%s"  \
GPRINT:d:AVERAGE:"Average\:%8.2lf%s"  \
GPRINT:d:MAX:"Maximum\:%8.2lf%s\n" 

RRDTool Says:

ERROR: opening '/var/www/html/rra/dhcp2_poolactive_1169.rrd': No such file or directory
No entries in cacti.log, but I need to bump up the logging level and check again

This is a really awesome script and we could definately make use of it, but not quite there yet..

thanks for your help
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey

EvolutionW
Posts: 1
Joined: Wed Apr 12, 2006 12:19 pm

#6 Post by EvolutionW » Fri Aug 11, 2006 5:40 pm

Same problem here, I put the first .xml in the path dw specified but can't import the template egarnel or fhuber made, but thank you for the files, nice work.

kagoryu
Posts: 6
Joined: Thu Dec 08, 2005 4:29 am

#7 Post by kagoryu » Tue Aug 15, 2006 4:33 am

i'm having problems installing the dhcpd-snmp script.
when i test it :

[[email protected]]# dhcpd-snmp dhcpd-snmp.conf
PING
PONG
get
.1.3.6.1.4.1.21695.1.2.1
NONE

from the readme it says i should be getting three lines: the OID, ``integer'', and the number of configured pools.

thanks.

scramatte
Posts: 2
Joined: Sat Oct 14, 2006 10:10 am

About Custom datas fields ...

#8 Post by scramatte » Sat Oct 14, 2006 10:20 am

Hello,

Does anyone know which values I must put in 3 custom fields :

Index Type
Index Value
Output Type ID

Seems that without this values the template can't works ...

Regards

CdG
Posts: 17
Joined: Tue Jun 20, 2006 9:04 am

#9 Post by CdG » Thu Oct 26, 2006 5:45 am

OK, I realise that my original post was a bit premature.

I've created a graph and host template to go with it.

Good luck!
Attachments
dhcp.png
dhcp.png (14.98 KiB) Viewed 66950 times
dhcpd-snmp.zip
(6.04 KiB) Downloaded 5095 times

User avatar
egarnel
Cacti Pro User
Posts: 703
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

#10 Post by egarnel » Thu Oct 26, 2006 8:10 am

Under the data template, you have the Max value set to 254. This is great if the lease is for a 24bit subnet, but I have a 16 bit subnet dhcp scope being dished out from the same dhcp server as well.

I can duplicate the templates and mod the new one for the 16 bit graph and use seperate templates for the different scopes, but I was wondering if there is an easier way? Perhaps make use of the "Use Per-Data Source Value (Ignore this Value)"?

Either way, I have graphs now. Thank you for providing this template.
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey

grumpf-dream
Posts: 14
Joined: Wed Sep 06, 2006 12:59 am

Re: About Custom datas fields ...

#11 Post by grumpf-dream » Thu Oct 26, 2006 9:33 am

scramatte wrote:Hello,

Does anyone know which values I must put in 3 custom fields :

Index Type
Index Value
Output Type ID

Seems that without this values the template can't works ...

Regards
same question here :)

User avatar
egarnel
Cacti Pro User
Posts: 703
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

#12 Post by egarnel » Thu Oct 26, 2006 10:27 am

Couldn't figure out why this was working on 1 dhcp server but not the other...

a quick look at /var/log/messages showed that selinux was blocking it.

a quick "setenforce Permissive" fixed it. I will go back and edit my policies to add the script
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey

grumpf-dream
Posts: 14
Joined: Wed Sep 06, 2006 12:59 am

#13 Post by grumpf-dream » Thu Oct 26, 2006 11:06 am

CdG wrote:OK, I realise that my original post was a bit premature.

I've created a graph and host template to go with it.

Good luck!
great job!
working perfect :)
mv xml to snmp_queries import other one graphing ;)
thx!

CdG
Posts: 17
Joined: Tue Jun 20, 2006 9:04 am

#14 Post by CdG » Fri Oct 27, 2006 7:38 am

egarnel wrote:Under the data template, you have the Max value set to 254. This is great if the lease is for a 24bit subnet, but I have a 16 bit subnet dhcp scope being dished out from the same dhcp server as well.

I can duplicate the templates and mod the new one for the 16 bit graph and use seperate templates for the different scopes, but I was wondering if there is an easier way? Perhaps make use of the "Use Per-Data Source Value (Ignore this Value)"?

Either way, I have graphs now. Thank you for providing this template.
This Max value is in the graph template posted by fhuber. The one in the zipfile I posted only has a Max value for expired leases, which I currently do not graph. But I agree: the 'Per-Data Source Value' might be better.

CdG

jokerz
Posts: 13
Joined: Thu Oct 26, 2006 11:57 am

#15 Post by jokerz » Fri Oct 27, 2006 2:28 pm

I am trying to follow the direction on how to import this into my cacti but it is just not working.. is there a how-to guide on proper importing of these scripts/ templates...

I keep getting this error msg:

Warning: file(c:/Inetpub/wwwroot/cacti/resource/snmp_queries/dhcpd-snmp.xml) [function.file]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\cacti\lib\data_query.php on line 79

Warning: implode() [function.implode]: Bad arguments. in c:\Inetpub\wwwroot\cacti\lib\data_query.php on line 79

please note my dhcpd is a win2k3 server.

Post Reply