Kaseya Community

Looking for a script to start a Process upon failure, email/ticket if not successful.

  • Looks like Kaseya has no "sleep" feature when it comes to monitoring Processes. It will only fire an alarm/ticket/procedure immediately if a Process fails. There's no option to wait 5 minutes, for example, if a process stops, then do something. We have a customer that wants us to monitor a Process that by design shuts itself down every 30 mins, runs some backend magic on their server, then restarts usually within 2 or 3 minutes. This is a function of an application they are running. So the only way we can monitor this 24x7 is to suffer through a ton of noise as you can image. What we do is fire a ticket and send an email, then usually within 3 minutes we get another email and the ticket closes as the condition has cleared since the Process has started up again as expected. There's oly been one time where it hasn't restarted, so we had to do so manually. That's a lot of noise to suffer through only to have a real issue very rarely. 

    So what we're looking for is a script to do this below. FYI, i'm NOT a programmer, but i get the logic and can figure things out and pretty decent with Kaseya's procedure editor, so be gentle and add some detailed code if you can. Here's the general idea of what we need:  

    -If a process stops, then trigger an Agent Procedure/script.
    -This Procedure/script would pause for 5 minutes, check again to see if the process is running.
    -If the process is running, then close as a non-issue.
    -If process is not running, then start it, then pause for another 60 seconds.
    -Check again if the process is still running. If it is, then close as resolved.
    -If it’s not, then create a ticket and send an email.

    Thanks in advance! Surely this is not hard for someone that codes? 

  • run the monitor and have it kick off a script ... the script runs a pause for 5 minutes (or kicks off a second script in 5 minutes) and then checks to see if the process is running ... if the process isn't running, then start it, otherwise log that the process is running ...

  • Check process
    If running exit
    Else
    Pause 5
    Check process
    If not running
    Start process
    Pause 5
    Check process
    Not running - alarm:email, etc

    Remember the process monitor only alarms on transition. I suspect you are monitoring a service not a process.

    If you need help, just reach out. chris@virtualadministrator.com
  • What Chris put there would be the script to run if the service alarms ... But you can check and re-start the service as easily within the script using the same logic Chris put ...

  • "Process" or "Service"  ... there is a difference in both how they are monitored and how you would deal with one not running