opserver / Opserver

Stack Exchange's Monitoring System
https://opserver.github.io/Opserver/
MIT License
4.51k stars 828 forks source link

No "connection refresh" on server reboot with WMI #325

Closed Sacha-K closed 5 years ago

Sacha-K commented 6 years ago

When a server reboots the WMI connection is somehow lost it seems and there is no Poll now as in SQL to force a re-connection / refresh or anything like that. You need to go restart the application pool and you loose all cached values.

Also you have a weird / false slope in the charts because a zero value for the current time is added.

image

Sacha-K commented 6 years ago

On a Windows 10 Pro with just localhost added to the dashboard I get COMException: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) after restarting the WMI service, as if the service was still down.

But it's actually some authentication issue it seems, with a remote host you get something along "access denied" (didn't write down the exact message).

Sacha-K commented 6 years ago

So adding _scopeCache.Clear(); and _searcherCache.Clear(); in the catch (Exception ex) in WmiQuery.Result makes it able to recover when the WMI service in restarted, but it's not exactly subtle.

I'm testing with localhost here. I need to check what the exact "access denied" error is for a remote server to put a check, and remove just the rebooted server values from the caches.