Ad Widget

Collapse

A complete Noobs Guide to Monitor an XMl File with Zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Saftnase
    Member
    • Jul 2006
    • 30

    #1

    A complete Noobs Guide to Monitor an XMl File with Zabbix

    Here we go. :-)

    Monitoring a System with SNMP is nice, easy and common.
    But when it comes to HP Bladecenter C7000s Onboard Administrator, things can get nasty.
    You ask why ? Because HPE in its infinite wisdom has choosen to provide us some valuable values, but not all.
    And espacially not the ones i want.
    I.E. try to get the RPM of the 8 Fans. You cant. There is no SNMP OID for this, only the Status can be seen with SNMP.
    But there is an XML Output where all the good Stuff is in.
    https://{IP-Adress of Onboard Administrator}/xmldata?item=all

    So first thing we have to get this file to analyse it later. (If you want to query multiple values its better to save it on Disk than calling the Page many times)

    curl -k -s -o data.xml https://{IP-Adress of Onboard Administrator}/xmldata?item=all

    Now we have a big XML File with all the current Systemvalues. But how do we get to the RPMs of all those Fans ?
    This is where xmlstarlet kicks in.

    xmlstarlet sel -t -m '//FAN[1]/RPM_CUR' -v . -n <data.xml
    will give us the RPM of the first Fan. Now you can give it to Zabbix Sender and off we go.

    To make things a little bit easier i wrote this little script to get all the values and send it over to Zabbix at once.

    <------- Start of Script
    #!/bin/bash



    #Get alle the Fans and write to Zabbix Sender Input File
    function write_zabbix_file
    {


    cat <<- _EOF_

    {Insert your HP OA Hostname here} rpm_fan1 $(xmlstarlet sel -t -m '//FAN[1]/RPM_CUR' -v . -n <data.xml)

    {Insert your HP OA Hostname here} rpm_fan2 $(xmlstarlet sel -t -m '//FAN[2]/RPM_CUR' -v . -n <data.xml)

    {Insert your HP OA Hostname here} rpm_fan3 $(xmlstarlet sel -t -m '//FAN[3]/RPM_CUR' -v . -n <data.xml)

    {Insert your HP OA Hostname here} rpm_fan4 $(xmlstarlet sel -t -m '//FAN[4]/RPM_CUR' -v . -n <data.xml)

    {Insert your HP OA Hostname here} rpm_fan5 $(xmlstarlet sel -t -m '//FAN[5]/RPM_CUR' -v . -n <data.xml)

    {Insert your HP OA Hostname here} rpm_fan6 $(xmlstarlet sel -t -m '//FAN[6]/RPM_CUR' -v . -n <data.xml)

    {Insert your HP OA Hostname here} rpm_fan7 $(xmlstarlet sel -t -m '//FAN[7]/RPM_CUR' -v . -n <data.xml)

    {Insert your HP OA Hostname here} rpm_fan8 $(xmlstarlet sel -t -m '//FAN[8]/RPM_CUR' -v . -n <data.xml)

    _EOF_

    }



    # Get the XML File from OA

    curl -k -s -o data.xml https://{IP-Adress of Onboard Administrator}/xmldata?item=all

    # Call the function to make an Input File for Zabbix Sender
    write_zabbix_file >sender.txt



    # Send all the Stuff to Zabbix
    zabbix_sender -i sender.txt -z {Insert your Zabbix Server IP here}

    <------- End of Script

    I hope this could be of some use for you.

    To adapt this example for your custom XML needs, you can visit the xmlstarlet Page on Sourceforge


    Greetings from the cold and frosty Germany
    Last edited by Saftnase; 05-12-2016, 18:11. Reason: Wrong spelling in Title
  • hpeti2
    Junior Member
    • Jul 2015
    • 29

    #2
    Did you see this?

    The Zabbix Team has collected all official Zabbix monitoring templates and integrations.

    Comment

    • Saftnase
      Member
      • Jul 2006
      • 30

      #3
      Yes, but i choose the C7000 only to demonstrate how to get values from an xml source.
      It is a nice Template, but it covers only the values availiable via snmp, and the RPM values of the Systemfans have no SNMP OID.

      Comment

      Working...