We have just started using Ninite Pro, specifically to update programs on servers. I have created an agent procedure to download and run the Ninite.exe and create a text file with the results. I have also added into the procedure the writeProcedureLogEntry line in order to have a history of the results in the text file. My question is: How do I send an email if either the text file or procedure log have the word "Fail" in them? I know I will get an alert if the entire script fails but I'm more concerned with the script running successfully and Ninite failing to update Java(for example) until a client calls complaining about it. Since it is writing to the Procedure Log we will be able to see when it stopped but currently will not be alerted at the time of failure.
Instead of just logging to the procedure log, why not send an email to create a ticket to whatever ticketing system you are using?
Or if you'd rather have *just* the alert, use the Procedure step createEventLogEntry() to create an event log entry on the system, and setup an eventlog alert specifically looking for your unique eventlog.
The problem with both solutions is that I don't want to receive a new ticket every time Ninite runs, only when the text file that is generated has the word "Fail" in it. We will be running this script every day on about 100 machines. The only time I want to know about it is if the script is successful but the text file has a key word. What I am unsure of is how to parse the file for the word "Fail" and, if found, send an email to the ticketing system.
AH I see where you were going with that now... That part's simple... Where are you getting the text to write to the Procedure log... I'm assuming you have a
Statement in there pulling the text file log from the Ninite results, and then a
Statement writing the log entry to the procedure log. Just take that a step further and run that same variable through an If statement..
If checkVar("#YourVarNameHere#") Contains "Fail"
If you really want to get creative you could even search the var for "Locked" which is the usual cause of the failure, and use that to "self correct" by poping up a box asking the user to close out of Internet Explorer, or whatever the locked program is to get on with things :)
Thank you Jonathan! I have yet to test it but this sounds exactly like what I was looking for.
You can also send a daily or weekly report based on the procedure log and filtering on what you need (eg : *fail*). This way you won't have dozens of emails.
Rule of Thumb : don't generate alerts or tickets if you don't need to act on it immediately.