memcached - 在没有 pidfile 的情况下监控 memcached 配置

标签 memcached centos7 monit

我有经典的情况。 CentOS7上需要为memcached配置monit。问题是,我在谷歌中可以找到的所有配置都包含这一行:

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

但是,/var/run 中没有 memcached.pid 文件,也没有/var/run/memcached 文件夹。我检查了/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

因此,没有 .pid 文件的路径。
问题是我可以在没有 .pid 文件的情况下检查 memcached 吗?
第二个问题 - 这个 .pid 文件可以在另一个位置吗?

最佳答案

在您的 monit 配置中替换

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


check process memcached with match memcached

我的 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

Centos 7,监控 5.14

关于memcached - 在没有 pidfile 的情况下监控 memcached 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35077485/

相关文章:

python - gcc错误安装python密码centos 7 64

python - Google App Engine内存中存储300MB的解决方案

gcc - nm devtoolset 的 .so 文件给出文件格式无法识别

io - Redis:请只保留不会过期的键?

docker-runc 未安装在系统上

linux - 如果 TOTAL CPU 小于 1%,则使用 monit 重启 ffmpeg 进程

linux - 监控配置 |总 CPU |语法错误 |

linux - Monit 守护程序 - 连接到 monit 守护程序时出错

django - 如何使用查询参数让服务器删除 API 调用缓存(django、DRF)

java - Memcache key 生成策略