Я пытаюсь использовать monit для мониторинга моего сервера squid. Я установил сервер squid на raspbian stretch, используя apt-get. Служба squid была установлена в /etc/init.d/squid, и я проверил, существует ли файл PID в /var/run/squid.pid.
Тем не менее, когда я запускаю sudo monit start все, что я получаю:
There is no service named "squid"
Я установил monit, скомпилировав его как root и добавив в systemd следующим образом:https://mmonit.com/wiki/Monit/Systemd
Вот мой файл monit, созданный в /etc /monitrc
set daemon 60
set logfile syslog facility log_daemon
set idfile /tmp/monit.id
set statefile /tmp/monit.state
set mailserver localhost
set alert systems@abcd.net
set httpd port 2812 and
#use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
allow admin:monit # require user 'admin' with password 'monit'
check process squid with pidfile /var/run/squid.pid
group proxy
start program = "/etc/init.d/squid start"
stop program = "/etc/init.d/squid stop"
if failed host localhost port 3128
send "GET /monit-check HTTP/1.0\r\n\r\n"
expect "HTTP/[0-9\.]{3} 400 .*\r\n"
for 5 cycles then restart
Выход из service squid status
:
● squid.service - LSB: Squid HTTP Proxy version 3.x
Loaded: loaded (/etc/init.d/squid; generated; vendor preset: enabled)
Active: active (running) since Tue 2018-01-16 12:23:25 UTC; 2h 1min ago
Docs: man:systemd-sysv-generator(8)
Process: 24781 ExecStop=/etc/init.d/squid stop (code=exited, status=0/SUCCESS)
Process: 24928 ExecStart=/etc/init.d/squid start (code=exited, status=0/SUCCESS)
Main PID: 24970 (squid)
CPU: 3.718s
CGroup: /system.slice/squid.service
├─24968 /usr/sbin/squid -YC -f /etc/squid/squid.conf
├─24970 (squid-1) -YC -f /etc/squid/squid.conf
├─24971 (logfile-daemon) /var/log/squid/access.log
├─24984 (pinger)
└─25378 (basic_ncsa_auth) /etc/squid/squid_passwd
Jan 16 12:23:24 raspberrypi systemd[1]: Starting LSB: Squid HTTP Proxy version 3.x...
Jan 16 12:23:25 raspberrypi squid[24968]: Squid Parent: will start 1 kids
Jan 16 12:23:25 raspberrypi squid[24968]: Squid Parent: (squid-1) process 24970 started
Jan 16 12:23:25 raspberrypi squid[24928]: Starting Squid HTTP Proxy: squid.
Jan 16 12:23:25 raspberrypi systemd[1]: squid.service: PID file /var/run/squid.pid not readable (yet?) after start: No sJan 16 12:23:25 raspberrypi systemd[1]: squid.service: Supervising process 24970 which is not our child. We'll most likeJan 16 12:23:25 raspberrypi systemd[1]: Started LSB: Squid HTTP Proxy version 3.x.