【问题标题】:Monit memcached config without pidfile监控没有 pidfile 的 memcached 配置
【发布时间】:2016-01-29 05:25:23
【问题描述】:

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

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 文件可以在其他位置吗?

【问题讨论】:

    标签: memcached centos7 monit


    【解决方案1】:

    在你的监控配置中替换

    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

    【讨论】:

    • 它看起来有效。谢谢。我会测试几个小时,应该接受这个答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-23
    • 1970-01-01
    • 1970-01-01
    • 2013-07-28
    • 2016-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多