PDA

View Full Version : SNMP Community name change


guyp
05-04-2005, 16:49
Hi.

I have many router/switch monitored via snmp. For security reason, community name must be change every 3 monthon every monitored devices. The problem is that the snmp community name is set into ITEM screen instead of HOST definition. This is a bit frustrating, because I have to change every ITEM for every host. For example, a switch with 48 ports will have a least 48 items to be change.

Is there's a way of doing a kind of "mass change" in ZABBIX for community name ?

Thank you !
:eek:

joe
06-04-2005, 23:29
I hope there is an easier way than this, but I'm not sure...

You could always use SQL statements to change the values.

For example:

UPDATE items SET snmp_community = 'new_community' WHERE snmp_community = 'old_community';

That would change all of the SNMP community strings from one string to the new one. Note, that this doesn't change it per device.

You could obviously get more complicated and perform the change by device, item type, etc.

I suppose the other method (web based) would be to use templates, and change the SNMP community string in the template? However, I'm not sure if this works.

joe

guyp
07-04-2005, 17:50
Thank you Joe.

It work perfectly the way you told me. But, It would be nice to
have the snmp-community name into the hosts definition instead of
items definition.

:D

Have a nice day !

joe
07-04-2005, 22:20
I'm glad that worked for you.

I agree that SNMP community strings are usually configured once per device. I suppose there may be some devices with multiple SNMP community strings to access different SNMP mibs, but I don't think they are "normal".

Alexei - what are your thoughts on moving SNMP community string to the HOST configuration, instead of per item?

joe

guyp
07-04-2005, 23:25
Last quick question.

Is there's a way to "import" some graph definition from switch A to
switch B ?

I have 11 switchs, with 48 ports each, and for monitoring purpose, I want to create 1 graph per monitored items.
exemple graph 1 may include :
switch1_ifOctetsIn.1
switch1_ifOctetsOut.1
switch1_ifErrorIn.1
switch1_ifErrorOut.1

Graph 2 may include
switch1_ifOctetsIn.2
switch1_ifOctetsOut.2
switch1_ifErrorIn.2
switch1_ifErrorOut.2

You will understand that if I have 11 switch X 48 ports each, collecting 4 parameters, it make 2112 entry to be created...

Is it possible or I really have to create 1 graph per item, and then 1 screen at a time ?

joe
08-04-2005, 23:49
Well, I have a really nasty, hacked-up MRTG script that I used to initially load all of my switch ports and router interfaces. If you're really interested in it, I could make it available to you. I'm not sure how well it will work other people though, so you would want to run it on a separate zabbix install, to see if it works.

Basically, I took the MRTG cfgmaker perl script, and changed it so it would write specific pieces to the Zabbix DB. Essentially, you run the script with the IP and SNMP community string of the device as arguments, and if it is a Cisco switch or router, it will add the host to the Zabbix DB, and then add items for each interface (assuming it's not a VLAN, Null, or Controller interface), and then creates a graph for each one.

joe
10-04-2005, 08:16
Ok, I decided to write a new script which accomplished the same thing as my hacked-up MRTG script.

You can grab my script here: http://www.theneals.net/zabbix/zabbix-populate.pl

Some notes....

1) I threw this together tonight, but it seems to work with 3 different pieces of hardware I checked.
2) Only tested with Cisco catalyst 6509 (CatOS), catalyst 4000 (CatOS), and a 7206 router.
3) Test this on a backup database.... and don't blame me if it doesn't work and deletes all of your data! :)

You will need SNMP::Info and DBI installed for this perl script to work.

I tested this with Zabbix 1.1alpha7. I believe it should work with all of the 1.1alpha's because I don't think the DB schema changed much from alpha1 to alpha7 (regarding hosts, items, graphs, and graph_items).

The host you try to add must not exist in the Zabbix DB. The script will automatically add the host, 4 items for each interface (inoctets, outoctets, inerrors, and outerrors), and create 2 graphs per interface, one for octets, and one for errors.

Let me know if it works for you! This script is ugly, as I am not a programmer, and really don't know perl well at all.


joe

Hichhiker
29-03-2008, 06:57
Sorry to dig up such an old thread, but what are the chance you still have that script?

-HH

Ok, I decided to write a new script which accomplished the same thing as my hacked-up MRTG script.

You can grab my script here: http://www.theneals.net/zabbix/zabbix-populate.pl

Some notes....

1) I threw this together tonight, but it seems to work with 3 different pieces of hardware I checked.
2) Only tested with Cisco catalyst 6509 (CatOS), catalyst 4000 (CatOS), and a 7206 router.
3) Test this on a backup database.... and don't blame me if it doesn't work and deletes all of your data! :)

You will need SNMP::Info and DBI installed for this perl script to work.

I tested this with Zabbix 1.1alpha7. I believe it should work with all of the 1.1alpha's because I don't think the DB schema changed much from alpha1 to alpha7 (regarding hosts, items, graphs, and graph_items).

The host you try to add must not exist in the Zabbix DB. The script will automatically add the host, 4 items for each interface (inoctets, outoctets, inerrors, and outerrors), and create 2 graphs per interface, one for octets, and one for errors.

Let me know if it works for you! This script is ugly, as I am not a programmer, and really don't know perl well at all.


joe

Tenzer
31-03-2008, 10:25
I would say, that the easiest way to accomplish this, is by changing it directly in the database.

Alexei
31-03-2008, 11:10
There is mass update function in ZABBIX.

Cygace
31-03-2008, 12:44
There is mass update function in ZABBIX.

yes the mass update function works perfectly for that ;)

Hichhiker
31-03-2008, 17:10
There is mass update function in ZABBIX.

As I understood it, the script in questions walks the SNMP connection and loads the values into DB, creates graphs, etc. I don't think you can do that with mass update.

That being said, I found zload_snmpwalk - which did not do everything, but did enough to get me started.

-HH

ericb
27-05-2008, 14:26
we have different devices that use different community strings, is zabbix still limited to using SNMP community strings for ITEMS rather than have a string for the host?

Tenzer
28-05-2008, 09:56
we have different devices that use different community strings, is zabbix still limited to using SNMP community strings for ITEMS rather than have a string for the host?
I wouldn't say that it is "limited" in that regard, rather the other way around, since you are able to define a community name for each item, and that could be desireable in some setups. It has the downside of being harder to update if you need to change the community name, but that is probably the only downside of it.

Hichhiker
28-05-2008, 16:30
I wouldn't say that it is "limited" in that regard, rather the other way around, since you are able to define a community name for each item, and that could be desireable in some setups. It has the downside of being harder to update if you need to change the community name, but that is probably the only downside of it.

I can definitely attest that having individual community per item comes in handy. I monitor product that has its own SNMP stack running on a separate port and with separate community string from the OS one. Of course this is not a common scenario. But mass update does work if you need to change a community string, so I am not sure why this is an issue.

-HH

Alexei
12-06-2008, 23:06
Of course this is not a common scenario. But mass update does work if you need to change a community string, so I am not sure why this is an issue.

-HH
I am not sure either. The mass-update function works absolutely fine and easy to use.