centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
310 stars 273 forks source link

Fortigate plugin require filters #1586

Closed BlackstormFirst closed 5 years ago

BlackstormFirst commented 5 years ago

centreon-plugins/centreon/common/fortinet/fortigate/mode/hardware.pm

--mode = hardware

Hello, it's not really a bug, but currently this part of the plugin is useless because we have a Fortigate with a "RPS 12V" port not used and the plugin stay in critical state.

I would like to filter this content to ignore the "RPS 12V" status and value.

Can you add a regex based on your current "%s" variable please?

Thanks ^^ Best Regards,

verbose:

centreon-engine@twcprdsup01:~$ /usr/lib/centreon/plugins/centreon_fortinet_fortigate.pl --plugin network::fortinet::fortigate::plugin --hostname xxx.xxx.xxx.xxx --snmp-community XXX_RO --snmp-version 2c --mode hardware --verbose CRITICAL: Sensor RPS 12V alarm status is on [value: 0] | [System: FW Fortigate xxx D] [Firmware: vx.x.x,buildxxxx,xxxxxx (GA)] Sensor +3.3V alarm status is off [value: 3.3018] Sensor +5V alarm status is off [value: 5.0725] Sensor +12V alarm status is off [value: 12.077] Sensor CPU VCCP alarm status is off [value: 0.9707] Sensor CPU VTT alarm status is off [value: 1.0491] Sensor CPU PVSA alarm status is off [value: 0.9315] Sensor P1V8 alarm status is off [value: 1.7743] Sensor P1V5 alarm status is off [value: 1.4901] Sensor PCH +1.05V alarm status is off [value: 1.04] Sensor VCC 2V5 alarm status is off [value: 2.464] Sensor MAIN 12V alarm status is off [value: 12.096] Sensor VCC 1V15 alarm status is off [value: 1.152] Sensor DDR3 VTT alarm status is off [value: 0.736] Sensor RPS 12V alarm status is on [value: 0] Sensor NCT +3.3V alarm status is off [value: 3.264] Sensor NCT VBAT alarm status is off [value: 3.312] Sensor NCT +3.3VSB alarm status is off [value: 3.264] Sensor NCT VTT alarm status is off [value: 1.04] Sensor DTS CPU alarm status is off [value: 61] Sensor CPU Core 0 alarm status is off [value: 56] Sensor CPU Core 1 alarm status is off [value: 58] Sensor TD1 alarm status is off [value: 47] Sensor TD2 alarm status is off [value: 34] Sensor FAN_TMP_3 alarm status is off [value: 42] Sensor LM75 U72 alarm status is off [value: 37] Sensor LM75 U65 alarm status is off [value: 39] Sensor LM75 U62 alarm status is off [value: 41] Sensor FAN1 alarm status is off [value: 4600] Sensor FAN2 alarm status is off [value: 4800] Sensor FAN3 alarm status is off [value: 4800]

garnier-quentin commented 5 years ago

I need to refactor the check.

garnier-quentin commented 5 years ago

I have done patch. Could you test the last version and add following options ?

--add-name-instance --filter='sensors,RPS 12V'
BlackstormFirst commented 5 years ago

Hi, Thanks for the quick update. I will try to test that into my current config, except i'm using the rpm release from the centOS CES which merge the content into a single file.

If i can merge it without problem i will make a feedback next week. Otherwise, i will wait for the official push ^^

Again, thanks a lot ^^ Best Regards,

theF1a5h commented 1 year ago

I am having a very similar issue. The fortigate has 2 power supplies, only one of them is being used. It reports a critical.

I adapted the code above for my instance: --add-name-instance --filter='sensors,PSU \[1\]' *PSU [1] is the name of the sensor.

This works on command line on the central Centreon node, but it does not work on the web interface. CLI:

OK: All 5 components are ok [5/5 sensors]. | 'TMP 1  External Temperature#hardware.sensors.measure'=0;;;; 'TMP 4  Temperature#hardware.sensors.measure'=0;;;; 'CPU ON-DIE Temperature#hardware.sensors.measure'=68.996002;;;; 'MV1680 Temperature#hardware.sensors.measure'=68;;;; 'hardware.sensors.count'=5;;;;
[System: BankofBurl FGT80F HA Pair] [Firmware: v7.0.9,build0444,221121 (GA.M)]
Checking sensors
skipping sensors section 1#PSU [1] instance.
sensor 'PSU [2]' alarm status is 'off' [instance = 2] [value = ON]
sensor 'TMP 1  External Temperature' alarm status is 'off' [instance = 3] [value = 0]
sensor 'TMP 4  Temperature' alarm status is 'off' [instance = 4] [value = 0]
sensor 'CPU ON-DIE Temperature' alarm status is 'off' [instance = 5] [value = 68.996002]
sensor 'MV1680 Temperature' alarm status is 'off' [instance = 6] [value = 68]
Web Interface: Service Status CRITICAL  (ACKNOWLEDGED)
Status information CRITICAL: Sensor 'PSU [1]' alarm status is 'on'
Extended status information  
Performance Data 'TMP 1 External Temperature#hardware.sensors.measure'=0;;;; 'TMP 4 Temperature#hardware.sensors.measure'=0;;;; 'CPU ON-DIE Temperature#hardware.sensors.measure'=69.120003;;;; 'MV1680 Temperature#hardware.sensors.measure'=68;;;; 'hardware.sensors.count'=6;;;;

Check Code used for Both:

/usr/lib/centreon/plugins/centreon_fortinet_fortigate.pl
    --plugin=network::fortinet::fortigate::snmp::plugin
    --mode=hardware
    --hostname=xx.xxx.xx.xxx
    --snmp-version='3'
    --snmp-community='********'
    --authprotocol=SHA
    --authpassphrase=*********************
    --snmp-username=********
    --privprotocol=AES
    --privpassphrase=*********************
    --add-name-instance
    --filter='sensors,PSU \[1\]'

is there a specific command for status? any ideas?

PapaOurs42 commented 1 year ago

I am having a very similar issue. The fortigate has 2 power supplies, only one of them is being used. It reports a critical.

I adapted the code above for my instance: --add-name-instance --filter='sensors,PSU \[1\]' *PSU [1] is the name of the sensor.

This works on command line on the central Centreon node, but it does not work on the web interface. CLI:

OK: All 5 components are ok [5/5 sensors]. | 'TMP 1  External Temperature#hardware.sensors.measure'=0;;;; 'TMP 4  Temperature#hardware.sensors.measure'=0;;;; 'CPU ON-DIE Temperature#hardware.sensors.measure'=68.996002;;;; 'MV1680 Temperature#hardware.sensors.measure'=68;;;; 'hardware.sensors.count'=5;;;;
[System: BankofBurl FGT80F HA Pair] [Firmware: v7.0.9,build0444,221121 (GA.M)]
Checking sensors
skipping sensors section 1#PSU [1] instance.
sensor 'PSU [2]' alarm status is 'off' [instance = 2] [value = ON]
sensor 'TMP 1  External Temperature' alarm status is 'off' [instance = 3] [value = 0]
sensor 'TMP 4  Temperature' alarm status is 'off' [instance = 4] [value = 0]
sensor 'CPU ON-DIE Temperature' alarm status is 'off' [instance = 5] [value = 68.996002]
sensor 'MV1680 Temperature' alarm status is 'off' [instance = 6] [value = 68]

Web Interface:

Service Status CRITICAL  (ACKNOWLEDGED) Status information CRITICAL: Sensor 'PSU [1]' alarm status is 'on' Extended status information   Performance Data 'TMP 1 External Temperature#hardware.sensors.measure'=0;;;; 'TMP 4 Temperature#hardware.sensors.measure'=0;;;; 'CPU ON-DIE Temperature#hardware.sensors.measure'=69.120003;;;; 'MV1680 Temperature#hardware.sensors.measure'=68;;;; 'hardware.sensors.count'=6;;;; Check Code used for Both:

/usr/lib/centreon/plugins/centreon_fortinet_fortigate.pl
  --plugin=network::fortinet::fortigate::snmp::plugin
  --mode=hardware
  --hostname=xx.xxx.xx.xxx
  --snmp-version='3'
  --snmp-community='********'
  --authprotocol=SHA
  --authpassphrase=*********************
  --snmp-username=********
  --privprotocol=AES
  --privpassphrase=*********************
  --add-name-instance
  --filter='sensors,PSU \[1\]'

is there a specific command for status? any ideas?

Hi,

In my opinion, it is the combination of the escape characters '\' and '[' or ']' which are the cause of this malfunction on the Web console.

Try using the following settings instead: --add-name-instance --filter='sensors,PSU .1.'

The output of the command should be better interpreted on your web interface. Best regards,