[文章作者:张宴 本文版本: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技术 | 评论(88) | 引用(0) | 阅读(63072)
SlimQuick Reviews Email Homepage
2014-9-1 13:06
I desired to thank you for this exceptional read!! I absolutely enjoyed every single small little bit of it. I’ve you bookmarked your internet site to look at out the new stuff you post.
SlimQuick Email Homepage
2014-12-18 00:43
Pretty cool post. It’s really very nice and useful post. Thanks for sharing this with us!it’s my first visit.SlimQuickSlimQuick
SlimQuick Email Homepage
2014-12-28 22:29
Pretty cool post. It’s really very nice and useful post.Thanks for sharing this with us!it’s my first visit. SlimQuickSlimQuick
Hydroxycut Reviews Email Homepage
2015-2-25 14:56
Hydroxycut Reviews  Very good brief and this post helped me a lot. Say thank you I searching for your facts. Thanks for sharing with us!
Forskolin Email Homepage
2015-3-1 00:59
Forskolin  I’m very satisfied to look your post. Thanks a lot and i’m looking ahead to touch you. Will you kindly drop me a e-mail? Well done!
jhon Email
2015-6-2 15:48
Very nice tutorial,i have learnt lot from it.I will share the post with my friends.garage flooring provides excellent services
mike Email
2015-6-2 19:07
This tutorial is very educational,you have posted very informative post which i like reading it.london stock bricks are commonly used in building construction
chris Email
2015-6-2 19:10
I am amazed to read the post,it is very well written.I am inspired to see your work.grass mats provide you with best service
Stan Email
2015-6-3 13:50
Thanks for the nice and beautiful website. i like this website as the designer has used good colour scheme on this website. Also i see many useful gadgets that are used properly on this blog.
Pioneer of Gym Mats love
Susan Email
2015-6-3 15:18
Your article is very interesting and informative. I like it. You have done fantastic job. Thanks for sharing interesting post.  Various quality in grass meshVarious quality in grass mesh
Cassey Email
2015-6-3 15:34
It is truly a nice website. I am saying this because i am seeing people doing great discussions in the comments section. Thanks for sharing.
Pioneer of Gym Flooring lovelove
Lunar Email
2015-6-3 17:41
Thanks for nice and valuable sharing. Although this blog is in chinesse language but the design, layout of this website is quite awesome. it attracts the visitors very much. Pioneer of London Brick
Mathilda Email
2015-6-3 19:02
Thanks for the nice website. Me and my friends ocassionaly visit this website. The main reason for liking this website is that this website is created very beautifully.
Pioneer of London Yellow Bricks
lovelovelove
Ole
2015-6-4 19:40
It is very nice and the data you used in it is very useful for us. I am here only due to your informative pos... Please share with us some more post in the future... Buy our cheap but top quality rubber matting
naturalproductsinfo.net Email Homepage
2016-6-16 22:41
this is good info online find my website Generic Viagra Online
http://www.genericbrandtab.net Email Homepage
2016-6-21 01:39
Magnificent article! This is the sort of data that ought to be shared over the net Generic viagra
Forskolin Reviews Email Homepage
2016-11-29 12:26
Forskolin Reviews Pretty cool post. It’s really very nice and useful post. Thanks for sharing this with us! It’s my first visit.
sdsd Email Homepage
2018-8-17 21:05
http://descargarandroidapks.com/es/descargar-you-tv-player-gratis/http://descargarandroidapks.com/es/descargar-you-tv-player-gratis/
AOL support Email Homepage
2018-9-17 19:52
https://www.google.com/<a href="https://www.google.com/">google</a>googleGoogle
分页: 4/5 第一页 上页 1 2 3 4 5 下页 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]