DragonFly On-Line Manual Pages
WATCHMEN(1) User Contributed Perl Documentation WATCHMEN(1)
NAME
watchmen - watch daemons and restart
SYNOPSIS
watchmen [--configkey=configvalue] [-svcname__svckey=svcvalue] [command[=param]] ...
where command:
check[=svc] stop[=svc] restart[=svc] keep[=svc] list avail help
where svc can be name of service or name of group. if group - all services in this group will be affected
AVAILABILITY
The latest version of watchmen is available from
http://code.google.com/p/watchmen/
REQUIREMENTS
to use all features , install the following:
* DBI and DBD::mysql or DBD::Pg or DBD::PgPP
* LWP::UserAgent and URI::URL
* Email::Send for mail reports
sudo portinstall databases/p5-DBD-mysql databases/p5-DBD-Pg www/p5-libwww mail/p5-Email-Send
DESCRIPTION
watchmen check availability of your services and [re]start them if any
problems detected.
* process in ps
* tcp or udp socket
* correct http answer
* database query execution
* memory and processes in limit, and reaching maximum of any (numeric) ps columns: SL RE PAGEIN VSZ RSS LIM TSIZ %CPU %MEM
* any custom check
EXAMPLES
#check and restart default services
watchmen
#list of enabled services
watchmen list
#list of available services
watchmen avail
#list of available groups
watchmen group
#full log
watchmen --log_all
#reatart apache if more than 5 httpd proc, dont check sshd, load custom config
watchmen -apache__max_proc=5 -sshd__enable=0 --config=/path/to/my/config
#check only 2 services with log
watchmen check=named check=mysql --log_all
#stop all EXCEPT sshd
watchmen stop
#stop all services with bluetooth group
watchmen stop=bluetooth
#stop all services in /etc/rc.d
watchmen stop=system
#stop all services in /usr/local/etc/rc.d
watchmen stop=local
#check services every 5 seconds without exit
watchmen keep --sleep=5
#same, only for mysqld
watchmen keep=mysqld --sleep=5
INSTALL
recommended libs: LWP, URI
freebsd: cd /usr/ports/www/p5-libwww && make install clean
or
perl -MCPAN -e "install LWP, URI"
cp watchmen /usr/local/bin/ ; cp watchmen.conf.dist /usr/local/etc/watchmen.conf
edit /usr/local/etc/watchmen.conf
run watchmen twice. second run must be quiet (all ok) if not - edit config
add to crontab:
echo "* * * * * root /usr/local/bin/watchmen" >> /etc/crontab
or line via root's crontab -e
* * * * * /usr/local/bin/watchmen
CONFIGURE
by default some of default services enabled
read [and edit] watchmen.conf
you can configure services from /etc/rc.conf[.local] file[s]:
for config string $svc{service}{key} = 'value'; write to rc.conf:
service_key="value"
example:
apache22_http="81"
#or define new service, with one of correct keys: process tcp udp http https :
nginx_enable="YES"
nginx_process="nginx"
nginx_http="8001"
nginx_http_check="<html"
nginx_group="web"
TODO
self pid & check
/tmp/socketfile check
various handlers
rsync --daemon
more default ports [tested!]
?.pid usage?
identify by process desc (sendmail)
keep: step by step skip fail checks (http->tcp->proc)
group once for samba
COPYRIGHT
watchmen Copyright (C) 2008-2010 Oleg Alexeenkov proler@gmail.com
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
perl v5.20.2 2015-08-31 WATCHMEN(1)