The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Using chkservd to monitor MRTG

Discussion in 'General Discussion' started by sneader, Sep 28, 2008.

  1. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    I noticed after a recent server reboot that MRTG did not automatically restart, so I haven't had stats for a couple weeks.

    I thought I might add monitoring and auto-restart of mrtg inside of WHM.

    I created a file called /etc/chkserv.d/mrtg (patterned off other files I see in this directory) which contains this line:

    service[mrtg]=x,x,x,service mrtg restart,mrtg,root

    I edited /etc/chkserv.d/chkservd.conf and added:

    mrtg:1

    For good measure, I did a "service chkservd restart"

    Immediately, I received an alert that "mrtg failed - a restart was attempted automagically"

    And it WORKED! It restarted automatically!

    MRTG now also shows up on the Service Status page in WHM (green if running, red if failed)

    Hope this helps someone down the road...

    - Scott
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Nice work there. Which version of cPanel are you using (11.23.6 or 11.23.7) ? We refactored chkservd in 11.23.7 to be handled by Tailwatch. That shouldn't impact your MRTG monitor as that format of the monitor files have not changed. However, in 11.23.7, the init script no longer exists (hence no "service chkservd restart").
     
  3. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    Hi Kenneth. Thanks for taking time to check my work, and for the heads up on the upcoming changes... maybe you can suggest a better way to do this going forward?

    I am on the latest Stable, WHM 11.23.2 cPanel 11.23.6-S27698

    - Scott
     
Loading...

Share This Page