[文章作者:张宴 本文版本:v1.1 最后修改:2007.08.31 转载请注明出处:http://blog.zyan.cc]

  8月3日,我写了“Linux服务器监控系统 ServMon V1.0”,今天,ServMon V1.1 版本亮相。

  ServMon的原理是用shell脚本定时抓取被监控Linux服务器上的信息,再用curl POST到监控机的PHP接口程序上,由PHP接口程序对信息进行分析,如果存在异常,则发送报警邮件给管理员。报警邮件演示页面请见:http://blog.zyan.cc/read.php/276.htm

  点击在新窗口中浏览此图片

  ServMon V1.1 在 1.0 的基础上,增加了对Linux系统负载的监控,并编写了客户端自动安装包:

  1、被监控端服务器(Linux)
  (1)、下载并安装ServMon Client
引用
wget http://blog.zyan.cc/soft/linux/servmon/servmon-1.1.linux.tar.gz
tar zxvf servmon-1.1.linux.tar.gz
cd servmon-1.1
./install -i http://yourdomain/servmon/interface.php password

  注:此处的password为interface.php程序中设置的数据传输验证密码。

  客户端安装包源码:
  │
  ├─install
  ├─[src]
  │  ├─[bin]
  │  │  ├─diskstat_send
  │  │  ├─loadstat_send
  │  │  └─swapstat_send
  │  ├─[cron]
  │  │  └─servmon
  │  └─[data]

  屏幕演示:
  点击在新窗口中浏览此图片




  2、监控端服务器配置(Linux)
  (1)、启动sendmail
  /usr/sbin/sendmail -bd -q30m
  -b:指定Sendmail在后台运行,并且监听端口25的请求。
  -d:指定Sendmail以Daemon方式运行(守护进程)。
  -q:当Sendmail无法将邮件成功地发送到目的地时,它会将邮件保存在队列里。该参数指定邮件在队列里保存的时间。其中的30m表示保留30分钟。

  (2)、修改php.ini的[mail function]部分为以下内容,然后重启Apache,使PHP能够使用mail()函数发送电子邮件
引用
[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i


  (4)、在MySQL上创建一个数据库servmon,然后在该数据库中执行以下SQL语句创建表:
引用
CREATE TABLE `tb_diskstat` (
 `ip` varchar(128) NOT NULL default '',
 `date` int(10) NOT NULL default '0',
 UNIQUE KEY `ip` (`ip`)
) TYPE=MyISAM;

  备注:这张表是PHP接口程序用来记录发送磁盘分区报警邮件的时间,避免在一段时间内重复发送大量报警邮件的。

  (3)、PHP接口程序
  http://yourdomain/servmon/interface.php


Tags:



技术大类 » 其他Unix技术 | 评论(1076) | 引用(0) | 阅读(143980)
AOL support Email Homepage
2018-9-17 19:54
Hi, this is nice articale...Looking for AOL support, visit on:AOL support
Content Marketing Email Homepage
2018-9-17 19:55
Hi, this is nice articale...Looking for Content Marketing, visit on:Content Marketing
Brother Printer Support Email Homepage
2018-9-17 19:57
Hi, this is nice articale...Looking for Brother Printer Support, visit on:Brother Printer Support
technical support Email Homepage
2018-9-17 19:58
Hi, this is nice articale...Looking for technical support, visit on:technical support
Quick Support Number Email Homepage
2018-9-17 20:00
Hi, this is nice articale...Looking for Quick Support Number, visit on:Quick Support Number
Help.contact support Email Homepage
2018-9-17 20:01
Hi, this is nice articale...Looking for Help.contact support, visit on:Help.contact support
Hannah Baker Email Homepage
2018-11-14 21:47
Apple Support Phone Number is here to help. Contact Apple Support Number by phone for iPhone, iPad, Mac, and more. Call +18338005666 apple customer service number,
Hannah Baker Email Homepage
2018-11-14 21:47
Apple Support Phone Number is here to help. Contact Apple Support Number by phone for iPhone, iPad, Mac, and more. Call +18338005666 apple customer service number,
Hannah Baker Email Homepage
2018-11-14 21:47
Apple Support Phone Number is here to help. Contact Apple Support Number by phone for iPhone, iPad, Mac, and more. Call +18338005666
Matt Brown Email Homepage
2018-11-14 21:49
Microsoft Support is here to help. Contact Microsoft Support by phone for technical support on all Microsoft products and software. Call +1-855-999-4211 windows support number
Anna Wallace Email Homepage
2018-11-14 21:51
Antivirus Support -Contact for assistance on Antivirus, Internet Security, and security software. Make your computer secure and virus free.  mcafee phone number trend micro phone number
richard s gatewood Email
2018-12-29 01:16
printer customer support Email Homepage
2018-12-29 13:37
If you have a printer at home, chances are you may know the pros and cons of it. Although it is beneficial to have a printer at home and provides a lot of benefits including scanning and printing like functions, but if it stops functioning all of a sudden, then it could be very frustrating for all of us. That’s where we come in. We provide customer support for all kinds of printer brands and models including.Brother Printer Support | Canon Printer Support
bathmate Email Homepage
2019-1-1 13:56
Apple Support Phone Number is here to help.Hydromax
分页: 5/54 第一页 上页 1 2 3 4 5 6 7 8 9 10 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]