|
From: | Bryan Harris |
Subject: | Re: Help with different kind of check |
Date: | Mon, 15 May 2017 13:48:09 -0400 |
Hello, all.
I’m trying to have Monit restart a service based on a keyword in a particular file. That file changes name by appending today’s date at the end, as in “myprogram-server.log.
processed-2017-05-13”. So, I have to craft a check that takes the changing date into account. Here’s what I’ve created:
check file messages with path /data1/myprogram/log/
myprogram-server.log. processed-($date +"%Y-%m-%d") if match "FATAL" then exec "/data1/myprogram/myprogram-
mta/sm-server server restart"
The problem is in how to do the date part. I’ve tried every combination of parens, quotes, back ticks, etc., but Monit won’t start because it doesn’t like the date part. Can anyone help with this?
Also, I’d like an email alert to say that the that the service has been restarted. As the check is presently written, it sends an email with e.g. “May 15 13:36:30 satest03 systemd: Stopped The Apache HTTP Server.” Here’s that check (and it’s only a test):
check file messages with path /var/log/messages
if match "Stopped The Apache HTTP Server" then exec "/bin/systemctl restart httpd" <- note that the match is what appears in the email message. Can you help with this, too.
Many thanks.
Diggy
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
[Prev in Thread] | Current Thread | [Next in Thread] |