memcached can't find pid file? CentOS 7 specify memcache pid

On CentOS 7 needs to be configured for memcached Monit monitoringWhen I program, I encounter the problem that memcached cannot find the pid file...

memcached can't find pid file? CentOS 7 specify memcache pid

All the configs we can find in googling contain this line:

check process memcached with pidfile /var/run/memcached/memcached.pid

but,/var/run Not in memcached.pid file, nor /var/run/memcached folder.

checked /usr/lib/systemd/system/memcached.service

[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/memcached
ExecStart=/usr/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN $OPTIONS
  • Therefore, there is no path to the .pid file.
  • If checking memcached without a .pid file?
  • Also, can this .pid file be in another location?

How does CentOS 7 specify the location address of the memcache pid file?

The solution is to specify the memcache pid file address you specified in the Monit monitoring configuration▼

check process memcached with pidfile /var/run/memcached/memcached.pid

Replace with the file address of the following memcached pid▼

check process memcached with match memcached

Our configuration for memcached:

check process memcached with match memcached
start program = "/usr/bin/systemctl start memcached"
stop program = "/usr/bin/systemctl stop memcached"
if failed host 127.0.0.1 port 11211 protocol MEMCACHE then restart
if cpu > 70% for 2 cycles then alert
if cpu > 98% for 5 cycles then restart
if 2 restarts within 3 cycles then timeout

For the installation method of Centos 7 Monit monitoring 5.14, please refer to the following tutorial▼

Comment

Your email address will not be published. Required fields * Callout

Scroll to Top