Ad Widget

Collapse

Using snmp string values for graphs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HunterSeeker
    Junior Member
    • Aug 2010
    • 10

    #1

    Using snmp string values for graphs

    Hi everyone,
    I have a BladeCenter which I am monitoring with Zabbix using snmp. The BladeCenter returns temperatures in string form, for example "36 Centigrade". Is there a way to use these values to graph temperatures?

    EDIT:
    I've looked more into the issue and it seems someone had a similar problem back in 1.6.x and the feature to work with strings was promised. The thread I looked at is here:



    EDIT2:
    Would it be possible to use say a script to parse the string and have zabbix take the value from there? Is it possible to create an item in this way?
    Last edited by HunterSeeker; 20-08-2010, 19:17.
  • HunterSeeker
    Junior Member
    • Aug 2010
    • 10

    #2
    A colleague told me that he wrote a script for one of Zabbix's competitors to enable this function. Is it possible to do something similar with Zabbix?

    EDIT: Script
    I found out the way to do this is using "external checks." For that purpose I made the following simple script:

    Code:
    #!/bin/bash
    Norm=37
    Crit=41
    
    TempValue=$(/usr/bin/snmpget -c X -v 1 x.x.x.x 1.3.6.1.4.1.2.3.51.2.2.10.5.5.30.1.3.6)
    
    TempValue2=${TempValue:62:2}
    
    echo $TempValue2
    
    if [ $TempValue2 -lt $Norm ]; then
            exit 0
    else
            if [ $TempValue2 -ge $Crit ]; then
                    exit 2
            else
                    if [ $TempValue2 -ge $Norm ]; then
                            exit 1
                    fi
            fi
    fi
    exit 3
    Is there a way to get Zabbix to use TempValue2 for a graph?
    Last edited by HunterSeeker; 24-08-2010, 20:36.

    Comment

    • HunterSeeker
      Junior Member
      • Aug 2010
      • 10

      #3
      Can anyone help? Is something wrong with my script perhaps? Is echoing the value not enough. Zabbix shows no errors.

      Comment

      • alixen
        Senior Member
        • Apr 2006
        • 474

        #4
        Hi,

        I've seen 2 problems in your script:
        1. You don't specify actual host in snmpget command.
        Zabbix will pass DNS name or IP address (depending on host configuration) as first parameter to your script. You should replace x.x.x.x in your script by $1.

        2. All other checks look like Nagios specific, they are useless (you will define your warning and critical thresholds in Zabbix triggers).

        This script should be OK:
        Code:
        #!/bin/bash
        TempValue=$(/usr/bin/snmpget -c X -v 1 $1 1.3.6.1.4.1.2.3.51.2.2.10.5.5.30.1.3.6)
        TempValue2=${TempValue:62:2}
        echo $TempValue2
        Regards,
        Alixen
        http://www.alixen.fr/zabbix.html

        Comment

        • HunterSeeker
          Junior Member
          • Aug 2010
          • 10

          #5
          Should the IP be in the script or passed as a parameter? x.x.x.x was supposed to represent my IP. The script outputs the correct value when I run it but Zabbix claims there is no data.
          If it helps here is the item configuration:


          EDIT: The item is set to active, not "not supported."

          EDIT2: Interesting side note, my script does not work when I run it with SH, but it does with BASH.
          Last edited by HunterSeeker; 25-08-2010, 22:26.

          Comment

          • alixen
            Senior Member
            • Apr 2006
            • 474

            #6
            Hi,

            Originally posted by HunterSeeker
            Should the IP be in the script or passed as a parameter?
            It depends.
            No if you use it only for one host.
            Yes you if want to use it one several hosts or in a template.

            Originally posted by HunterSeeker
            EDIT: The item is set to active, not "not supported."
            In your screenshot, your item is "Not supported"
            When Zabbix sets an item as "Not supported", it logs an error message in zabbix-server.log.
            Have you checked it ?
            You can set it to "Active" and check zabbix-server.log.

            Originally posted by HunterSeeker

            EDIT2: Interesting side note, my script does not work when I run it with SH, but it does with BASH.
            Your script uses $(cmd) and ${..} that are pure bash.

            Regards,
            Alixen
            http://www.alixen.fr/zabbix.html

            Comment

            Working...