nagios note
server: nagios nagios_plugin nrpe ip:192.168.1.2
client nagios_plugin xinetd nrpe ip:192.168.1.3

一篇介绍nagios很好的博文 http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html
nagios插件(python + psutil)(client 被监控点)(收集system信息)
yum install -y gcc python-devel
yum install python-setuptools -y
easy_install psutil
#client side
#vim /usr/local/nagios/libexec/get_sys_info.py #!/usr/bin/env python
__author__ = 'metasequoia' import psutil
import datetime
import platform def info():
system_info = platform.version()
print "system_version:%s" % system_info
cpu_count = psutil.cpu_count()
print "logical_cpu_count:%score" % cpu_count
mem = psutil.virtual_memory()
print "memory_volume:%sM memory_used:%sM memory_free:%sM percent:%s%s" % ((mem[0]/1024/1024),(mem[3]/1024/1024),(mem[4]/1024/1024),mem[2],"%")
swap = psutil.swap_memory()
print "swap_volume:%sM swap_used:%sM swap_free:%sM percent:%s%s" % ((swap[0]/1024/1024),(swap[1]/1024/1024),(swap[2]/1024/1024),swap[3],"%")
print datetime.datetime.fromtimestamp(psutil.boot_time()).strftime("%Y-%m-%d %H:%M:%S") + " UP"
users = psutil.users()
for user in users:
print "%s\t%s\t%s (%s)" % (user[0],user[1],datetime.datetime.fromtimestamp(user[3]).strftime("%Y-%m-%d %H:%M"),user[2])
#disk_partitions = psutil.disk_partitions()
disk_usage = psutil.disk_usage('/')
print "disk_volume:%sG disk_used:%sG disk_free:%sG percent:%s%s" % ((disk_usage[0]/1024/1024/1024),(disk_usage[1]/1024/1024/1024),(disk_usage[2]/1024/1024/1024),disk_usage[3],"%") if __name__ == "__main__":
info()
chmod + /usr/local/nagios/libexec/get_sys_info.py
client define command
vim /usr/local/nagios/etc/nrpe.cfg
command[check_sys_info]=/usr/local/nagios/libexec/get_sys_info.py
server define command
vim commands.cfg
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1
}
server register service
vim services.cfg
define service{
use local-service
host_name Nagios-Linux
service_description Check sys_info
check_command check_nrpe!check_sys_info
}
server test
/usr/local/nagios/libexec/check_nrpe -H 192.168.1.3 -c check_sys_info
nagios note的更多相关文章
- How To Monitor Remote Linux Host using Nagios 3.0
In the previous post Nagios 3.0 Jumpstart guide , I explained the overview, installation and configu ...
- Nagios学习实践系列——配置研究[监控当前服务器]
其实上篇Nagios学习实践系列——基本安装篇只是安装了Nagios基本组件,虽然能够打开主页,但是如果不配置相关配置文件文件,那么左边菜单很多页面都打不开,相当于只是一个空壳子.接下来,我们来学习研 ...
- Nagios配置文件详解
首先要看看目前Nagios的主配置路径下有哪些文件.[root@nagios etc]# ll总用量 152-rwxrwxr-x. 1 nagios nagios 1825 9月 24 14:40 ...
- Nagios监控Oralce
一.本文说明: 本文是监控本地的Oracle,其实监控远端的Oracle也是跟下面的步骤差不多的. 二.安装Nagios.Nagios插件.NRPE软件: 安装步骤可以参考<Linux下Nagi ...
- Linux下Nagios的安装与配置
一.本文说明 本文是在参考:http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html David_Tang文章以及网上的一些资料完 ...
- install Nagios on Unbuntu Unix
Ubuntu Quickstart Up To: ContentsSee Also: Quickstart Installation Guides, Security Considerations I ...
- Notifications Nagios
Introduction I've had a lot of questions as to exactly how notifications work. This will attempt to ...
- 在Nginx中搭建Nagios监控平台
本文只做Nginx下Nagiox安装的说明,其它关于Nagios监控的详细配置请参考我的另一篇文章[Ubuntu 10.04下构建Nagios监控平台] Nagios依赖PHP环境和perl环境.由于 ...
- Nagios配置—添加linux主机监控
nagios安装请参看:Nginx平台安装Nagios监控服务 下面是我添加linux监控机的过程,如有错误或者不当的地方请指出: 测试环境: 监控主机:nagios+nagios插件+nrpe+网站 ...
随机推荐
- NOI2018准备 Day9
tjvj清北入学测试又打了一上午,暴力搜索得了部分分,dp全崩了,8道题凑了500分. 下午打了个速度赛,成绩未知,另外又做了1道题,这效率low到爆!!!
- jquery选择器空格与大于号、加号与波浪号的区别
空格:$('parent childchild')表示获取parent下的所有的childchild节点,所有的子孙. 大于号:$('parent > child')表示获取parent下的所有 ...
- 基于ASP.NET MVC的热插拔模块式开发框架(OrchardNoCMS)--BootStrap
按照几个月之前的计划,也应该写一个使用Bootstrap作为OrchardNoCMS的UI库.之前这段时间都是在学习IOS开发,没顾得上写,也没顾得上维护OrchardNoCMS代码.看看我的活动轨迹 ...
- WordPress使用固定链接
WordPress安装后我们会发现,文章默认的url是很丑的,http://example.com/?p=N,其中N是文章ID,一串数字.默认链接在所有的环境下都运转良好,但和其他的类型比起来却没那么 ...
- PHP学习资料分享
PHP有着开源.执行效率高.优化代码运行等特性,功能强大,被广泛运用,很多大型企业网站开发的首选,百度.腾讯.新浪.金山等均采用了PHP开发.学好PHP对网络开发人员而言具有很好的发展前景,市场对PH ...
- Beyond Compare 3 设置自动换行
设置自动换行方法: 在菜单栏里点击“工具”,然后在弹出列表里选择“文件格式”,在弹出框的左下角编辑文件格式默认值中,选择“文本格式”,对右侧的 ‘每行字符限制’进行修改保存即可,一般可设置80或90. ...
- Html.BeginForm
该方法用于构建一个From表单的开始,他的构造方法为: Html.BeginForm("ActionName","ControllerName",FormMet ...
- Matlab中的向量
1. 向量的创建 1)直接输入: 行向量:a=[1,2,3,4,5] 列向量:a=[1;2;3;4;5] 2)用“:”生成向量 a=J:K 生成的行向量是a=[J,J+1,…, ...
- 【摘抄】将xml注释文档生成网页
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath(&quo ...
- why does turn off button means hibernate on my win8
when I upgrated my laptop's system to win8.*,I found it's hibernate when I clicked turn off button. ...