linux下监控是否有IO

JDU:/host-001e67a8d50b /log/today # inotifywait -h
inotifywait 3.14
Wait for a particular event on a file or set of files.
Usage: inotifywait [ options ] file1 [ file2 ] [ file3 ] [ ... ]
Options:
	-h|--help     	Show this help text.
	@<file>       	Exclude the specified file from being watched.
	--exclude <pattern>
	              	Exclude all events on files matching the
	              	extended regular expression <pattern>.
	--excludei <pattern>
	              	Like --exclude but case insensitive.
	-m|--monitor  	Keep listening for events forever.  Without
	              	this option, inotifywait will exit after one
	              	event is received.
	-d|--daemon   	Same as --monitor, except run in the background
	              	logging events to a file specified by --outfile.
	              	Implies --syslog.
	-r|--recursive	Watch directories recursively.
	--fromfile <file>
	              	Read files to watch from <file> or `-‘ for stdin.
	-o|--outfile <file>
                        Print events to <file> rather than stdout.
	-s|--syslog   	Send errors to syslog rather than stderr.
	-q|--quiet    	Print less (only print events).
	-qq           	Print nothing (not even events).
	--format <fmt>	Print using a specified printf-like format
	              	string; read the man page for more details.
	--timefmt <fmt>	strftime-compatible format string for use with
	              	%T in --format string.
	-c|--csv      	Print events in CSV format.
        -t|--timeout <seconds>
	              	When listening for a single event, time out after
	              	waiting for an event  for <seconds> seconds.
	              	If <seconds> is 0, inotifywait will never time out.
	-e|--event <event1> [ -e|--event  <event2> ... ]
		Listen for specific event(s).  If omitted, all events are
		listened for.
        Exit status:
	0  -  An event you asked to watch for was received.
	1  -  An event you did not ask to watch for was received
	2  -  The --timeout option was given and no events occurred
	      in the specified interval of time.
Events:
	access		file or directory contents were read
	modify		file or directory contents were written
	attrib		file or directory attributes changed
        close_write	file or directory closed, after being opened in writable mode
	close_nowrite	file or directory closed, after being opened in read-only mode
        close		file or directory closed, regardless of read/write mode
	open		file or directory opened
	moved_to	file or directory moved to watched directory
	moved_from	file or directory moved from watched directory
        move		file or directory moved to or from watched directory
	create		file or directory created within watched directory
	delete		file or directory deleted within watched directory
	delete_self	file or directory was deleted
	unmount		file system containing file or directory unmounted
时间: 2024-10-10 14:55:27

linux下监控是否有IO的相关文章

linux下监控jvm 使用的方法

之前一直用jconsole监控jvm,图形界面简单易用,最近因为需要在纯linux下进行操作,所以总结了一下 linux下监控jvm的例子,这次主要用到了jstat工具, 各个参数意义: jstat -class pid:显示加载class的数量,及所占空间等信息. jstat -compiler pid:显示VM实时编译的数量等信息. jstat -gc pid:可以显示gc的信息,查看gc的次数,及时间.其中最后五项,分别是young gc的次数,young gc的时间,full gc的次数

linux下监控用户操作记录的工具

linux下监控用户操作记录的工具: apt-get install bsdutils mkdir /opt/operation_log chmod 777 -R /opt/operation_log vi /etc/profile exec script -t 2> /opt/operation_log/$USER-$UID-date +%F-%T.data -a -q -f /opt/operation_log/$USER-$UID-date +%F-%T.log :wq source /e

Linux下的五种IO模型

5种IO模型 Linux下五种IO模型 (1)阻塞I/O:什么都不干,导致应用程序阻塞,等待数据准备好,如果数据没有准备好,一直阻塞,等数据准备好了从内核拷贝到用户空间 (2)非阻塞I/O:把一个套接字接口设置为非阻塞,告诉内核,当所请求的IO无法完成时,不要将进程睡眠,而是返回一个错误,这样IO操作函数会不断地测试数据是否准备好,如果没有准备好 ,继续测试,直到准备好为止 (3)I/O复用(select epoll):select或epoll会使进程阻塞,但是和阻塞IO不同的是,这两个函数可以

linux下监控用户的操作记录

想知道用户登陆系统后都操作了什么,怎么办? 别急,linux下有一个script工具,专门记录终端会话中所有输入输出结果,并存放到指定文件中. 先看看怎么录制吧! 1.创建日志存放目录 # mkdir /opt/operation_log # chmod 777 -R /opt/operation_log 2.设置用户登陆后自动录制 # vi /etc/profile   #末尾追加一下内容 if [ $UID -ge 500 ]; then    exec script -t 2>/opt/o

Linux下监控磁盘使用量并在超过阀值后自动发送报警邮件

最近Linux服务器磁盘使用量经常到100%,直到影响到正常服务出现故障才会去注意,做不到防患于未然,今天在网上搜集了资料,加上自己修改,写了一个shell脚本用于实时监控磁盘使用量并在超过阀值后自动发送报警邮件. 脚本简单说明:用df命令查看磁盘使用量信息,超过脚本设置的阀值(critical=90)90%,就会自动用sendEmail命令发送报警邮件(邮件smtp.email等需自行修改成真实存在的). 1.首先下载监测脚本(点击下载)或直接复制下面脚本代码存为disk_check.sh文件

linux下监控某个目录是否被更改

需求:对一个目录(比如/data/test)进行监控,当这个目录下文件或子目录出现变动(如修改.创建.删除.更名等操作)时,就发送邮件!针对上面的需求,编写shell脚本如下: [[email protected] opt]# vim file_monit.sh #!/bin/bash #此脚本用于检测linux系统重要文件是否被改动,如果改动则用邮件报警 #建议用定时任务执行此脚本,如每5分钟执行一次,也可修改此脚本用于死循环检测 #Ver:1.0 #http://www.cnblogs.co

Linux性能监控——CPU,Memory,IO,Network

版权声明:本文由刘爽原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/107 来源:腾云阁 https://www.qcloud.com/community 一.CPU 1.良好状态指标 CPU利用率:User Time <= 70%,System Time <= 35%,User Time + System Time <= 70%. 上下文切换:与CPU利用率相关联,如果CPU利用率状态良好,大量的上下文切换也是

linux下监控命令

vmstat -n 3 PROC(ESSES)--r:如果在processes中运行的序列(process r)是连续的大于在系统中的CPU的个数表示系统现在运行比较慢,有多数的进程等待CPU.如果r的输出数大于系统中可用CPU个数的4倍的话,则系统面临着CPU短缺的问题,或者是CPU的速率过低,系统中有多数的进程在等待CPU,造成系统中进程运行过慢.SYSTEM--in:每秒产生的中断次数--cs:每秒产生的上下文切换次数上面2个值越大,会看到由内核消耗的CPU时间会越大 CPU-us:用户进

Linux下监控简介

1.磁盘IO监控工具 iotop 输入命令:iotop   主要查看程序使用的磁盘IO的信息 安装:yum -y install iotop 第一行:10:01:23 - 当前系统时间126 days, 14:29 - 系统已经运行了126天14小时29分钟(在这期间没有重启过)2 users - 当前有2个用户登录系统load average: 1.15, 1.42, 1.44 - load average后面的三个数分别是1分钟.5分钟.15分钟的负载情况. 第二行:Tasks - 任务(进