XML TO SNMP

check_xml2snmp.pl

This is a plugin Translate a XML file to snmp request monitored SNMP and return code

Usage:

./check_xml2snmp.pl [-v] -H  -C  [-2] | (-l login -x passwd)  [-P ] -F  -T status|bw|error [-t ] [-V] [-u ] --type-secondary

Options:

Flag Description
-v, --verbose print extra debugging information
-h, --help print this help message
-H, --hostname=HOST name or IP address of host to check
-C, --community=COMMUNITY NAME community name for the host's SNMP agent (implies v 1 protocol)
-2, --v2c use SNMP v2 (instead of SNMP v1)
-P, --port=PORT SNMPd port (Default 161)
-t, --timeout=INTEGER timeout for SNMP in seconds (Default: 5)
-V, --version prints version number
-F, --file XML data
-T, --type=status|bw|error This allows to use pre-defined system type Currently support systems types are:
status return the state off each interface can be use for select name
bw return the pourcent bandwith with speed interface referer off each interface can be use with value-secondary
error return errors from each interface can be use with value-secondary
--value-secondary --value-secondary give select interface and bandwith off interface variable :
if name off interface in the describ OID
maxbw value [XX]Mb
separator off each variable (:) separator off each group variable (,)
####Example for TYPE bw With different bandwith of default
--value-secondary if="FastEthernet0/1":maxbw=4Mb,if="FastEthernet0/5":maxbw=2Mb
For TYPE error
--value-secondary if="FastEthernet0/1",if="FastEthernet0/5"
  ####Do show interfaces
check_xml2snmp.pl -F interface-2.xml -H xx.xx.xx.xx -C *********** --show

 ---------Describ Interface : Index Interface---------

 : FastEthernet0/0 : index : 1

 : FastEthernet0/1 : index : 2

 : Null0 : index : 3

 : Tunnel0 : index : 4

 : Tunnel1 : index : 5

 : Tunnel2 : index : 6

 : NVI0 : index : 7

 : Tunnel3 : index : 8

 : Tunnel4 : index : 9

 : Tunnel5 : index : 10

 : Tunnel6 : index : 11

 : Tunnel7 : index : 12

 : Loopback0 : index : 13

 : Tunnel8 : index : 14

 : Tunnel9 : index : 15

 : Loopback1 : index : 16

 : Tunnel10 : index : 17

 : FastEthernet0/0/0 : index : 20

 : FastEthernet0/0/1 : index : 21

 : FastEthernet0/0/2 : index : 22

 : FastEthernet0/0/3 : index : 23

 : Vlan1 : index : 24

 : Vlan90 : index : 25

 : Vlan81 : index : 26

 : Tunnel11 : index : 27

 : Tunnel12 : index : 29
####Examples
check_xml2snmp.pl -F interface-2.xml -H **.**.**.** -C *********** -T status --value-secondary if=FastEthernet0/1

OK OK ifOperStatus FastEthernet0/0  - ifOperStatus FastEthernet0/0  = 1 up,  |ifOperStatus(FastEthernet0/0)=1
 
check_xml2snmp.pl -F equallogic.xml -2 -H **.**.**.** -C ************ -T power --value-secondary idlike=1.1215703825
 

 OK OK PowerSupplyCurrentState Power Cooling Module 0  - PowerSupplyCurrentState Power Cooling Module 0  = 1 normal,  OK PowerSupplyCurrentState Power Cooling Module 1  - PowerSupplyCurrentState Power Cooling Module 1  = 1 normal,  |PowerSupplyCurrentState(Power Cooling Module 0)=1 PowerSupplyCurrentState(Power Cooling Module 1)=1
####Changelog: **1.4.3 Oct 07 2013**         accept in --value-secondary **idlike** part oid index filter        ex --value-secondary idlike=1.1922986878       in XML definition  : section seuil\_oid can use warning\_oid and critical\_oid **1.4.2 Aug 05 2013**         More perform Function Show        issue a disfonction with --value-secondary **1.4.1 Apr 3 2013**            add function show for interpret array show in xml file **1.4.0 mar 26 2013 can use multiple filter with condition (and) in --value-secondary**           ex --value-secondary dev1=0x6cf37fc42818:condition=and:dev2=MY\_ESSID           add sub analyze\_array\_to\_secondary can determine in array describ the good oid index           manage in analyze\_array\_to\_secondary sub a conditional with multiple enter           condition is aruba-ap mac address and name ESSID  give the index oid **1.3.1 mar 08 2013 with all type can use --value-secondary**                optimization request snmp with filter --value-secondary               can use option id=index oid with --value-secondary