I have a requirement to raise alert when a particular process(suppose abc) start or stop. One of idea is to write a script that monitor process , Can you suggest any better idea. I can't install any additional tools or softwares .
-
1The your question is meaningless and unanswerable. What counts as "additional" varies not only from Linux distribution to Linux distribution but also according to system administrator taste, depending from what packages xe might have chosen to install.– JdeBPJun 22, 2011 at 15:23
-
I am using RHEL 5 distro, i mean i can just use basic linux commands– vnix27Jun 23, 2011 at 3:35
-
Do you have inotify-tools installed ? Most linux distros already have support for inotify. Every process that starts let it's PID in /var/run/<something>.pid. Inotify tools has a small tool called inotifywatch that can monitor a directory for changes in the contents and alert through email– Feiticeir0Jun 29, 2011 at 20:54
-
If you can't install anything, then I guess you have to write something yourself or use an external machine to monitor it...– CrackerJack9Nov 9, 2011 at 4:29
-
Do you have superuser privileges at less?– Thiago Rider AugustoAug 16, 2016 at 3:24
2 Answers
you can use monit
It really depends on how this process is started or stopped. If the process is run from a startup script, you could have it send email from the script when either happens.
You could also run cron job that checks every X amount of minutes to see if the process is running, then send email.
There are many different ways to accomplish this depending on your situation and what you are trying to monitor the process for.