Nagios监控磁盘
1、查看check_disk脚本
[oracle@rhel5 ~]$ /usr/local/nagios/libexec/check_disk --h
check_disk v1.4.15 (nagios-plugins 1.4.15)
Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>
Copyright (c) 1999-2008 Nagios Plugin Development Team
<nagiosplug-devel@lists.sourceforge.net> This plugin checks the amount of used disk space on a mounted file system
and generates an alert if free space is less than one of the threshold values Usage:
check_disk -w limit -c limit [-W limit] [-K limit] {-p path | -x device}
[-C] [-E] [-e] [-g group ] [-k] [-l] [-M] [-m] [-R path ] [-r path ]
[-t timeout] [-u unit] [-v] [-X type] Options:
-h, --help
Print detailed help screen
-V, --version
Print version information
-w, --warning=INTEGER
Exit with WARNING status if less than INTEGER units of disk are free
-w, --warning=PERCENT%
Exit with WARNING status if less than PERCENT of disk space is free
-c, --critical=INTEGER
Exit with CRITICAL status if less than INTEGER units of disk are free
-c, --critical=PERCENT%
Exit with CRITCAL status if less than PERCENT of disk space is free
-W, --iwarning=PERCENT%
Exit with WARNING status if less than PERCENT of inode space is free
-K, --icritical=PERCENT%
Exit with CRITICAL status if less than PERCENT of inode space is free
-p, --path=PATH, --partition=PARTITION
Path or partition (may be repeated)
-x, --exclude_device=PATH <STRING>
Ignore device (only works if -p unspecified)
-C, --clear
Clear thresholds
-E, --exact-match
For paths or partitions specified with -p, only check for exact paths
-e, --errors-only
Display only devices/mountpoints with errors
-g, --group=NAME
Group paths. Thresholds apply to (free-)space of all partitions together
-k, --kilobytes
Same as '--units kB'
-l, --local
Only check local filesystems
-L, --stat-remote-fs
Only check local filesystems against thresholds. Yet call stat on remote filesystems
to test if they are accessible (e.g. to detect Stale NFS Handles)
-M, --mountpoint
Display the mountpoint instead of the partition
-m, --megabytes
Same as '--units MB'
-A, --all
Explicitly select all paths. This is equivalent to -R '.*'
-R, --eregi-path=PATH, --eregi-partition=PARTITION
Case insensitive regular expression for path/partition (may be repeated)
-r, --ereg-path=PATH, --ereg-partition=PARTITION
Regular expression for path or partition (may be repeated)
-I, --ignore-eregi-path=PATH, --ignore-eregi-partition=PARTITION
Regular expression to ignore selected path/partition (case insensitive) (may be repeated)
-i, --ignore-ereg-path=PATH, --ignore-ereg-partition=PARTITION
Regular expression to ignore selected path or partition (may be repeated)
-t, --timeout=INTEGER
Seconds before connection times out (default: 10)
-u, --units=STRING
Choose bytes, kB, MB, GB, TB (default: MB)
-v, --verbose
Show details for command-line debugging (Nagios may truncate output)
-X, --exclude-type=TYPE
Ignore all filesystems of indicated type (may be repeated) Examples:
check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /
Checks /tmp and /var at 10% and 5%, and / at 100MB and 50MB
check_disk -w 100 -c 50 -C -w 1000 -c 500 -g sidDATA -r '^/oracle/SID/data.*$'
Checks all filesystems not matching -r at 100M and 50M. The fs matching the -r regex
are grouped which means the freespace thresholds are applied to all disks together
check_disk -w 100 -c 50 -C -w 1000 -c 500 -p /foo -C -w 5% -c 3% -p /bar
Checks /foo for 1000M/500M and /bar for 5/3%. All remaining volumes use 100M/50M Send email to nagios-users@lists.sourceforge.net if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to nagiosplug-devel@lists.sourceforge.net
举例:
Usage: check_disk -w limit -c limit {-p path | -x device}
格式:check_disk -w 低限% -c 低限% -p 磁盘设备文件或则分区文件的绝对路径
Options:
选项
-w, --warning=PERCENT%
设定告警通知百分比数,空间低于该百分比则发出告警通知。
-c, --critical=PERCENT%
设定严重告警通知百分比数,空间低于该百分比则发出严重告警通知。
-p, --path=PATH, --partition=PARTITION
指定磁盘设备文件或则分区文件的绝对路径。
#如果要监控根目录,达到80%报警,达到90%为严重危险
check_disk -w 80% -c 90% -p /dev/hda1 #-p后面接需要监控的硬盘分区,如果是SCSI硬盘就是sda1,当然此时被监控端的nrpe配置文件要进行相应的修改
其中check_disk主要是检查磁盘的未用空间。
2、修改nagios主机上被监控主机的配置文件
[root@rhel5 ~]# cat /usr/local/nagios/etc/services.cfg
define service{
use generic-service
host_name oracle
service_description check-disk
check_command check_nrpe!check_orcl
}
3、修改被监控主机上的nrpe配置文件
[root@rhel5 ~]# cat /usr/local/nagios/etc/nrpe.cfg command[check_orcl]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/mapper/vg_orcl-orcl
[oracle@rhel5 orcl]$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 7.8G 3.4G 4.1G 46% /
tmpfs 355M 196M 159M 56% /dev/shm
/dev/mapper/vg_orcl-orcl
15G 8.4G 5.6G 60% /u01
/dev/mapper/vg_mysql-mysql
1.9G 576M 1.3G 32% /mysql
查看一下页面:

拷贝一些文件到/u01目录下,再df -h查看一下:
[oracle@rhel5 oradata]$ df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 7.8G 3.4G 4.1G 46% /
tmpfs 355M 196M 159M 56% /dev/shm
/dev/mapper/vg_orcl-orcl
15G 12G 3.0G 80% /u01
/dev/mapper/vg_mysql-mysql
1.9G 576M 1.3G 32% /mysql
最后看一下页面:
Nagios监控磁盘的更多相关文章
- smartmontools的安装使用和实现对磁盘的Nagios监控
安装 首先从sourceforge下载最新的安装版本. 解压编译 $ tar -zxvf smartmontools-6.4.tar.gz $ cd smartmontools-6.4 $ ./con ...
- nagios监控mysql主机,nginx,磁盘IO,网卡流量
http://blog.chinaunix.net/uid-28685162-id-3506260.html nagios安装完成,打开/usr/local/nagios/etc/nagios.cfg ...
- 自定义nagios监控脚本---磁盘检测
自定义nagios监控脚本---磁盘检测 1. 在客户端上创建脚本/usr/local/nagios/libexec/check_disk.shvim /usr/local/nagios/libexe ...
- centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobackupex/Xtrabackup 第四十节课
centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobacku ...
- Nagios 监控
配置文件说明 文件名或目录名 用途 cgi.cfg 控制CGI访问的配置文件 nagios.cfg Nagios 主配置文件 resource.cfg 变量定义文件,又称为资源文件,在些文件中定义变量 ...
- nagios监控linux设置
本章主要用来设置nagios的相关配置文件,从而能实现对linux系统的监控. 在进行监控相关服务的时候,nagios会周期性的调用插件去监测服务器的状态,nagios自带的所有插件都放在如下目录: ...
- Nagios监控部署(转)
转自 http://kyhack.blog.51cto.com/490370/213355 ky.blog 一.nagios简介 nagios是一款用于系统和网络监控的应用程序,它可以在 ...
- linux Nagios监控
监控目标 监控目标主机分为四个部分 硬件资源 操作系统 数据库 应用软件 监控目的: 进行服务器性能调整前,知道调整什么,系统瓶颈在什么地方 被一部分必须同时监控,内容包括吞吐量,反应时间,使用率等 ...
- Nagios 监控系统架构
Nagios 监控系统架设全攻略 简介: Nagios 全名为(Nagios Ain’t Goona Insist on Saintood),最初项目名字是 NetSaint.它是一款免费的开源 IT ...
随机推荐
- Android中制作自定义dialog对话框的实例
http://www.jb51.net/article/83319.htm 这篇文章主要介绍了Android中制作自定义dialog对话框的实例分享,安卓自带的Dialog显然不够用,因而我们要继 ...
- Could not find class XXX referenced from method XXX.<YYY>
Since some ADT-Version you have to set which libraries / projects should be exported too. Project-Pr ...
- Android -- Looper.prepare()和Looper.loop() —深入版
Android中的Looper类,是用来封装消息循环和消息队列的一个类,用于在android线程中进行消息处理.handler其实可以看做是一个工具类,用来向消息队列中插入消息的. (1) Loope ...
- Java框架基础——反射(reflect)
一.Class类的使用 1)在面向对象(oop)的世界里,万事万物皆对象. 在Java中,包括基本的数据类型,都是对象. Class c = int.class;//int 的类类型 那就是说: 类是 ...
- javascript 函数返回值(return)、定时器(setTimeout、setInterval)
一.函数的返回值:return 1.函数名+括号=return后面的值 <script> function fn1(){ return 100; } alert(fn1()); // 10 ...
- The prefix "mx" for element "mx:WindowedApplication" is not bound.
<mx:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" > ......出现了错误The p ...
- 同一个主机上的JVM实例之间通信
hadoop yarn里用了RPC调用.NM里面文件本地化类ContainerLocalizer用RPC心跳方式跟本机的ResourceLocalizationService通信. 用shared m ...
- devexpress13学习系列(四)PDFViewer(4)
PdfViewer的属性: CurrentPageNumber:显示当前页的页码. DocumentFilePath:当前文件. DocumentProperties:文件属性. PageCount: ...
- 使用visual studio 2012 编译opencv2.4.9
最近,由于需要从opencv源码部分对opencv中的某个函数进行修改,以提升算法的速度,因此一直在尝试使用vs2012来编译opencv.期间不乏多次的失败.今天通过实验发现了自己编译的opencv ...
- 转:Python requests 快速入门
迫不及待了吗?本页内容为如何入门Requests提供了很好的指引.其假设你已经安装了Requests.如果还没有, 去 安装 一节看看吧. 首先,确认一下: ·Requests 已安装 ·Reques ...