你的位置:LAMP之窗 >> 资讯 >> APACHE/NGINX >> 详细内容 在线投稿

监控Apache正常服务的方法

热度33票  浏览24次 【共0条评论】【我要评论 时间:2010年3月22日 21:32
蘑菇在之前的工作,安排运维主管监控服务器的apache进程,结果有一天出现事故,apache进程存在,但apache已经停止服务,所以通过监控指定页面来监控apache服务是否正常

1,新建apache.php
<?php
echo 'ok';
?>

2,新建apache.sh
#!/bin/sh
ct=`wget -O /tmp/res http://192.168.0.2/apache.php 2>&1 |  cat  | grep "200 OK" | wc -l`
curl=`curl  http://192.168.0.2/apache.php`
if [ $curl != ok -o $ct != 1 ]
then
    sleep 3s
else
    exit;
fi

3,配置crontab,每5分钟执行一次
*/5 * * * * sh /root/apache.sh > /dev/null

TAG: Apache apache 服务
顶:2 踩:2
对本文中的事件或人物打分:
当前平均分:0.69 (13次打分)
对本篇资讯内容的质量打分:
当前平均分:-0.13 (8次打分)
【已经有8人表态】
上一篇 下一篇
发表评论

网友评论仅供网友表达个人看法,并不表明本网同意其观点或证实其描述。

查看全部回复【已有0位网友发表了看法】
       

网络资源