Question

filter out results from snmp

  • 19 October 2022
  • 2 replies
  • 200 views

Badge +2

How do i filter out results retuned by the Watchguard plugin mode hardware to only show interface eth0 and eth1 and not eth2, eth3 or eth4 which are unplugged.

command:

/usr/lib/centreon/plugins//centreon_watchguard_snmp.pl --plugin=network::watchguard::snmp::plugin --mode=hardware --hostname=x.x.x.x --snmp-version='2c' --snmp-community='XXXX' --component='.*' --verbose

returns:

CRITICAL: Device 'network interface eth2' status is 'down' - Device 'network interface eth3' status is 'down' - Device 'network interface eth4' status is 'down' | 'count_device'=10;;;;
Checking devices
device '' status is 'running' [instance = processor.196608]
device '' status is 'running' [instance = processor.196609]
device '' status is 'running' [instance = processor.196610]
device '' status is 'running' [instance = processor.196611]
device 'network interface eth0' status is 'running' [instance = network.266240]
device 'network interface eth1' status is 'running' [instance = network.266241]
device 'network interface eth2' status is 'down' [instance = network.266242]
device 'network interface eth3' status is 'down' [instance = network.266243]
device 'network interface eth4' status is 'down' [instance = network.266244]
device 'network interface modem0' status is 'running' [instance = network.294912]

thanks.

 

 

 

 


2 replies

Badge +2

is there a way to apply a regex ?   e.g. '(eth|modem)(?!(2|3|4))'

Badge +2

I have discovered this worked:

/usr/lib/centreon/plugins//centreon_watchguard_snmp.pl --plugin=network::watchguard::snmp::plugin --mode=hardware --hostname=x.x.x.x --snmp-version='2c' --snmp-community='XXXX' --filter='device,network.2662(42|43|44)' --verbose
 

 

Reply