"IF" Scripts

What's the best way to run "IF" scripts e.g a process that runs in the background scheduled every 30 minutes\1hour that checks various processes are running and if they're not, restarts them?

Does anyone have a template of such a script?

When this runs I need it to not effect the load on the server, 'cos in peak times our sys admins panic too much as it is!

Cheers
Jamie

What type of processes and what is the intended schedule of checks.
I'm assuming that you are wishing this check script to run from crontab ?

What have you created so far in your efforts ?

Sorry I should have been more specific. The scripts that need to be, for better words "monitored" are perl scripts, run as;

perl script1.pl &

etc.

This scripts are required to be running 24/7 as they generate data as and when needed. At the moment if one dies, netsaint aka Nagios mails out and we have to manually restart them

Cheers
Jamie

maybe you want to write a new netsaint plugin script as per your requirement? Or maybe invoke this new script whenever your existing monitoring check throws an alert?

A plug-in to nagios would indeed be an option however I have not had much exposure to this system,the closest I have come is adding new processes into the config for monitoring. I have not actually set it up.

As far as I am aware there is a config within Nagios for each server, so the plug-in would require to be added to the relevant servers config? Is there any nagios\netsaint guys in here that could advise?

Cheers
Jamie

Nagios is pretty cool. Its even cooler with Fruity. I am currently removing Nagios and replacing it with OpenView. :frowning:

Since Nagios is Open Source you can find lots of books and documentation. I would find a monitoring config that does something like what you need and modify it. That would be the easiest way for you to make your own pluggin.

Thanks for the help Tomas, is there any particular site you can recommend for Nagios plugins?

Cheers
Jamie

Sites:
Nagios Community Wiki
Official Documentation

Books:
Building a Monitoring Infrastructure with Nagios
Pro Nagios 2.0

Thanks Tomas, I have had a quick look round the Nagios site.

I will look more into this tomorrow when I get chance to have a play with the server which is hosting the nagios configs

Cheers
Jamie

one more that I used to refer to: Nagios: Documentation