Skip to content

Add services to plesk watchdog

by admin on April 24th, 2015

How to add services to plesk watchdog? Plesk use monit to monitor services so that syntax should be almost fine. But first:

1)to include a custom program we need to define the program as a services in the server

2)need to add the services to Plesk/PSA watchdog program. We need to a small hack into the psa database.We need to add a row into the psa.module_watchdog_service table:

$ mysql -u admin -p //log into the mysql

mysql>use psa;
mysql>INSERT INTO psa.module_watchdog_service (id,name,label,sort_val,mon_status,save_stats,timeout,timeout_restart_num,timeout_cycles_num,connection_timeout,start_cmd,stop_cmd,start_time) VALUES (18,’my-program’,’My Program’,140,’notmonitored’,’on’,’on’,5,5,5,’/etc/rc.d/init.d/my-program start’,’/etc/rc.d/init.d/my-program stop’, 300);
mysql>quit // to exit mysql

3)Then go to the watchdog service template directory. Never mess-up with other files, as after plesk restarts it will override all configuration. The below path depends where your psa/plesk is installed.

$ cd /usr/local/psa/etc/modules/watchdog/service.tpl.d

4)create a file named my-program and add the following to the program:

check process my-program
with pidfile /usr/local/programpath/
start = “/etc/rc.d/init.d/my-program start”
stop = “/etc/rc.d/init.d/my-program stop”
if failed host port 8080 protocol HTTP timeout 120 seconds then alert
if failed host port 8080 protocol HTTP timeout 300 seconds then restart
if 5 restarts within 5 cycles then timeout
every 1 cycles
if cpu usage > 95% for 10 cycles then restart
mode active

5)Go to the plesk control panel and restart plesk watchdog program. My Program will be visible in the list.


No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS