hello All:
We are facing regular issues in our remote location servers, after a power outage servers ramdonly start in "Safe Mode", and we do not know until we manually log in on them.
I'm wondering if there's a way to monitor if a server is in normal or safe mode and send the alert accordingly.
thanks in advance.
Check Windows Safe Mode
Re: Check Windows Safe Mode
You can do this via WMI assuming you have networking on the machine:
https://docs.microsoft.com/en-us/window ... utersystem
https://serverfault.com/questions/43376 ... -safe-mode
The check_wmi_plus plugin that ships with Nagios XI allows you to write custom WMI queries and load them as "plugins" under check_wmi_plus. It's a bit complicated though.
Or you could wrap the above execution in some Powershell and parse the BootupState property translating it to an appropriate status code for Nagios.
https://docs.microsoft.com/en-us/window ... utersystem
https://serverfault.com/questions/43376 ... -safe-mode
Code: Select all
PS H:\> gwmi -Query "SELECT BootupState FROM Win32_ComputerSystem"
__GENUS : 2
__CLASS : Win32_ComputerSystem
__SUPERCLASS :
__DYNASTY :
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
BootupState : Normal boot
Or you could wrap the above execution in some Powershell and parse the BootupState property translating it to an appropriate status code for Nagios.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check Windows Safe Mode
Thanks @mcapra This is even new one on me..
I wasn't sure that you could call WMI if server is in safe mode, usually machine has limited services operating.
I wasn't sure that you could call WMI if server is in safe mode, usually machine has limited services operating.
Re: Check Windows Safe Mode
Yeah, regarding remote WMI requests I think it would depend on what "flavor" of safe mode you're running in. If the request failed, at least you'd have that.
Locally executed Powershell should work regardless I would think? Never tried it myself.
Locally executed Powershell should work regardless I would think? Never tried it myself.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check Windows Safe Mode
Correct, for sure nothing would work if it was a "Network down" safe modemcapra wrote:Yeah, regarding remote WMI requests I think it would depend on what "flavor" of safe mode you're running in. If the request failed, at least you'd have that.
Locally executed Powershell should work regardless I would think? Never tried it myself.
Re: Check Windows Safe Mode
Thanks Everyone for the responses.
I think the fastest and "easiest" way is to create a custom Powershell script, as mcapra suggested.
Once i have it created and tested will update the results.
I think the fastest and "easiest" way is to create a custom Powershell script, as mcapra suggested.
Once i have it created and tested will update the results.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check Windows Safe Mode
Thanks, let us know how it comes out!lpereira wrote:Thanks Everyone for the responses.
I think the fastest and "easiest" way is to create a custom Powershell script, as mcapra suggested.
Once i have it created and tested will update the results.