httpd mysql_监控MySQL服务及httpd服务

dbd6814b99e61449e7614406e36244ab.png

f3dbdf19d59243247eebb3cbe0e12583.png

2aae4b239b19a0939936f42f34619614.png

5381ebbd9fae748a6c8765ab66a14dfc.png

9f34e09624bd2419f650bb2a127cb30e.png

二:监控httpd服务

[root@server etc]# vim /usr/local/zabbix/etc/zabbix_agentd.conf

PidFile=/tmp/zabbix_agentd.pid

Server=127.0.0.1,192.168.200.11

ServerActive=192.168.200.11

stname=server.zabbix.com

LogFile=/usr/local/zabbix/logs/zabbix_agentd.log

Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf

UnsafeUserParameters=1

UserParameter=mysql.version,mysql -v

UserParameter=mysql.status[*],/usr/local/zabbix/etc/chk_mysql.sh $1

UserParameter=mysql.ping,mysqladmin -uroot -p123123 -P3306 -h192.168.200.11 ping | grep -c a

live

UserParameter=httpd.status,/usr/local/zabbix/etc/chk_httpd.sh                 #添加一条引用httpd的脚本

[root@server etc]# vim chk_httpd.sh                                      #准备脚本

#!/bin/bash

#检查httpd服务是否正常运行,正常输出1不正常输出2

netstat -lnupt | grep -q :80

if [ $? -eq 0 ];then

echo "1"

else

echo "0"

fi

~

[root@server etc]# chmod 777 chk_httpd.sh            #给脚本加权限

#重启zabbix_agentd服务

[root@server etc]# killall -9 zabbix_agentd

[root@server etc]# zabbix_agentd

[root@server etc]# /usr/local/zabbix/bin/zabbix_get -s 192.168.200.11 -k httpd.status

(Not all processes could be identified, non-owned process info

will not be shown, you would have to be root to see it all.)

1

[root@server etc]# which netstat

/usr/bin/netstat

[root@server etc]# chmod u+s /usr/bin/netstat

[root@server etc]# /usr/local/zabbix/bin/zabbix_get -s 192.168.200.11 -k httpd.status

1

2d877eda0696f24b59f854176be49055.png

6abae0e6811ee51a3ba5f66284413fe3.png

b8d05e1a7acc46aca421a260e819ba2d.png

添加图形

68f724bad5a33d9a9f6bd2ca7369ecb7.png

23ce93191b279361816f7c641d0c96f8.png

0688b8b32de2832b5d132db41e495fae.png

创建触发器

86178bb3ac9812c1e19932d3ad691184.png

205d6676e15b29abf60746f18245852b.png

8f0e46b6c37cc417975fe43fd04c2c44.png

1884618ab1f61fa75b1fdc6dbb5c4a84.png

三:磁盘监控

[root@server ~]# vim /usr/local/zabbix/etc/zabbix_agentd.conf

PidFile=/tmp/zabbix_agentd.pid

Server=127.0.0.1,192.168.200.11

ServerActive=192.168.200.11

Hostname=server.zabbix.com

LogFile=/usr/local/zabbix/logs/zabbix_agentd.log

Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf

UnsafeUserParameters=1

UserParameter=mysql.version,mysql -v

UserParameter=mysql.status[*],/usr/local/zabbix/etc/chk_mysql.sh $1

UserParameter=mysql.ping,mysqladmin -uroot -p123123 -P3306 -h192.168.200.11 ping | grep -c alive

UserParameter=httpd.status,/usr/local/zabbix/etc/chk_httpd.sh

UserParameter=sdb1.used,df -hT| awk -F'[ %]' 'NR==7{ print $(NF-2)}'                                          #引入命令

#重启服务

[root@server ~]# killall -9 zabbix_agentd

[root@server ~]# zabbix_agentd

[root@server ~]# /usr/local/zabbix/bin/zabbix_get -s 192.168.200.11 -k sda1.used

17

bcd4cf5519e817bcc9403121dcbb1b11.png

6e81ae3562bb2ad6b273d05f248cf3fb.png

78b54f74da17a8ef6e7ae91ee41bf03e.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值