Ad Widget

Collapse

SNMP Community name change

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • guyp
    Junior Member
    • Mar 2005
    • 9

    #1

    SNMP Community name change

    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 !
  • joe
    Junior Member
    • Nov 2004
    • 27

    #2
    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

    Comment

    • guyp
      Junior Member
      • Mar 2005
      • 9

      #3
      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.



      Have a nice day !

      Comment

      • joe
        Junior Member
        • Nov 2004
        • 27

        #4
        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

        Comment

        • guyp
          Junior Member
          • Mar 2005
          • 9

          #5
          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 ?

          Comment

          • joe
            Junior Member
            • Nov 2004
            • 27

            #6
            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.

            Comment

            • joe
              Junior Member
              • Nov 2004
              • 27

              #7
              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

              Comment

              • Hichhiker
                Member
                • Nov 2004
                • 45

                #8
                Sorry to dig up such an old thread, but what are the chance you still have that script?

                -HH

                Originally posted by joe
                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

                Comment

                • Tenzer
                  Senior Member
                  • Nov 2007
                  • 316

                  #9
                  I would say, that the easiest way to accomplish this, is by changing it directly in the database.

                  Comment

                  • Alexei
                    Founder, CEO
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Sep 2004
                    • 5654

                    #10
                    There is mass update function in ZABBIX.
                    Alexei Vladishev
                    Creator of Zabbix, Product manager
                    New York | Tokyo | Riga
                    My Twitter

                    Comment

                    • Cygace
                      Junior Member
                      • Feb 2008
                      • 22

                      #11
                      Originally posted by Alexei
                      There is mass update function in ZABBIX.
                      yes the mass update function works perfectly for that

                      Comment

                      • Hichhiker
                        Member
                        • Nov 2004
                        • 45

                        #12
                        Originally posted by Alexei
                        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

                        Comment

                        • ericb
                          Junior Member
                          • Jul 2006
                          • 24

                          #13
                          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?

                          Comment

                          • Tenzer
                            Senior Member
                            • Nov 2007
                            • 316

                            #14
                            Originally posted by ericb
                            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.

                            Comment

                            • Hichhiker
                              Member
                              • Nov 2004
                              • 45

                              #15
                              Originally posted by Tenzer
                              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

                              Comment

                              Working...