惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

www.infosecurity-magazine.com
www.infosecurity-magazine.com
D
DataBreaches.Net
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
F
Full Disclosure
V2EX - 技术
V2EX - 技术
N
News and Events Feed by Topic
Help Net Security
Help Net Security
L
LangChain Blog
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
Google Online Security Blog
Google Online Security Blog
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
B
Blog RSS Feed
N
Netflix TechBlog - Medium
N
News | PayPal Newsroom
TaoSecurity Blog
TaoSecurity Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Vulnerabilities – Threatpost
B
Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
I
Intezer
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
AI
AI
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cyberwarzone
Cyberwarzone
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
G
GRAHAM CLULEY
Vercel News
Vercel News
罗磊的独立博客
MyScale Blog
MyScale Blog
Last Week in AI
Last Week in AI
博客园 - 司徒正美
C
CERT Recently Published Vulnerability Notes
GbyAI
GbyAI
Scott Helme
Scott Helme
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
Troy Hunt's Blog
A
About on SuperTechFans
P
Privacy International News Feed

博客园 - ddr888

Ubuntu16.04LTS国内快速源 bitnami redmine版本由2.3.1升级至3.2.2过程 Ubuntu1404安装gogs过程 Excel根据单元格背景色批量设置格式的宏 SAP ABAP鸟瞰【AV+PPT】 常用SAP表 HP-UX 11i v2上Oracle10.2基本安装指南 Debian5 dom0上跑Xen Debian5 lenny domU&Xen ubuntu10.04 Lucid domU--我爱你,飞一般的感觉 SAP BW BEx工具集简单介绍【AV+PPT】 resolve.conf引起登录HPUX的CDE故障 cx_Oracle说:Python访问Oracle并不难 让服务器时间“云”起来【拍死标题党】 ubuntu 10.04 源 HP-UX下使用python发送邮件 HP-UX 11i v2安装使用python 2.5.2 birdnest 102 api出现internel error处理 mac上配置rails开发环境 Heroku使用手记 ubuntu常用网络服务配置
服务器监控之热身:只是试用monit
ddr888 · 2011-03-02 · via 博客园 - ddr888

一、需求

  一直想为机房众多服务器找一个合适的监控方案,要求:

  1. 监控SAP应用状态;
  2. 监控Oracle服务器状态;
  3. 监控文件系统使用情况,最好有历史数据展示图;
  4. CPU、内存、负载情况,最好有历史数据展示图;
  5. 监控服务器是否可用;
  6. 必须能通过邮件或短信提醒,或者易于扩展提醒功能; 

  暂时想到这么多,目前找到的开源监控系统有:cacti、nagios、zenooshyperic等等一些,比较感兴趣的同时貌似有一定用户量的是:cactinagios,以后有机会试试。

二、monit干什么

  通过飞龙日志看到monit监控系统关键进程的文章,觉得很清凉,提供web管理界面,还能重启关键进程和监控远程主机的常用端口和协议,试试用了一下。最终达到:

  1. 监控安装monit服务器本身的cpu、内存、负载等信息(可以配置监控关键进程如mysql等)
  2. 监控远程服务器是否ping通
  3. 通过配置发送邮件

  参考网络上的资料,感觉monit的特点主要集中在:

  1. 查看localhost的状态,同时能灵活设定条件(cpu、内存使用率,空间使用率,失败次数,发生周期)判断故障是否发生并报警
  2. 对配置后的进程根据条件进行重启等一些操作

  缺点:

  1. 没有历史数据库并绘图展示;
  2. 不支持snmp协议,对远程服务器监控功能较差;

三、安装配置monit

1.lucid(172.20.10.196)安装

很方便安装成功,直接启动monit不成功,需要配置。

2.配置lucid

  先配置/etc/default/monit文件中的startup参数:

# You must set this variable to for monit to start
startup=1

  然后根据需要配置自己的/etc/monit/monitrc文件,里面包括了需要监控的localhost主要信息和关键进程信息等等等等重要信息,参照注释:

##
#
# Start monit in the background (run as a daemon):
#
set daemon 10# check services at 2-minute intervals
......
## Set syslog logging with the 'daemon' facility. If the FACILITY option is
#
# omitted, monit will use 'user' facility by default. If you want to log to
#
# a stand alone log file instead, specify the path to a log file
#
#
set logfile syslog facility log_daemon
set logfile /var/log/monit.log
......
## Set the list of mail servers for alert delivery. Multiple servers may be
#
# specified using comma separator. By default monit uses port 25 - this
#
# is possible to override with the PORT option.
#
set mailserver smtp.gmail.com port 587
username
"yourname@gmail.com" password "yourpasswd" using tlsv1 with timeout 30 seconds
......
# set mail-format { from: monit@foo.bar }
#
#
set mail-format { from: erick@yunnancopper.com }
......
#
#
set alert sysadm@foo.bar # receive all alerts
#
set alert manager@foo.bar only on { timeout } # receive just service-
#
# timeout alert
#
#
set alert erick@yunnancopper.com
......
## Monit has an embedded web server which can be used to view status of
#
# services monitored, the current configuration, actual services parameters
#
# and manage services from a web interface.
#
set httpd port 2812 and
use address
172.20.10.196
allow
0.0.0.0/0.0.0.0
allow admin:admin
#加入一个远程服务器检查是否ping通
check host debianVM with address 172.20.10.195
if failed icmp type echo count 3 with timeout 3 seconds then alert

  上面这个monit配置文件里面配置了使用Gmail的smtp服务器进行提醒的发送,这里遇到一个问题,不能设置普通验证类型的smtp服务器,高手请解答;这里monit还提供了一个内置的web server,这里地址为:http://172.20.10.196:2812/,可以方便的查看监控内容和配置情况:

3.重启monit

sudo /etc/init.d/monit start
sudo /etc/init.d/monit stop
sudo /etc/init.d/monit restart

四、总结

  简单的试用了monit的基本监控功能,效果不错,但绝不是他的所有功能,同时还有一个收费工具M/Monit提供将所有安装monit的客户端(这里可以叫agent)集成到一个web接口的平台进行管理监控,但是不便宜;以后有时间再对Cacti进行简单的介绍,感觉所有的工具都不是十分贴合需求,但是能有一个图形化的监控工具对于善于汇报的中国系统管理员非常有用,最后祝大家事业有成。