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
312 stars 274 forks source link

Windows Server Pending Reboot #3698

Closed LaurentV9 closed 2 years ago

LaurentV9 commented 2 years ago

Hello Guys,

I have a little issue with a filter on a warning and I look for a solution. Maybe can you help me.

In Windows server template, we have a "Pending-Reboot" service. Basically, the warning-status of this service is --warning-status="%{RebootPending} =~ /true/i"

And the response can be WARNING: 'Microsoft Windows Server 2016 Standard': reboot pending is true [Windows Update: false][Component Based Servicing: false][SCCM Client: false][File Rename Operations: true][Computer Name Change: false]

So in this case, the warning is reported.

But for us, we need to bypass the fact that "File Rename Operations" is true. so we want the warning is reported EXCEPT in the case of File Rename Operations is true.

How could I build this filter?

Regards,

Laurent

garnier-quentin commented 2 years ago

I think it should be: %{RebootPending} =~ /true/i and not (%{WindowsUpdate} =~ /false/i && %{CBServicing} =~ /false/i && %{CCMClientSDK} =~ /false/i && %{PendComputerRename} =~ /false/i && %{PendFileRename} =~ /true/i)

LaurentV9 commented 2 years ago

Waouw, wonderful...

But where can I find this documentation? each character chain has a field name?

Sorry, I discover it :-D

Laurent

garnier-quentin commented 2 years ago

You can find it in the help of the mode.

LaurentV9 commented 2 years ago

sorry again but what's the command to find the help of the mode ? :-/

Gregesp commented 2 years ago

Hello,

I try this syntax %{RebootPending} =~ /true/i and not (%{WindowsUpdate} =~ /false/i && %{CBServicing} =~ /false/i && %{CCMClientSDK} =~ /false/i && %{PendComputerRename} =~ /false/i && %{PendFileRename} =~ /true/i) at the level of the macro WARNINGSTATUS in replacement of the standard value %{RebootPending} =~ /true/i and it doesn't work for me.

/usr/lib64/nagios/plugins/check_centreon_nrpe3 -H **Host Address IP** -p **NRPE PORT** -t 30 -u -2 -P 8192 -c check_centreon_plugins -a 'os::windows::local::plugin' 'pending-reboot' ' --warning-status="%{RebootPending} =~ /true/i and not (%{WindowsUpdate} =~ /false/i && %{CBServicing} =~ /false/i && %{CCMClientSDK} =~ /false/i && %{PendComputerRename} =~ /false/i && %{PendFileRename} =~ /true/i)" --critical-status="" ' WARNING: 'Microsoft Windows Server 2016 Standard': reboot pending is true [Windows Update: false][Component Based Servicing: false][SCCM Client: -][File Rename Operations: true][Computer Name Change: false]

It work when you apply the - for SCCM Client, so %{RebootPending} =~ /true/i and not (%{WindowsUpdate} =~ /false/i && %{CBServicing} =~ /false/i && %{CCMClientSDK} =~ /-/i && %{PendComputerRename} =~ /false/i && %{PendFileRename} =~ /true/i)

/usr/lib64/nagios/plugins/check_centreon_nrpe3 -H **Host Address IP** -p **NRPE PORT** -t 30 -u -2 -P 8192 -c check_centreon_plugins -a 'os::windows::local::plugin' 'pending-reboot' ' --warning-status="%{RebootPending} =~ /true/i and not (%{WindowsUpdate} =~ /false/i && %{CBServicing} =~ /false/i && %{CCMClientSDK} =~ /-/i && %{PendComputerRename} =~ /false/i && %{PendFileRename} =~ /true/i)" --critical-status="" ' OK: 'Microsoft Windows Server 2016 Standard': reboot pending is true [Windows Update: false][Component Based Servicing: false][SCCM Client: -][File Rename Operations: true][Computer Name Change: false]

It indicated the File Rename Operations: flag is not reset anytime after a reboot

@LaurentV9 : You do execute the command line on your poller with the centreon-engine account like that :

/usr/lib64/nagios/plugins/check_centreon_nrpe3 -H **Host @IP** -p **NRPE PORT** -t 30 -u -2 -P 8192 -c check_centreon_plugins -a 'os::windows::local::plugin' 'pending-reboot' ' --help '

And yes documentation doesn't have a FAQ section, to understand the -help options

Regards,