I am just getting into PERL scripting within Solarwinds and I had a request come in today that I am unsure about. They want to monitor a log file on a server that when the log shows > 1000 ms in a specific line to send an alert. I have gone round and round with them to come up with a different way of monitoring this but I am stumped. Any help would be appreciated as I don't fully understand PERL scripting. I have used the basic log file monitoring for specific lines but I don't know if something with a variable like this is doable.
This is the script I am using for some other items I am currently monitoring. I know it does not do the same thing but I would figure a little tweak to the script would allow me to do what I am looking for. I just do not understand PERL enough (yet!) to make the changes required.
This monitor uses the following arguments:
perl ${SCRIPT} LogFilePath RegularExpression
where
LogFilePath - This is the path of the target log file on the target server. The path can contain spaces.
RegularExpression - This is used for regular expression searches to find a desired string in the log file. Searches are case sensitive and can contain spaces.
Below is an example using the Command Line field:
perl ${SCRIPT} "/etc/inittab" "init"
Example of the line in the log file (they want to be notified when the etime is > than 1000):
[03/Sep/2019:10:36:58 -0500] SEARCH RES conn=596928 op=1 msgID=2 result=0 nentries=0 etime=10138
Thank you for any help!
Charlie