Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a way to easily define one-time notifications of some events that take place on a Linux box. Events might include things like: file /tmp/my.lock is unlinked or process 666 finished or, maybe, something more complicated, like process '' closed file 'backup.tgz' AND process '' exited with return code 0.

Notifications should be also flexible. Like, notify via org.freedesktop.Notifications.Notify or notify via email.

Actually, it's something like Nagios, but designed for non-repeating events, with minimal, almost zero cost of task creation. Am I a dreamer? Should I write it myself? Or should I simply use shell scripting?

share|improve this question

Nagios can exactly notify the events just one time.
We use it to open tickets.
Just set notification_interval = 0 (for both service and host) and you'll get the email/sms just once.

share|improve this answer
I didn't mean the notification should only be sent once. Rather, the task is used only once, and it's not worth writing yet another check_file_created plugin for Nagios. – minaev Jul 14 '10 at 13:54
But exactly what do you want to monitor? File systems? Logs? Apps? – Pier Jul 14 '10 at 14:08
As a matter of fact, all of them. I did not simply make up the examples, they are taken from real situations. I might be asking too much, I know :) – minaev Jul 14 '10 at 14:15
I don't think there's something that sum all the tools to monitor everything. As far as i rember nagios is the most flexible in this situations. – Pier Jul 14 '10 at 14:48
Yes, but what I'm looking for should relate to Nagios as 'at' relates to 'cron'. – minaev Jul 14 '10 at 17:08

Just to add some more input to the should I write it myself question, you could create either a FIFO or flat file to use as a custom log, and add commands to your custom scripts that write important output to that log file. Or alternatively, you could create a simple script that periodically checks the status of important files and processes, and sends its output to that log.

To create the FIFO on the server:

mkfifo /var/log/mylog

To read the logs from the server:

ssh user@host "tail -f /var/log/mylog"

Source these functions into your custom scripts to easily write to the log:

function warning { echo -e "\e[33;1m :: \e[0m$@" > /var/log/mylog; };
function error { echo -e "\e[31;1m :: \e[0m$@" > /var/log/mylog; };
function information { echo -e "\e[32;1m :: \e[0m$@" > /var/log/mylog; };

And then write entries to the log by issuing these commands:

information "Some text"
warning "Some more text"
error "Some important text"

You can similarly add a shell function that uses sendmail (or similar) to mail you.

share|improve this answer
Aha... That looks like a kind of a self-made dedicated message bus... Might be a good idea, thanks! – minaev Jul 16 '10 at 5:31

I would think a combination of inotifywatch, ps, logger and syslog in some custom scripts might do the trick.

share|improve this answer
Definitely, it would, especially if combined with mail and expect :). Unfortunately, these tools will take considerable efforts to set up one simple alert. More than five minutes, that is, which is close to what I consider a threshold. – minaev Jul 14 '10 at 13:51
@minaev: I was talking about setting up a system to use to create quick, flexible, one-shot alerts. Qualifies under "Should I write it myself?" – Dennis Williamson Jul 15 '10 at 0:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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