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