Hi,
is it possible to extract a value (number) from a string in a trigger?
I have this item:
This is my status:
if I test my item I receive the string: 0 OK: 2180 BGP prefixes defined
IS it possible (and how can I do it) create a trigger to process this string (0 OK: 2180 BGP prefixes defined) and extract only the value 2180?
is it possible to extract a value (number) from a string in a trigger?
I have this item:
Code:
Name: test_bgp_prefix Type: SNMP agent Key: test_bgp_prefix SNMP OID: NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."bgpprefix" Type of information: Text
Code:
snmpwalk -v 2c -c public 192.168.2.5 . | grep bgp HOST-RESOURCES-MIB::hrSWRunName.596 = STRING: "bgp_collectd" HOST-RESOURCES-MIB::hrSWRunName.21105 = STRING: "bgpd" HOST-RESOURCES-MIB::hrSWRunPath.21105 = STRING: "/usr/lib/quagga/bgpd" HOST-RESOURCES-MIB::hrSWRunParameters.596 = STRING: "/sbin/bgp_collectd" HOST-RESOURCES-MIB::hrSWRunParameters.21115 = STRING: "--daemon zebra bgpd" NET-SNMP-EXTEND-MIB::nsExtendCommand."bgpprefix" = STRING: /bin/check_bgp_prefix NET-SNMP-EXTEND-MIB::nsExtendCommand."bgpstatus" = STRING: /bin/check_bgp NET-SNMP-EXTEND-MIB::nsExtendArgs."bgpprefix" = STRING: NET-SNMP-EXTEND-MIB::nsExtendArgs."bgpstatus" = STRING: NET-SNMP-EXTEND-MIB::nsExtendInput."bgpprefix" = STRING: NET-SNMP-EXTEND-MIB::nsExtendInput."bgpstatus" = STRING: NET-SNMP-EXTEND-MIB::nsExtendCacheTime."bgpprefix" = INTEGER: 5 NET-SNMP-EXTEND-MIB::nsExtendCacheTime."bgpstatus" = INTEGER: 5 NET-SNMP-EXTEND-MIB::nsExtendExecType."bgpprefix" = INTEGER: exec(1) NET-SNMP-EXTEND-MIB::nsExtendExecType."bgpstatus" = INTEGER: exec(1) NET-SNMP-EXTEND-MIB::nsExtendRunType."bgpprefix" = INTEGER: run-on-read(1) NET-SNMP-EXTEND-MIB::nsExtendRunType."bgpstatus" = INTEGER: run-on-read(1) NET-SNMP-EXTEND-MIB::nsExtendStorage."bgpprefix" = INTEGER: permanent(4) NET-SNMP-EXTEND-MIB::nsExtendStorage."bgpstatus" = INTEGER: permanent(4) NET-SNMP-EXTEND-MIB::nsExtendStatus."bgpprefix" = INTEGER: active(1) NET-SNMP-EXTEND-MIB::nsExtendStatus."bgpstatus" = INTEGER: active(1) NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."bgpprefix" = STRING: 0 OK: 2180 BGP prefixes defined NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."bgpstatus" = STRING: 0 OK: BGP Session Established NET-SNMP-EXTEND-MIB::nsExtendOutputFull."bgpprefix" = STRING: 0 OK: 2180 BGP prefixes defined NET-SNMP-EXTEND-MIB::nsExtendOutputFull."bgpstatus" = STRING: 0 OK: BGP Session Established NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."bgpprefix" = INTEGER: 1 NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."bgpstatus" = INTEGER: 1 NET-SNMP-EXTEND-MIB::nsExtendResult."bgpprefix" = INTEGER: 0 NET-SNMP-EXTEND-MIB::nsExtendResult."bgpstatus" = INTEGER: 0 NET-SNMP-EXTEND-MIB::nsExtendOutLine."bgpprefix".1 = STRING: 0 OK: 2180 BGP prefixes defined NET-SNMP-EXTEND-MIB::nsExtendOutLine."bgpstatus".1 = STRING: 0 OK: BGP Session Established
IS it possible (and how can I do it) create a trigger to process this string (0 OK: 2180 BGP prefixes defined) and extract only the value 2180?
Comment