分享一个linux的流量监测工具!!!(3)
<span style="" class="Apple-style-span"><span style="text-align: left; border-collapse: collapse; font-family: song, Verdana; font-size: 12px;" class="Apple-style-span"><div style="line-height: normal;" class="t_msgfontfix">这个配置文件监控了vsftpd, sshd, mysql, apache, postfix服务,设定web监控的端口是2812,设置lvsheat@qq.com将接受到警告邮件。
配置apache的检查信息
mkdir /var/www/monit
echo "hello" > /var/www/monit/token
创建/var/certs/monit.pem信息,设置https的web监控访问
mkdir /var/certs
cd /var/certs
编辑一个默认的OpenSSL的配置文件
vi /var/certs/monit.cnf
# create RSA certs - Server
RANDFILE = ./openssl.rnd
[ req ]
default_bits = 1024
encrypt_key = yes
distinguished_name = req_dn
x509_extensions = cert_type
[ req_dn ]
countryName = Country Name (2 letter code)
countryName_default = MO
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = Monitoria
localityName = Locality Name (eg, city)
localityName_default = Monittown
organizationName = Organization Name (eg, company)
organizationName_default = Monit Inc.
organizationalUnitName = Organizational Unit Name (eg, section)
organizationalUnitName_default = Dept. of Monitoring Technologies
commonName = Common Name (FQDN of your server)
commonName_default = server.monit.mo
emailAddress = Email Address
emailAddress_default = root@monit.mo
[ cert_type ]
nsCertType = server
创建/var/certs/monit.pem文件
openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pem
openssl gendh 512 >> /var/certs/monit.pem
openssl x509 -subject -dates -fingerprint -noout -in /var/certs/monit.pem
chmod 700 /var/certs/monit.pem
启动Monit服务
/etc/init.d/monit start
通过https://192.168.1.149:2812/访问监控页面信息查看邮件可以看到监控的邮件警告信息
http://man.chinaunix.net/ost/200908/2009087_html_7faafc91.jpg
图:登陆信息输入admin 密码test
http://man.chinaunix.net/ost/200908/2009087_html_12f635ba.jpg
图:监控的信息清单
http://man.chinaunix.net/ost/200908/2009087_html_74e5dc2f.jpg
图:监控的服务的详细信息
http://man.chinaunix.net/ost/200908/2009087_html_63f0bb48.jpg
图:收到的监控警告邮件
http://man.chinaunix.net/ost/200908/2009087_html_m47a36431.jpg
图:监控邮件内容
Ntop的安装和使用
执行yum 安装ntop
yum install ntop
启动ntop
ntop -P /tmp -u nobody
ntop startup - waiting for user response!
Please enter the password for the admin user:
Please enter the password again:
第一次執行会要求输入admin的password
启动后查看本机的端口信息,会出现TCP3000的端口
netstat -tlnup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::3000 :::* LISTEN 3932/ntop
以在web浏览器中输入http://ip:3000 就可以访问到监控的信息页面
http://man.chinaunix.net/ost/200908/2009087_html_41026090.jpg
图:Ntop监控信息
http://man.chinaunix.net/ost/200908/2009087_html_m481ce0a5.jpg
图:Ntop监控信息
现在就可以使用munin monit ntop监控Linux主机的服务及资源。使用yum可以很便捷的安装软件包,达到快速实现系统服务的目的,维护使用Centos的一部分工作就是选择一个很好的yum的源,这样可以很快捷的实现管理。
作者简介:CU网友kns1024wh,目前从事Linux群集方面的具体工作,之前做过多年的IT技术支持、MCT讲师、及REDFLAG的技术合作,技术专长群集、unix主机、AD部署等,您可以通过电子邮件lvsheat@qq.com或者Chinaunix社区与他取得联系。
[ 本帖最后由 八重樱 于 2009-9-17 07:46 编辑 ]
页:
[1]