How can I create a pid file for a C program to be used in monit, and how do I monitor that C program using monit?
|
closed as off topic by womble, pauska, Iain♦ May 7 '12 at 5:34
Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.
|
I think Monit is still a useful tool. There aren't many solid alternatives. As for the C program, you should really look into daemonizing the process. That is the proper method. Monit is capable of monitoring process name patterns instead of PID files. In a pinch, you can have a Monit setup that looks like the following, assuming the name of the program is "c_program" and that there's a single instance of it:
|
|||
|
|
Alternate solution: don't use monit. Writing daemons properly is hard, and in my experience it's a whole lot easier just to use a process management system that does the daemonisation for you (I like daemontools -- it's not the only option out there, but I've tried 'em all and I keep coming back to daemontools). The benefits of doing things that way are many:
|
|||
|
|