linux下安装配置zabbix以及配置mysql监控

俺现在正在使用的nagios+cacti组合,没有考虑上zabbix,但领导要求搞搞zabbix,没办法盛情难却。只有先搞了。只是把环境搞起来了。具体使用没怎么研究。测试了添加主机各一台linux和windows,由于使用的云主机。linux还算正常,但是zabbix有个发现规则,找出了很多网卡,禁用又很麻烦。哎,废话不多说了,先搞出来再说。

一 服务端配置
1.配置前先关闭iptables和SELINUX,避免安装过程中报错。

1

2

3

4


[root@zabbix ~]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@zabbix ~]# service iptables stop
iptables: Flushing firewall rules: [  OK  ]
iptables: Setting chains to policy ACCEPT: filter [  OK  ]
iptables: Unloading modules: [  OK  ]
[root@zabbix ~]# chkconfig iptables off
[root@zabbix ~]# getenforce
Disabled


2.安装LAMP环境
1

[root@zabbix ~]# yum install -y httpd mysql mysql-server mysql-devel php php-mysql php-common php-mbstring php-gd php-odbc php-xml php-pear

 

3.下载zabbix-2.0.6.tar.gz
1

root@zabbix ~]# wget http://sourceforge.net/projects/ ... 0.6.tar.gz/download

 

4.安装zabbix所需的组件(server,agent)
1

[root@zabbix ~]# yum install -y curl curl-devel net-snmp net-snmp-devel perl-DBI

 

5.创建用户账号(server,agent)
1

[root@zabbix ~]# usermod -s /sbin/nologin zabbix

 

6.创建zabbix数据库并导入zabbix数据库(server)
1

2

3

4

5


[root@zabbix ~]#tar zxf zabbix-2.0.6.tar.gz
[root@zabbix ~]#mysqladmin -u root password 123456
mysql> mysql -p123456
mysql> create database zabbix;
mysql> grant all on zabbix.* to zabbix@localhost identified by '123456';
mysql> use zabbix;
mysql> source /root/zabbix-2.0.6/database/mysql/schema.sql
mysql> source /root/zabbix-2.0.6/database/mysql/images.sql
mysql> source /root/zabbix-2.0.6/database/mysql/data.sql
mysql> exit

 

7.编译安装,如果是客户端安装选择--enable-agent就行了。
1

2

3

4

5

6

cd /root/zabbix-2.0.6
[root@zabbix zabbix-2.0.6]# ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
报错: checking for main in -lmysqlclient... no
      configure: error: Not found mysqlclient library
解决:[root@zabbix zabbix-2.0.6]# ln -s /usr/lib64/mysql/libmysqlclient.so.16 /usr/lib64/mysql/libmysqlclient.so
***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************
make install

 

8.编辑配置文件
1

2

3

4

5

6

7

8

9


[root@zabbix zabbix-2.0.6]# grep -vE '(^#|" "|^)' /usr/local/etc/zabbix_server.conf >> /usr/local/etc/zabbix_server.conf.bak
[root@zabbix etc]# cp zabbix_server.conf.bak zabbix_server.conf
[root@zabbix etc]# grep -vE '(^#|" "|^$)' zabbix_agentd.conf >> zabbix_agentd.conf.bak
[root@zabbix etc]# cp zabbix_agentd.conf.bak zabbix_agentd.conf
cp: overwrite `zabbix_agentd.conf'? y
[root@zabbix etc]# more zabbix_server.conf #服务端的配置
LogFile=/var/log/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
[root@zabbix etc]# more zabbix_agentd.conf #客户端配置
LogFile=/tmp/zabbix_agentd.log
Server=127.0.0.1
UnsafeUserParameters=1
[root@zabbix etc]# touch /var/log/zabbix_server.log
[root@zabbix etc]# touch /var/log/zabbix_agentd.log
[root@zabbix etc]# chmod 777 /var/log/zabbix_*

 

9.启动服务(server,agent)
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15


[root@zabbix zabbix-2.0.6]# cp misc/init.d/tru64/zabbix_server /etc/init.d/
[root@zabbix zabbix-2.0.6]# cp misc/init.d/tru64/zabbix_agentd /etc/init.d/
[root@zabbix zabbix-2.0.6]# chmod +x /etc/init.d/zabbix_*
在文件头部#!/bin/bash下面分别添加两行
#!/bin/sh
#chkconfig: 35 95 95
#description:zabbix Agent server
添加服务
[root@zabbix zabbix-2.0.6]# chkconfig --add zabbix_server
[root@zabbix zabbix-2.0.6]# chkconfig --add zabbix_agentd
设置服务器开机自动启动
[root@zabbix ~]# chkconfig zabbix_server on
[root@zabbix ~]# chkconfig zabbix_agentd on
[root@zabbix ~]# /etc/init.d/zabbix_server start
Zabbix server started.
[root@zabbix ~]# /etc/init.d/zabbix_agentd start
Zabbix agent started.
[root@zabbix ~]# ps -ef |grep zabbix
zabbix    1803     1  0 08:21 ?        00:00:00 /usr/local/sbin/zabbix_agentd
zabbix    1805  1803  0 08:21 ?        00:00:00 /usr/local/sbin/zabbix_agentd
zabbix    1806  1803  0 08:21 ?        00:00:00 /usr/local/sbin/zabbix_agentd
zabbix    1807  1803  0 08:21 ?        00:00:00 /usr/local/sbin/zabbix_agentd
zabbix    1808  1803  0 08:21 ?        00:00:00 /usr/local/sbin/zabbix_agentd
zabbix    1814     1  0 08:21 ?        00:00:00 /usr/local/sbin/zabbix_server
root      2043  2006  0 08:23 pts/0    00:00:00 grep zabbix
[root@zabbix ~]# netstat -lantp |grep 10050
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      1803/zabbix_agentd
[root@zabbix ~]# netstat -lantp |grep 10051
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      2308/zabbix_server

 

10.安装zabbix web界面(server)
复制php文件,zabbix的终端程序是用php写的,因此需要一个支持php脚本解析的web服务器。然后将frontends/php下面的php文件拷贝到web服务器html文件目录下面。
1

2

[root@zabbix zabbix-2.0.6]# cp -r frontends/php /var/www/html/zabbix
[root@zabbix html]# /etc/init.d/httpd restart #启动apache服务
Stopping httpd: [  OK  ]
Starting httpd: [  OK  ]

 

11.安装图示

1

2

3

4


[root@zabbix zabbix]# vi /etc/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = Asia/Shanghai
[root@zabbix zabbix]# /etc/init.d/httpd restart
Stopping httpd: [  OK  ]
Starting httpd: [  OK  ]

 

 

报错:根据提示修改/etc/php.ini文件里的参数
1

2


[root@zabbix zabbix]# yum install -y php-bcmath
[root@zabbix zabbix]# /etc/init.d/httpd restart
Stopping httpd: [  OK  ]
Starting httpd: [  OK  ]

 

 

 

 

搞定。。下面是改成中文,虽然翻译的不是很好,看着亲切啊。


二.WINDOWS客户端安装
1.官网上下载windows客户端zabbix

www.zabbix.com

2.拷贝到windows服务器上


解压后,如果是64位系统,则把\bin\win64\下面的三个文件拷贝到c:\zabbix目录下。如果是32位则同理
3.在c:\zabbix目录下新建zabbix_agentd.conf文件,添加以下内容
LogFile=c:\zabbix\zabbix_agentd.log #日志文件
Server=172.16.21.119      #服务端的IP
ListenIP=10.6.1.126      #客户端IP
Hostname=61      #客户端主机名
4.安装zabbix客户端


5.启动zabbix客户端

6.查看端口是否监听


三.服务端测试
1

[root@10-6-8-200 ~]# zabbix_get  -s 10.6.2.227 -k agent.ping
1

 


测试OK

系统环境:CentOS 6.3 x64  http://www.linuxidc.com/Linux/2012-12/76583.htm

mysql:    mysql-5.6.10 http://www.linuxidc.com/Linux/2013-02/79162.htm

zabbix:  zabbix-2.06

一.修改mysql客户端zabbix_agentd.conf配置:


# vi /usr/local/etc/zabbix_agentd.conf

这里注意mysql账号密码与你的数据库账户需对应

末行添加如下内容:

-----------------

UserParameter=mysql.Ping,mysqladmin -uroot -p123456  ping|grep alive|wc -l

UserParameter=mysql.Threads,mysqladmin -uroot -p123456  status|cut -f3 -d":"|cut -f1 -d"Q"

UserParameter=mysql.Questions,mysqladmin -uroot -p123456  status|cut -f4 -d":"|cut -f1 -d"S"

UserParameter=mysql.Slowqueries,mysqladmin -uroot -p123456  status|cut -f5 -d":"|cut -f1 -d"O"

UserParameter=mysql.Qps,mysqladmin -uroot -p123456  status|cut -f9 -d":"

 


UserParameter=mysql.Slave_IO_State,if [ "$(mysql -uroot -p123456  -e "show slave status\G"| grep Slave_IO_Running|awk '{print $2}')" == "Yes" ];then echo 1; else echo 0;fi

UserParameter=mysql.Slave_SQL_State,if [ "$(mysql -uroot -p123456  -e "show slave status\G"| grep Slave_SQL_Running|awk '{print $2}')" == "Yes" ];then echo 1; else echo 0;fi

 


UserParameter=mysql.Key_buffer_size,mysql -uroot -p123456  -e "show variables like 'key_buffer_size';"| grep -v Value |awk '{print $2/1024^2}'

UserParameter=mysql.Key_reads,mysql -uroot -p123456  -e "show status like 'key_reads';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Key_read_requests,mysql -uroot -p123456  -e "show status like 'key_read_requests';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Key_cache_miss_rate,echo $(mysql -uroot -p123456  -e "show status like 'key_reads';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'key_read_requests';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}'

 

 

 

UserParameter=mysql.Key_blocks_used,mysql -uroot -p123456  -e "show status like 'key_blocks_used';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Key_blocks_unused,mysql -uroot -p123456  -e "show status like 'key_blocks_unused';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Key_blocks_used_rate,echo $(mysql -uroot -p123456  -e "show status like 'key_blocks_used';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'key_blocks_unused';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/($1+$2)*100)}'

 

 

 

UserParameter=mysql.Innodb_buffer_pool_size,mysql -uroot -p123456  -e "show variables like 'innodb_buffer_pool_size';"| grep -v Value |awk '{print $2/1024^2}'

UserParameter=mysql.Innodb_log_file_size,mysql -uroot -p123456  -e "show variables like 'innodb_log_file_size';"| grep -v Value |awk '{print $2/1024^2}'

UserParameter=mysql.Innodb_log_buffer_size,mysql -uroot -p123456  -e "show variables like 'innodb_log_buffer_size';"| grep -v Value |awk '{print $2/1024^2}'

 


UserParameter=mysql.Table_open_cache,mysql -uroot -p123456  -e "show variables like 'table_open_cache';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Open_tables,mysql -uroot -p123456  -e "show status like 'open_tables';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Opened_tables,mysql -uroot -p123456  -e "show status like 'opened_tables';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Open_tables_rate,echo $(mysql -uroot -p123456  -e "show status like 'open_tables';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'opened_tables';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/($1+$2)*100)}'

UserParameter=mysql.Table_open_cache_used_rate,echo $(mysql -uroot -p123456  -e "show status like 'open_tables';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show variables like 'table_open_cache';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/($1+$2)*100)}'

 

 

 

UserParameter=mysql.Thread_cache_size,mysql -uroot -p123456  -e "show variables like 'thread_cache_size';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Threads_cached,mysql -uroot -p123456  -e "show status like 'Threads_cached';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Threads_connected,mysql -uroot -p123456  -e "show status like 'Threads_connected';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Threads_created,mysql -uroot -p123456  -e "show status like 'Threads_created';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Threads_running,mysql -uroot -p123456  -e "show status like 'Threads_running';"| grep -v Value |awk '{print $2}'

 


UserParameter=mysql.Qcache_free_blocks,mysql -uroot -p123456  -e "show status like 'Qcache_free_blocks';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Qcache_free_memory,mysql -uroot -p123456  -e "show status like 'Qcache_free_memory';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Qcache_hits,mysql -uroot -p123456  -e "show status like 'Qcache_hits';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Qcache_inserts,mysql -uroot -p123456  -e "show status like 'Qcache_inserts';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Qcache_lowmem_prunes,mysql -uroot -p123456  -e "show status like 'Qcache_lowmem_prunes';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Qcache_not_cached,mysql -uroot -p123456  -e "show status like 'Qcache_not_cached';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Qcache_queries_in_cache,mysql -uroot -p123456  -e "show status like 'Qcache_queries_in_cache';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Qcache_total_blocks,mysql -uroot -p123456  -e "show status like 'Qcache_total_blocks';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Qcache_fragment_rate,echo $(mysql -uroot -p123456  -e "show status like 'Qcache_free_blocks';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'Qcache_total_blocks';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}'

UserParameter=mysql.Qcache_used_rate,echo $(mysql -uroot -p123456  -e "show variables like 'query_cache_size';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'Qcache_free_memory';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",($1-$2)/$1*100)}'

UserParameter=mysql.Qcache_hits_rate,echo $(mysql -uroot -p123456  -e "show status like 'Qcache_hits';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'Qcache_inserts';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",($1-$2)/$1*100)}'

 

 

 

UserParameter=mysql.Query_cache_limit,mysql -uroot -p123456  -e "show variables like 'query_cache_limit';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Query_cache_min_res_unit,mysql -uroot -p123456  -e "show variables like 'query_cache_min_res_unit';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Query_cache_size,mysql -uroot -p123456  -e "show variables like 'query_cache_size';"| grep -v Value |awk '{print $2}'

 


UserParameter=mysql.Sort_merge_passes,mysql -uroot -p123456  -e "show status like 'Sort_merge_passes';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Sort_range,mysql -uroot -p123456  -e "show status like 'Sort_range';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Sort_rows,mysql -uroot -p123456  -e "show status like 'Sort_rows';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Sort_scan,mysql -uroot -p123456  -e "show status like 'Sort_scan';"| grep -v Value |awk '{print $2}'

 


UserParameter=mysql.Handler_read_first,mysql -uroot -p123456  -e "show status like 'Handler_read_first';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Handler_read_key,mysql -uroot -p123456  -e "show status like 'Handler_read_key';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Handler_read_next,mysql -uroot -p123456  -e "show status like 'Handler_read_next';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Handler_read_prev,mysql -uroot -p123456  -e "show status like 'Handler_read_prev';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Handler_read_rnd,mysql -uroot -p123456  -e "show status like 'Handler_read_rnd';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Handler_read_rnd_next,mysql -uroot -p123456  -e "show status like 'Handler_read_rnd_next';"| grep -v Value |awk '{print $2}'

 


UserParameter=mysql.Com_select,mysql -uroot -p123456  -e "show status like 'com_select';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Com_insert,mysql -uroot -p123456  -e "show status like 'com_insert';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Com_insert_select,mysql -uroot -p123456  -e "show status like 'com_insert_select';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Com_update,mysql -uroot -p123456  -e "show status like 'com_update';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Com_replace,mysql -uroot -p123456  -e "show status like 'com_replace';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Com_replace_select,mysql -uroot -p123456  -e "show status like 'com_replace_select';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Table_scan_rate,echo $(mysql -uroot -p123456  -e "show status like 'Handler_read_rnd_next';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'com_select';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}'

 

 

 

UserParameter=mysql.Open_files,mysql -uroot -p123456  -e "show status like 'open_files';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Open_files_limit,mysql -uroot -p123456  -e "show variables like 'open_files_limit';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Open_files_rate,echo $(mysql -uroot -p123456  -e "show status like 'open_files';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show variables like 'open_files_limit';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}'

 

 

 

UserParameter=mysql.Created_tmp_disk_tables,mysql -uroot -p123456  -e "show status like 'created_tmp_disk_tables';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Created_tmp_tables,mysql -uroot -p123456  -e "show status like 'created_tmp_tables';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Created_tmp_disk_tables_rate,echo $(mysql -uroot -p123456  -e "show status like 'created_tmp_disk_tables';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'created_tmp_tables';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}'

 

 

 

UserParameter=mysql.Max_connections,mysql -uroot -p123456  -e "show variables like 'max_connections';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Max_used_connections,mysql -uroot -p123456  -e "show status like 'Max_used_connections';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Max_connections_used_rate,echo $(mysql -uroot -p123456  -e "show status like 'Max_used_connections';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show variables like 'max_connections';"| grep -v Value |awk '{print $2}')| awk '{printf("%1.4f\n",$1/$2*100)}'

 

 

 

UserParameter=mysql.Table_locks_immediate,mysql -uroot -p123456  -e "show status like 'Table_locks_immediate';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Table_locks_waited,mysql -uroot -p123456  -e "show status like 'table_locks_waited';"| grep -v Value |awk '{print $2}'

UserParameter=mysql.Engine_select,echo $(mysql -uroot -p123456  -e "show status like 'Table_locks_immediate';"| grep -v Value |awk '{print $2}') $(mysql -uroot -p123456  -e "show status like 'table_locks_waited';"| grep -v Value |awk '{print $2}')| awk '{printf("%5.4f\n",$1/$2)}'

 

二.访问zabbix web后台导入模板

1.访问zabbix-配置-模板,点击右上角的载入:

 

 

 

2.本地导入文件:

下载本博附件mysql_template.xml文件导入zabbix模板,点击载入保存

 

3.访问zabbix-配置-模板,查看模板:

 

4.访问zabbix-配置-主机-Zabbix server,找到apache客户端关联mysql_template.xml模版:

 

 

 

 

 

重启zabbix_agentd服务

# /etc/init.d/zabbix_agentd restart

 

添加完毕,查看效果

 

 

 

 

zabbix agent配置文件 与 mysql模板 下载地址:

免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com

具体下载目录在 /2013年资料/5月/24日/CentOS 6.3下Zabbix监控MySQL数据库参数

 安装zabbix agent客户端

1.下载
http://cdnetworks-kr-2.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.1/zabbix-2.0.1.tar.gz
http://www.zabbix.com/documentation/2.0/manual/installation
2.安装
2)创建用户

点击(此处)折叠或打开
groupadd zabbix
useradd -g zabbix zabbix


1)解压

点击(此处)折叠或打开
tar -zxvf zabbix-2.0.1.tar.gz
2)安装

点击(此处)折叠或打开
cd zabbix-2.0.1
./configure --prefix=/opt/zabbix_agent --enable-agent
make install


3)安装服务

点击(此处)折叠或打开
cat >>/etc/services<<EOF
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper
EOF


4)修改配置文件

点击(此处)折叠或打开
vi /opt/zabbix_agent/etc/zabbix_agent.conf

 修改Zabbix server的ip
Server=127.0.0.1 #若本机不是server,则修改
 
5)创建服务
 

点击(此处)折叠或打开
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
chmod a+x /etc/init.d/zabbix_*

* 修改 /etc/init.d/zabbix_agentd 变量定义:

点击(此处)折叠或打开
BASEDIR=/opt/zabbix_agent
FULLPATH=$BASEDIR/sbin/$BINARY_NAME
#configuration file
CONF_FILE=$BASEDIR/etc/zabbix_agentd.conf
action $"Starting $BINARY_NAME: " $FULLPATH -c $CONF_FILE

6)启动

点击(此处)折叠或打开
service zabbix_agentd start
ps ax|grep zabbix_agentd

 

7)添加到系统目录

点击(此处)折叠或打开
ln -s /opt/zabbix_agent/sbin/* /usr/local/sbin/
ln -s /opt/zabbix_agent/bin/* /usr/local/bin/


8)测试,下面的命令需要在server端执行,其中127.0.0.1是agent的ip

点击(此处)折叠或打开
zabbix_get -s192.168.60.22 -p10050 -k"system.uptime"

 

 

 

 

 

你可能感兴趣的:(mysql,zabbix)