Ad Widget

Collapse

Extract text in SNMP item.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bertrand39100
    Junior Member
    • Feb 2010
    • 27

    #1

    Extract text in SNMP item.

    Hi All,

    is it possible to extract text in an zabbix item created with snmp parameter ?

    Item : IMM_SRV_DESCRIPTION
    Type : SNMPv1 agent
    SNMP OID : 1.3.6.1.2.1.1.1.0
    KEY : 1.3.6.1.2.1.1.1.0
    SNMP Community : xxx_snmp_read
    SNMP Port : 161
    Type of information : Character or Text
    ...

    Result :

    SNMPv2-MIB::sysDescr.0 = STRING: Linux IMM_SRV_VM_ESX1 2.6.16.46-353 #2 PREEMPT Thu Nov 4 14:08:47 UTC 2010 mips

    I want to display and have only "IMM_SRV_VM_ESX1" inside a Zabbix GUI item field.

    Is it possible to display and show only "IMM_SRV_VM_ESX1" string in Zabbix GUI (instead of having the complete string) ?

    Many Thanks.

    Bertrand39100.
  • JBo
    Senior Member
    • Jan 2011
    • 310

    #2
    Hi,

    AFAIK, it is not possible.

    The only solution I see is to define an item of type "external check" associated with a script that does an snmpget and some shell command (sed, awk, cut,..) to return only the part you want.

    Regards,
    JBo

    PS: The part you are looking for seems to be the hostname. Are you sure it is not already available in sysName.0 ?
    Last edited by JBo; 27-01-2011, 12:06. Reason: Added PS

    Comment

    • Bertrand39100
      Junior Member
      • Feb 2010
      • 27

      #3
      Hello JBo,

      Sorry for late answer and Thanks for your information.

      Have a good day

      Bertrand39100.

      Comment

      • cbidwell
        Senior Member
        • Aug 2006
        • 127

        #4
        This seems kind of similar to the problem I'm having. I'm trying to pull text out as well.

        In my case it is ifAlias.x and zabbix by default standards doesn't pull this MIB. Wonder if there's a way I can pull it in manually.

        Code:
        IF-MIB::ifAlias.1 = STRING: SERVERNAME
        IF-MIB::ifAlias.2 = STRING: SERVERNAME
        IF-MIB::ifAlias.3 = STRING: SERVERNAME
        IF-MIB::ifAlias.4 = STRING: SERVERNAME
        IF-MIB::ifAlias.5 = STRING: SERVERNAME
        IF-MIB::ifAlias.6 = STRING: SERVERNAME
        IF-MIB::ifAlias.7 = STRING: SERVERNAME
        IF-MIB::ifAlias.9 = STRING: SERVERNAME
        IF-MIB::ifAlias.11 = STRING: SERVERNAME
        IF-MIB::ifAlias.12 = STRING: SERVERNAME
        IF-MIB::ifAlias.13 = STRING: SERVERNAME
        IF-MIB::ifAlias.15 = STRING: SERVERNAME
        IF-MIB::ifAlias.16 = STRING: SERVERNAME
        IF-MIB::ifAlias.18 = STRING: SERVERNAME

        Comment

        • JBo
          Senior Member
          • Jan 2011
          • 310

          #5
          Originally posted by cbidwell
          This seems kind of similar to the problem I'm having. I'm trying to pull text out as well.

          In my case it is ifAlias.x and zabbix by default standards doesn't pull this MIB. Wonder if there's a way I can pull it in manually.
          Well no, it has nothing similar to the problem Bertrand39100 reported.

          You just need to create an item as follows:
          Description : ifAlias.1
          Type : SNMPv2 agent
          Key: .1.3.6.1.2.1.31.1.1.1.18.1
          Type of information : Character

          That is basic SNMP functionality. You can check the manual for details.

          Hope this helps
          JBo

          Comment

          • cbidwell
            Senior Member
            • Aug 2006
            • 127

            #6
            Thanks for the response...how do you know what the key is?

            Key: .1.3.6.1.2.1.31.1.1.1.18.1

            Comment

            • JBo
              Senior Member
              • Jan 2011
              • 310

              #7
              Originally posted by cbidwell
              Thanks for the response...how do you know what the key is?
              Got it from one of my SNMP templates.

              Otherwise, you can use snmpget:
              Code:
              snmpget -v 2c -On  -c public localhost ifAlias.1
              .1.3.6.1.2.1.31.1.1.1.18.1 = STRING:
              (No alias on this interface)

              JBo

              Comment

              • Bertrand39100
                Junior Member
                • Feb 2010
                • 27

                #8
                Hello JBo,

                To answer your question about :

                "Are you sure it is not already available in sysName.0 ?"

                [root@ids /]# snmpwalk -v 2c -c emo_snmp_read 172.17.x.x 1.3.6.1.2.1.1.5
                SNMPv2-MIB::sysName.0 = STRING: SNMP Service
                [root@ids /]# snmpwalk -v 2c -c emo_snmp_read 172.17.x.x 1.3.6.1.2.1.1.5.0
                SNMPv2-MIB::sysName.0 = STRING: SNMP Service


                I will go forward by making external script with awk to extract the text I want

                Have a nice day.

                Many Thanks

                Comment

                • cbidwell
                  Senior Member
                  • Aug 2006
                  • 127

                  #9
                  It looks like it does pull out the name, but that's just on one interface. How would I get the name/alias for my other interfaces?

                  Code:
                  snmpwalk -v 2c -c GOLD 10.10.10.1 sysName
                  SNMPv2-MIB::sysName.0 = STRING: Team-UNIX

                  Comment

                  • JBo
                    Senior Member
                    • Jan 2011
                    • 310

                    #10
                    Hi,

                    Originally posted by cbidwell
                    It looks like it does pull out the name, but that's just on one interface.
                    Of course, one Zabbix item = one MIB variable.

                    Originally posted by cbidwell
                    How would I get the name/alias for my other interfaces?
                    You have to create one item for each interface.
                    Last number in OID is interface index:
                    ifAlias.2 = .1.3.6.1.2.1.31.1.1.1.18.2
                    and so on.

                    If you need some information on how SNMP works, Wikipedia is a good start.
                    Zabbix has also some documentation about SNMP.

                    Hope this helps,
                    JBo

                    Comment

                    • cbidwell
                      Senior Member
                      • Aug 2006
                      • 127

                      #11
                      Thanks JBo, you've been extremely helpful with my snmp ignorance.

                      This is ultimately what I'd LIKE to do:

                      I want that if02 to be the actual name of the server attached to it. Not sure how to do this.
                      Attached Files
                      Last edited by cbidwell; 31-01-2011, 18:57.

                      Comment

                      Working...