Ok, I've figured out what the problem is.
When you do a VMI query like I do to check if services are running, then this process called
WMIprve.exe lingers around for circa 1 m 40 s or so.
So, if you keep doing queries before this process has quieted then eventually the queries will start to fail.
I made my own VBscript to try do the same thing, monitor service.
But I got the same result. But when I tried running the script manually while the WMIprve.se was
overloaded I figured it out. Got some error msg's about not enough memory. I guess for WMIprve.se because the machine still had load of memory free.
So, I now run the check every 180s, or 3 minutes. Besides some random quick grayness, if the agent data hasn't entered the database after 182s (its very sensitive).
Here's the script I made and how I called it, if anyone is interested.
It's not needed though, because the built in check works just as well.
if WScript.Arguments.Count = 0 then
wscript.quit
end if
Dim objWMIService, strWMIQuery, strComputer, strServiceName
strComputer = "."
strServiceName = WScript.Arguments(0)
strWMIQuery = "Select * from Win32_Service Where Name = '" & strServiceName & "' and state='Running'"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
if objWMIService.ExecQuery(strWMIQuery).Count > 0 then
wscript.echo "1"
else
wscript.echo "0"
end if
I call it like this:
module_begin
module_name uberservice
module_type generic_proc
module_exec cscript servicemon.vbs "uberservice" //Nologo
module_description blablabla
module_end
I guess I should have done what the readme for the agent says :)
This is the time interval in seconds in which the agent will collect data from the host system and send the data packages to the server. The recommended value ranges from 300 (5 minutes) to 600 (10 minutes).
5 minutes feels like an eternity though.