Kaseya Community

prevent alarm script from running in loop

  • hello everyone,
    i have created an event log policy to monitor if my veeam backup agent could not perform a backup due to a vss error.
    if the error occurs, a powershell script will be executed which restarts the vss services and then restarts the backup. if the error is not fixed by the script, the script runs in loop and always restarts the backup on the affected machine. how do i get it to abort after three attempts and generate an alarm or ticket.

    best regards

  • , no way to do it through Kaseya commands that I can think of, but you should probably just update a registry key, or a text file, each time it starts, and keep incrementing it, and have it dump out once it goes over 3 and create an alarm for you.

    Probably have to figure out how to reset it back to 1 at some point, maybe each day?

  • Chris has the right idea... you need to track the runs in a file or reg entry and check it before running an increment it when you do.  You mention the "if the error is not fixed by the script..."  whatever process this is, should reset the counter when its success.  

    To create a ticket or alarm... you might have your procedure create another Windows EventLog entry that you monitor for separately.  You can do this with the command "createEventLogEntry" command or with executeShellCommand and use the Window's command; "eventcreate  /Id eventid  /D eventDescription /T eventType /L eventLogfileName".

    Remember, you do NOT need to collect event logs in order to monitor for them. 

    Kirk...

  • Hello, everybody,

    that's exactly what my approach was.

    I wanted to write to a txt file.

    But your solutions with a Reg key or the creation of an event entry is even more elegant.

    I check if Veeam has written an error in the event log, which has to do with the vss service. if so, I start my Powershell script which restarts the faulty VSS services. Then the backup will be restarted. if this runs through, everything is fine. if not and it hangs again on the VSS service then the process will be repeated. This is to be tried only maximally three times. So I write the first time a Reg key and the value 1 and after each run of the Powershell script to the VSS service I increase this by 1.

    before every run you should check if the key is already set to 3, if there are no further attempts to repair the VSS service but create an alarm. if successful then set the key value to 0.