设为首页 加入收藏

TOP

Zabbix--)客户端安装以及如何添加数据库的动态监控视图(一)
2014-11-23 23:25:57 来源: 作者: 【 】 浏览:14
Tags:Zabbix-- 客户端 安装 以及 如何 添加 数据库 动态 监控

前提条件:Zabbix服务器端已经安装好,并且运行正常。

1 需要下载zabbix客户端,安装客户端,才能打开10050端口

wget http://www.zabbix.com/downloads/2.0.8/zabbix_agents_2.0.8.linux2_6.amd64.tar.gz

添加Zabbix用户和组。

groupadd zabbix

useradd zabbix -g zabbix -s /sbin/nologin

2 解压缩

Tar –xvf zabbix_agents_2.0.8.linux2_6.amd64.tar.gz

Mv zabbix_agents_2.0.8.linux2_6.amd64 /usr/local/zabbix_2.0.8

[root@db-m2-slave-1 zabbix_2.0.8]# ll

总用量 296

drwxr-xr-x. 2 root root 4096 4月 26 13:06 bin

drwxr-xr-x. 3 root root 4096 4月 26 15:20 conf

drwxr-xr-x. 2 root root 4096 4月 26 14:27 sbin

-rw-r--r--. 1 root root 288810 9月 10 2013 zabbix_agents_2.0.8.linux2_6_23.amd64.tar.gz

[root@db-m2-slave-1 zabbix_2.0.8]#

3 启动

[root@db-m2-slave-1 sbin]# nohup /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start -c & > zabbix.log

[1] 18785

[root@db-m2-slave-1 sbin]# nohup: 忽略输入并把输出追加到"nohup.out"

[root@db-m2-slave-1 sbin]# more nohup.out

zabbix_agentd [18584]: cannot open config file [/usr/local/etc/zabbix_agentd.conf]: [2] No such file or directory

zabbix_agentd [18785]: zbx_option requires an argument -- c

usage: zabbix_agentd [-Vhp] [-c ] [-t ]

报错加载不了配置文件,建立软连接

ln -s /usr/local/zabbix_2.0.8/conf/zabbix_agentd.conf /usr/local/etc/zabbix_agentd.conf

再次启动

[root@db-m2-slave-1 sbin]# nohup /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start & > zabbix.log

[1] 18920

[root@db-m2-slave-1 sbin]# nohup: 忽略输入并把输出追加到"nohup.out"

[1]+ Done nohup /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start

[root@db-m2-slave-1 sbin]#

4 最终查看启动日志信息,没有最新记录,表示启动成功了。

[root@db-m2-slave-1 sbin]# more nohup.out

zabbix_agentd [18811]: zbx_option requires an argument -- c

usage: zabbix_agentd [-Vhp] [-c ] [-t ]

zabbix_agentd [18826]: user zabbix does not exist

zabbix_agentd [18826]: cannot run as root!

5 查看zabbix_agent启动后台进程

[root@db-m2-slave-1 sbin]# ps -eaf|grep zabbix

zabbix 18922 1 0 13:21 00:00:00 /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start

zabbix 18923 18922 0 13:21 00:00:00 /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start

zabbix 18924 18922 0 13:21 00:00:00 /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start

zabbix 18925 18922 0 13:21 00:00:00 /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start

zabbix 18926 18922 0 13:21 00:00:00 /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start

zabbix 18927 18922 0 13:21 00:00:00 /usr/local/zabbix_2.0.8/sbin/zabbix_agentd start

root 18947 8652 0 13:21 pts/0 00:00:00 grep zabbix

6 自动添加启动脚本

ln -s /usr/local/zabbix_2.0.8/sbin/zabbix_agentd /etc/init.d/zabbix_agentd

chmod 755 /etc/init.d/zabbix_agentd

[root@db-m2-slave-1 sbin]# chkconfig --add zabbix_agentd

zabbix_agentd 服务不支持 chkconfig

chkconfig -- level 345 zabbix_agentd on

[root@db-m2-slave-1 sbin]# chkconfig --level 345 zabbix_agentd on

zabbix_agentd 服务不支持 chkconfig

[root@db-m2-slave-1 sbin]#

失败

7 关闭zabbix_agentd进程

killall -9 zabbix_agentd

8添加自定义监控

8.1在数据库HOST上面,修改vi /usr/local/etc/zabbix_agentd.conf

UnsafeUserParameters=1 此处默认是0(不允许自定义脚本)

然后在后面添加UserParameter=key,command

key,command 为格式

此处key 是在创建item 的时候填写的

在这里面添加如下监控项:

UnsafeUserParameters=1

UserParameter=mysql.ping_test[*],mysqladmin -u$1 -p$2 ping|grep alive|wc –l

8.2重新启动 zabbix_agentd服务。

8.3 check服务

[root@cache-2 zabbix]# /usr/local/zabbix/bin/zabbix_get -s 10.254.3.72 -k mysql.ping_test['root','']

0

一直是0,但是在数据库服务器的机器上执行mysqladmin返回是1

[root@db-m2-slave-1

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇关于undo表空间配置错误的ORA-300.. 下一篇JBossDataGrid的集群部署与访问

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: