1

I would like to set up some monitoring for a custom application. I want to be able to monitor when a service goes down or stops working and if this happens, find a way to receive these alerts via email. I have been researching and it looks like I can do the first part of this task using rsyslog. I wanted to confirm that this is possible.

So my question is, can you set up monitoring for an application using rsyslog? Say for instance using one of the local accounts local2?

If so, how does it determine the severity level of the logs from that application? i.e what constitutes a crit, alert or emerg? These all seem like the same severity to me.

Apologies if some of the terminology is off, I'm fairly new to Linux but any guidance would be appreciated.

Thanks

1

The "or stops working" part is not part of rsyslog's description, and because it's so abstract most monitoring software lets you run a script to evaluate if the service has stopped working so you might as well just make your own service or crontab script, the core of which might look like this;

curl -s -m 5 "$URL" >/dev/null
if [ "$?" != "0" ] ; then
    echo -e "Subject:Panic\n\nPanic" | sendmail -r me@domain you@domain 
fi
| improve this answer | |
  • Ahh I see, thank you. So looks like I'll have to scrap the rsyslog idea then. Is there any way in which you could set up a file that is "touched" (so to speak) on a regular basis by applications, and if not touched then an error will be flagged and the panic email would send? I noticed someone mentioned nagios which I will look into but just wondered if there was any native way of doing this. – MrBburn Nov 29 '16 at 19:16
  • @DanBlackburn yes, but again that is app specific, most applications have many failure modes so it's best to have a few tests in a script, testing the last update time of a file could be one of those checks. – user1133275 Nov 30 '16 at 17:16
1

An other approach, if your application logs in its own file with rsyslog, you can use incron. incron allow you to execute some commands on specifics filesystem events : when the log file is updated.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.