页面“Zabbix如何监控进程或端口”与“Cannot access Input/output error”之间的差异

来自linux中国网wiki
(页面间的差异)
跳到导航 跳到搜索
 
 
第1行: 第1行:
 
+
=trouble=
 
 
 
 
 
 
 
 
== 监控进程==
 
zabbix进程监控  监控Rsync 进程
 
 
 
===zabbix monitor===
 
 
<pre>
 
<pre>
1、主机下新建监控项
+
内网机器 PHP的人 随便重启,然后机器再起来出事了
 
+
ls /home
配置--主机--点击主机监控项--创建监控项-
+
cannot access Input/output error
 
 
名称-Rsync-proc
 
 
 
类型-zabbix客户端
 
 
 
键值-proc.num[,root,all,rsyncd]
 
  
信息类型-数字(无正负)
+
和乱码
 +
d??????????  ? ?    ?        ?            ? home
  
数据类型-十进位数字
 
 
应用集-Processes
 
 
如图
 
 
</pre>
 
</pre>
[[文件:Zabbixpro.png]]
+
=shooting=
 
<pre>
 
<pre>
PRONAME=flume
+
lsof  | grep home
num=`ps -ef|grep java|grep $PRONAME|wc -l`
+
有关home分区的程序先kill掉
 
zabbix_get -s 118.89.28.39  -p10050 -k ""
 
 
zabbix_get -s 118.89.28.39 -p 10050 -k "proc.num[,root,all,flume]"
 
zabbix_get -s 118.89.28.39 -p 10050 -k "proc.num[,root,all,salt-minion]"
 
 
ssdb
 
zabbix_get -s 123.207.227.123 -p 10050 -k "proc.num[,root,all,ssdb]"
 
  
zabbix_get -s 118.89.28.39 -p 10050 -k "proc.num[,root,all,ssdb]"
 
  
 +
然后关掉机器 ,再硬重启 
 +
如果不行就得 
 +
fsck
  
 +
例如如果上面的 /home  at  /dev/sda1
 +
1.应该是采用  修复命令  fsck 
 +
fsck -s /dev/sda1
 +
意外断电导致/dev/sda1分区的文件系统崩溃,所以针对这个分区进行修复,如果其他分区也出现类似情况,可以进行全盘修复
 +
  
 +
2.机器重启
  
2、创建触发器
 
 
配置--主机--点击主机触发器--创建触发器
 
 
名称--    Rsync-Server-Proc on server{HOST.NAME}
 
 
表达式--  {ad-admin:proc.num[,root,all,rsyncd].last()}=0
 
 
表达式--可以使用添加--选择刚刚添加的监控项--然后选择值
 
 
 
zabbix_get -s 11.8.0.22 -p 10050 -k "proc.num[,root,all,rsyncd]" 可以使用这个命令去或者服务器端口当前的值,然后判断
 
 
 
 
 
 
 
 
名称:ssdb-Server-Proc on server{HOST.NAME}
 
 
#选择就行了不用手工写
 
表达式: {da_123.207.227.123:proc.num[,root,all,ssdb].last()}=0
 
 
 
 
{ad-admin:proc.num[,root,all,rsyncd].last()}=0
 
</pre>
 
 
==监控端口==
 
 
===zabbix server monitor ===
 
<pre>
 
1、主机下新建监控项
 
 
zabbix监控端口
 
使用zabbix的item中的key来做端口
 
 
监控进程的key
 
net.tcp.listen[port]
 
 
key对应的释义
 
Checks if this TCP port is in LISTEN state. Returns 0 - it is not in LISTEN state; 1 - it is in LISTEN state
 
检测tcp端口的状态,监听中返回1,未监听返回0
 
 
示例中的key值配置
 
net.tcp.listen[3307]
 
 
zabbix中item的配置如下:
 
</pre>
 
[[文件:zabport1.png]]
 
 
[[文件:esport.png]]
 
<pre>
 
2、创建触发器
 
报警设置当然也用zabbix的trigger
 
 
相应的trigger对应的Expression如下:
 
{test_agentd:net.tcp.listen[3307].last(0)}=0
 
  
zabbix中trigger的配置如下:
 
 
</pre>
 
</pre>
[[文件:zabport2.png]]
+
=see also=
<pre>
+
[https://unix.stackexchange.com/questions/39905/input-output-error-when-accessing-a-directory “Input/output error” when accessing a directory]
加上zabbix邮件报警,你就可以停掉对应的进程或者端口来检测是否达到预期期望,即触发了trigger,而后发送报警邮件。
 
</pre>
 
 
 
==参考==
 
[https://wing324.github.io/2016/05/31/zabbix%E5%A6%82%E4%BD%95%E7%9B%91%E6%8E%A7%E8%BF%9B%E7%A8%8B%E6%88%96%E7%AB%AF%E5%8F%A3/ zabbix如何监控进程或端口]
 
 
 
[http://yangrong.blog.51cto.com/6945369/1548670 原来zabbix监控进程与端口是如此的简单]
 
 
 
 
 
[https://www.cnblogs.com/netsa/p/7783518.html zabbix 客户端添加自定义参数]
 
 
 
http://www.centos.ws/?p=59
 
 
zabbix监控进程
 
http://825536458.blog.51cto.com/4417836/1877829
 
 
zabbix监控mysql主从
 
http://825536458.blog.51cto.com/4417836/1775341
 
 
 
  
[[category:zabbix]]
+
[https://www.cnblogs.com/Alanf/p/7509268.html cannot access Input/output error]

2020年2月18日 (二) 08:27的版本

trouble

 内网机器 PHP的人 随便重启,然后机器再起来出事了 
ls /home 
cannot access Input/output error

和乱码
d??????????   ? ?    ?        ?            ? home

shooting

lsof  | grep home 
有关home分区的程序先kill掉 


然后关掉机器 ,再硬重启  
如果不行就得  
fsck

例如如果上面的 /home  at  /dev/sda1
1.应该是采用  修复命令  fsck  
fsck -s /dev/sda1
意外断电导致/dev/sda1分区的文件系统崩溃,所以针对这个分区进行修复,如果其他分区也出现类似情况,可以进行全盘修复
 

2.机器重启 


see also

“Input/output error” when accessing a directory

cannot access Input/output error