PDA

View Full Version : Low-level SNMP discovery for the 1.9.4 release


simon123
08-06-2011, 22:34
First of all, let me say: i'm a great fan of this product and love the new low-level discovery feature.

I was testing the 1.9.4, and would need it almost exclusivly for it's SNMP monitoring capabilities.
The low-level discovery feature is a great help in deploying and maintaining a large network environment, thumbs up for that one!
Monitoring storage usage with this feature works like a charm.

When it comes to monitoring network traffic however, low-level discovery has some restrictions for me. Let me explain by example:

When we monitor network traffic, we like to make items/graphs/triggers and categorize all items/triggers/graphs with the IP-Adres.
So it would say something like "Incoming traffic on 192.168.50.1". In previous versions i was able to do this with macro's.

Here's the kicker: when you use low-level discovery (as described in the manual) the items created can only have either the given name (e.g. eth0) or the index number of the NIC (OID).
This naming convention is great if you only have a couple of servers and know your way around each of them. For large environments however these item/graph/trigger names would be useless.
Unless you know what "Intel(R) PRO/1000 MT Network Connection #4" on machine gate02.example.com is connected to by hart.

A workaround for this would be to use the ipAdEntIfIndex OID (as rule). This produces something like:

root@zbx-beta:/tmp/zabbix-1.9.4# snmpwalk -v1 -cpublic 172.16.80.151 1.3.6.1.2.1.4.20.1.2
iso.3.6.1.2.1.4.20.1.2.127.0.0.1 = INTEGER: 1
iso.3.6.1.2.1.4.20.1.2.172.16.80.151 = INTEGER: 2

So you could use the index (being the IP-Address) and the value (being the NIC card OID Index) in your prototype item. This would work great except for the fact that the index macro ({#SNMPINDEX}) in this case is only the last digits of the OID (everything following the last point).
So i get items like: "Incoming traffic on 151" instead of the full IP. It would be great to have an option on choosing wether to use the last part of the OID or use the last 4 parts, as is the case with IPv4 addresses.

I think that using only the last digits of the OID as a hardcoded option will cause issues for other OID's as well.

Any ideas on this?

richlv
29-06-2011, 20:08
so that would be more or less ability to choose an arbitrary amount of id segments.
might be worth adding as a zbxnext, if there's not something similar already :)

simon123
29-06-2011, 22:11
so that would be more or less ability to choose an arbitrary amount of id segments.
might be worth adding as a zbxnext, if there's not something similar already :)

Yes, I had already created the feature request :) :

https://support.zabbix.com/browse/ZBXNEXT-808

This would really be an improvement for our distributed Zabbix environment.

xmaster
13-08-2011, 22:35
Need that functionality too!
When you enter, for example, IP-MIB::ipAdEntAddr, and complete OID is
IP-MIB::ipAdEntAddr.10.10.10.1, {#SNMPINDEX} should be 10.10.10.1, not just 1.

delatbabel
28-08-2011, 04:01
I can't find anything in the documentation about auto SNMP registration or low level discovery.

I have created a discovery rule to attempt to auto discover a host by listing the IP address and the SNMP community name. I have checked that the host has snmp running and I can manually snmpwalk the host from the Zabbix server. However the host never gets registered.

Does anyone have some URLs of documents describing how to do this?

zalex_ua
28-08-2011, 08:57
Be careful, Low Lewel Discovery is not the same as the regular network discovery, and it will be available only in the future version 2.0. It's documented here:
http://www.zabbix.com/documentation/2.0/manual/discovery/low_level_discovery
and it is not finished.

Documentation of the network discovery for the auto-registration is available here:
http://www.zabbix.com/documentation/1.8/manual/auto-discovery

jesmit
06-09-2011, 18:10
The only big problem I see is that SNMPINDEX is expected to be a type INT, so the impact of code change may be non-trivial if it is changes to accommodate variable length indexes (ie. strings).

netmon
04-03-2012, 15:14
Take a look at:
http://www.zabbix.com/forum/showthread.php?t=25310
https://github.com/simonkowallik/Zabbix-Addons

root@zbx-beta:/tmp/zabbix-1.9.4# snmpwalk -v1 -cpublic 172.16.80.151 1.3.6.1.2.1.4.20.1.2
iso.3.6.1.2.1.4.20.1.2.127.0.0.1 = INTEGER: 1
iso.3.6.1.2.1.4.20.1.2.172.16.80.151 = INTEGER: 2

You can use advsnmp.discovery for that.

advsnmp.discovery[{HOST.IP},"-v1 -cpublic",.1.3.6.1.2.1.4.20.1.2,1.4]
This will give you:
{#ADVSNMPINDEX1} => 127.0.0.1 {#ADVSNMPVALUE} => 1
{#ADVSNMPINDEX1} => 172.16.80.151 {#ADVSNMPVALUE} => 2

jesmit
11-03-2012, 22:07
This works great. Thanks!

I had to make one small change..

133 # Remove any double quotes from $value
134 $value =~ tr/"//d;
135 $INDEXES{$line_index} = $value;
136 # put generated line index into @indexes


Turns out my snmpvalues had double quotes in them already and it was being interpreted as an empty value. I'm not 100% sure if the code above is the best approach or if the quotes should be escaped instead. Just off the top of my head it should not matter.

-j

netmon
12-03-2012, 16:36
jesmit, thanks for the info.

Added. :-)

jesmit
15-03-2012, 22:32
I'm hoping someone can help me. I've upgraded to 2.0rc1

I am now getting "Value should be JSON object" error messages.

I've modified the script to conform to the new notation and it looks like the following;



{
"data":[

{
"{#ADVSNMPINDEX1}":"1",
"{#ADVSNMPVALUE}":"fw-1"
},
{
"{#ADVSNMPINDEX1}":"10",
"{#ADVSNMPVALUE}":"fw-P"
},
{
"{#ADVSNMPINDEX1}":"11",
"{#ADVSNMPVALUE}":"fw-E"
},
{
"{#ADVSNMPINDEX1}":"12",
"{#ADVSNMPVALUE}":"fw-C"
},
{
"{#ADVSNMPINDEX1}":"13",
"{#ADVSNMPVALUE}":"fw-S"
},
{
"{#ADVSNMPINDEX1}":"14",
"{#ADVSNMPVALUE}":"fw-I"
},
{
"{#ADVSNMPINDEX1}":"15",
"{#ADVSNMPVALUE}":"fw-D"
}

]
}


---

Just wondering if someone can spot anything obvious..

Thanks.

-j

netmon
16-03-2012, 09:20
Hi jesmit,

2.0.0rc1 is a very fresh release. But, as you, I'm also living on the edge. ;-)

Checkout Version 1.3 of advsnmp.discovery.
https://github.com/simonkowallik/Zabbix-Addons

zalex_ua
16-03-2012, 11:36
I'm on that edge already three years ;)

jesmit
16-03-2012, 18:11
Thanks netmon.

Unfortunately I'm still getting the error. Are you at 2.0rc1 yet and have it working? Just curious if this is just something that I did (compile problem or something) or if it is a bug.

-j

netmon
18-03-2012, 09:45
I'm running v2.0.0rc2 (revision 26135).
The JSON you posted is valid. Maybe you try with rc2?

jesmit
27-03-2012, 19:22
I think I figured out what is going on. It seems like there may be an item limit although I'm not sure how big it is. I'm using RFC1213-MIB::ipRouteIfIndex and pulling over 900 entries and am getting the "is not valid JSON" errors. If I pull from a router with a much smaller routing table (~100) then this works just fine.

The reason I'm doing this is that I would like to alert when my routing table changes (BGP update, etc).

Does anyone reading this have any idea what the limit is? My externalscripts timeout is set to 30seconds and the script is not even coming close to taking that long to execute.

Thanks,

-j

ahowell
29-03-2012, 08:45
Are you using proxies?

It's a known issue with proxies, see ZBX-4780

jesmit
29-03-2012, 15:46
I'm not using proxies, but having the same issues. I just installed a new branch yesterday, so I'll check to see if this is now resolved.

Thanks for the pointer.

-j