我们首先来安装基于Linux的Zabbix的客户端安装
1.首先修改计算机的主机名字;其实计算机名字也不用修改都可以
[root@localhost ~]# hostname Zabbix-Agent01 [root@localhost ~]# cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=Zabbix-Agent01 [root@localhost ~]#
2.创建用户 useradd -s /sbin/nologin zabbix
3.下载解压客户端 下载可以去zabbix官方下载www.zabbix.com 需要注意的是:在2.0后客户端安装的时候,会解压三个文件,sbin conf bin;然后我们把解压的三个目录复制到我们创建的zabbix目录下面 [root@localhost home]# tar xf zabbix_agents_2.0.8.linux2_6.amd64.tar.gz [root@localhost home]# ls bin install-mount.sh lost found zabbix conf install-source.sh sbin zabbix_agents_2.0.8.linux2_6.amd64.tar.gz [root@localhost home]# mkdir /usr/local/zabbix [root@localhost home]# cp -a bin/ sbin/ conf/ /usr/local/zabbix/ [root@localhost home]#
4.配置zabbix客户端的端口 在配置文件vim /etc/services中添加如下内容 #####################zabbix agents############# zabbix-agent 10050/tcp #Zabbix Agent zabbix-agent 10050/udp #Zabbix Agent 如果客户端防火墙没有关闭,可以添加Zabbix的端口
5.修改zabbix客户端的配置文件;我们从服务器上把配置文件复制过来 [root@localhost etc]# pwd /usr/local/etc [root@localhost etc]# scp root@192.168.100.239:/usr/local/zabbix/etc/zabbix_agentd.conf /usr/local/etc/ root@192.168.100.239's password: zabbix_agentd.conf 100% 5707 5.6KB/s 00:00 [root@localhost etc]# ls zabbix_agentd.conf [root@localhost etc]#
5.1.然后修改配置文件中两个地方 Server=192.168.100.239 Zabbix服务器的IP地址 Hostname=Zabbix-Agent01 Zabbix客户端的计算机名字
6.设置Zabbix的启动脚本 [root@localhost etc]# cp -a /usr/local/zabbix/sbin/zabbix_agentd /etc/init.d/ [root@localhost etc]# chmod x /etc/init.d/zabbix_agentd [root@localhost etc]# echo "/etc/rc.d/init.d/zabbix_agentd" >> /etc/rc.local [root@localhost etc]# /etc/rc.d/init.d/zabbix_agentd start 如果因为系统zabbix的客户端脚本没有状态可以从服务器上拷贝一个过来 [root@Zabbix-Server ~]# scp /etc/rc.d/init.d/zabbix_agentd root@192.168.100.240:/etc/rc.d/init.d/ The authenticity of host '192.168.100.240 (192.168.100.240)' can't be established. RSA key fingerprint is 20:cb:cd:4d:47:75:81:8f:fd:c2:89:11:72:a6:83:25. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.100.240' (RSA) to the list of known hosts. root@192.168.100.240's password: zabbix_agentd 100% 2177 2.1KB/s 00:00 [root@Zabbix-Server ~]#
7.查看状态 [root@localhost sbin]# ps -ef | grep zabbix_agentd zabbix 23167 1 0 23:45 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd zabbix 23168 23167 0 23:45 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd zabbix 23169 23167 0 23:45 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd zabbix 23170 23167 0 23:45 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd zabbix 23171 23167 0 23:45 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd zabbix 23172 23167 0 23:45 ? 00:00:00 /usr/local/zabbix/sbin/zabbix_agentd root 23176 22786 0 23:46 pts/0 00:00:00 grep zabbix_agentd [root@localhost sbin]#
8.服务器测试键值KEY [root@dota-db-10 ~]# /usr/local/bin/zabbix_get -s 112.124.60.147 -p 10050 -k "net.tcp.listen[5150]" 1