autorestart a process if it is down

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
chrisduplateau
Posts: 7
Joined: Thu Sep 25, 2008 8:46 am

autorestart a process if it is down

Post by chrisduplateau »

hello, I can monitor processes (as apache2 or mysql), but how can I auto-restart one of them if it is down ?
Thank you for your answers.
Attachments
apache-log.JPG
apache-log.JPG (28.85 KiB) Viewed 1115 times
User avatar
schurzi
Posts: 42
Joined: Sat Oct 11, 2008 8:45 am
Location: Germany
Contact:

Post by schurzi »

Hi chrisduplateau,

I would not recomend you to do this with cacti.
It is not impossible, but it would be like teaching a dog to write a book.

There are several other tools out there that can do this type of thing.
For example Nagios can monitor and restart services. But for small deployments i would recomend moint (http://mmonit.com/monit/). I haven't used it myself, but it made a good impression when i saw it in an presentation.

And I have to add. If your apache crashes as fequently as this graph shows, you have most likely other problems, that a restart script won't solve.
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
chrisduplateau
Posts: 7
Joined: Thu Sep 25, 2008 8:46 am

Post by chrisduplateau »

Thank you fo your answer, in fact my apache2 does not crash as we can see on the graph, I sometimes have "gaps", I don't get informations, (it's also true for other monitorings like CPU usage, memory usage...). I don't know why I get those gaps, I perhaps should post a topic in this forum !
I'm gonna see other tools, thanks.
khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

chrisduplateau wrote:Thank you fo your answer, in fact my apache2 does not crash as we can see on the graph, I sometimes have "gaps", I don't get informations, (it's also true for other monitorings like CPU usage, memory usage...). I don't know why I get those gaps, I perhaps should post a topic in this forum !
I'm gonna see other tools, thanks.
Check in Cacti console -> device -> availability. If its low increase the timeout to the device or check the device's SNMP capability.

Otherwise.. it is an ongoing topic in Cacti. Look for keyword "gaps" in a search. Some tricks that usually work is to increase the processes <cmd.php poller> or threads <spine poller>. When your installation gets bigger you need more tricks.

Regards
chrisduplateau
Posts: 7
Joined: Thu Sep 25, 2008 8:46 am

Post by chrisduplateau »

Many thanks, I'm gonna search in the forum (good availability for all my machines)
khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

chrisduplateau wrote:Many thanks, I'm gonna search in the forum (good availability for all my machines)
Happy to help. Also, the developers are really excellent at providing information back. But.. it's their hobby, give them time to respond if you need an answer back.

BTW, for your graph you may want to increase the width to 530 or 550 so it will fit on the page.

graph management -> keyword search or filter by host -> select graph -> change width from 500 to 530 or 550. save.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests