I'm using the Agent Status, "Agent has not checked in for xx minutes and Rearm alert after 5 min" to run a procedure on a laptop. This procedure runs an MP3 file that basically alerts that an agent has not checked in and turns on a flashing light controlled through a USB port.
Now, on the same screen that you set the above is a check box that "Alert when agent goes online". The agent online alert only occurs if an agent offline alert has also been set but because of where this is, you can't set it to trigger another procedure.
What I need to be able to do is based on the agent going off and then back on again, I need to be able to run another procedure as this sends a different command to the USB port to turn off the flashing light.
If anyone has any thoughts or knows how I could do this I would very much like to know.
You can't have seperate procedures , but you can have a single procedure that has an if / then step that works out if the agent was going on or off.
The trick is in using the 2 time variables the agent offline alarm uses
The variables are #at# and #qt#
So essentially if #at# = #qt# the alarm is an online
If #at# > #qt# then it is an offline
I just pass them to some VB , work out if it is Off or On , write the reult to a text file with either the word Offline or Online in it then read back to textfile content into a procedure variable that I then test with my If/Then steps
I've actually allowed a small window of time between #at# and #qt#
Heres the vbs.
dim objFSO, objFile
dim Alarmtime, Interval, LastCheck ,status ,machname
Set ArgObj = Wscript.Arguments
AgentDir = ArgObj(0)
Alarmtime = ArgObj(1)
Lastcheck = ArgObj(2)
Machname = ArgObj(3)
Calarmtime = cdate(alarmtime)
Clastcheck = cdate(lastcheck)
Interval = datediff("s",Clastcheck,CAlarmtime)
if Interval < 30 then
status = "Online"
if Interval >=30 then
status = "Offline"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objfile = objFSO.createTextFile(AgentDir + "\" + machname + "_Offline.txt")
You could work with this help.kaseya.com/.../index.asp
PS .. you could run this as Csript with the //NoLog option and execute it as a "Executecommand to Variable" step directly rather than creating and reading the file content
Would you mind sharing the scripts concerning the usb monitoring flash ?
Great, brilliant even! Thanks for sharing. I'll have a go at implementing this...
unfortunately I'm not monitoring any USB stuff but just using the USB port as a means to turn a light on (and now hopefully off).
Next step is to make a cup of coffee every time a server goes down :)
That's should be the next challenge .. get Kaseya to make Coffee
I've wanted to do this in a CLient demo for ages .. so I might just go and buy one of these IP Power Strips www.amazon.com/.../B0039OZKPE
Then get a Kaseya script to turn the Coffee Perf on/off during the Demo's.
...I use an Arduino and Raspberry Pi, both with 433mhz transmitters with these... www.jaycar.co.nz/productView.asp
for other things. But here at work I'm using the Arduino (connected via USB port) with VB.NET to flash the light.
R U Auckland, Wellington or down south?
I'm not having any luck with running the script from the agent procedure......
executeVBScript("c:\agent.vbs", "c:\kworking #at# #qt# #id#, false, "All Operating Systems", "Continue on Fail")
If I run the VB script from command prompt with the following line for example then the text file is created....
c:\agent.vbs c:\kworking 9:11 8:12 ssbazza
All other lines in the procedure work so I'm not doing something right.... Any ideas?
make sure the vb script is run using wscript not cscript.
Also running a script on a machine that is offline will never work.
I always set the offline alarms to run the script on another machine , typically I run it on server in the office that we know is always on and have it play an audible sound.
I dig out another variation on this one as well , where I would check to see if more than one machine in the same group had gone offline and only sound the audible alarm for the first machine