zabbix监控客户端安装
<div>
<h4 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:0px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;">
添加zabbix用户
</h4>
<pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">zabbix客户端程序会以该用户的身份启动
shell> groupadd zabbix
shell> useradd -r -g zabbix zabbix</code></pre>
<h4 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;">
zabbix 编译安装
</h4>
<pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">解压zabbix安装包
shell> tar zxvf zabbix-2.4.5.tar.gz
shell> cd zabbix-2.4.5/
编译安装zabbix
shell> ./configure --prefix=/usr/local/zabbix_agent --enable-agent
shell> make && make install
shell> ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/
shell> ln -s /usr/local/zabbix/bin/* /usr/local/bin/</code></pre>
<h4 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;">
zabbix 配置
</h4>
<pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">添加zabbix server端口
shell> grep zabbix /etc/services
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
shell> vi /usr/local/zabbix_agent/etc/zabbix_agentd.conf
==============================================================
Server=192.168.56.210
ServerActive=192.168.56.211:10051
DebugLevel=2
Include=/usr/local/etc/zabbix_agentd.conf.d/
UnsafeUserParameters=1 #允许自定义脚本
==============================================================</code></pre>
<h4 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;">
启动zabbix客户端
</h4>
<pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">添加zabbix到开机启动脚本并修改
shell> cp misc/init.d/fedora/zabbix_agentd /etc/init.d/
shell> /etc/init.d/zabbix_agentd start
Starting zabbix_agentd: [确定]
zabbix
服务器端执行
shell> zabbix_get -s192.168.56.211 -p10050 -k"system.uptime"
8748</code></pre>
<h4 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;">
添加自定义监控
</h4>
<p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:10px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;">
1、在配置文件里面添加如下监控项:
</p>
<pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">UserParameter=
mysql.status[*],mysql -u$1 -p$2 -e 'show global status' | grep Com_select | awk '{printf $$2}'
注意$$表示原shell含义</code></pre>
<p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:15px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;">
2、重新启动 zabbix_agentd服务
</p>
<p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:15px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;">
3、zabbix服务器端check服务
</p>
<pre style="orphans:2;text-align:-webkit-auto;margin-top:15px;margin-bottom:15px;padding:6px 10px;border:1px solid #CCCCCC;font-size:13px;font-family:Consolas, 'Liberation Mono', Courier, monospace;line-height:19px;overflow:auto;border-radius:3px;color:#333333;background-color:#F8F8F8;"><code style="margin:0px;padding:0px;border:none;font-size:12px;font-family:Consolas, 'Liberation Mono', Courier, monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:transparent;">/usr/local/zabbix/bin/zabbix_get -s 192.168.56.211 -k mysql.status['zabbix','123@qwe']
116611</code></pre>
<h4 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;">
服务器web配置Item
</h4>
<p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:10px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;">
Hosts --> items --> Create item<br />
Name : mysql.status<br />
Type :Zabbix agent<br />
Key : mysql.status['zabbix','123@qwe']<br />
其他根据需要做修改,保存
</p>
<h4 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border:0px;-webkit-font-smoothing:antialiased;font-size:18px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;">
配置graph
</h4>
<p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:10px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;">
Hosts --> graph --> Create graph<br />
Name : mysql.status<br />
Items: 选择刚配置的Item
</p>
<p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:15px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;">
其他根据需要做修改,保存
</p>
<p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:15px;margin-bottom:15px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;">
此时zabbix就可以生成出界面了
</p>
<h3 style="line-height:normal;orphans:2;text-align:-webkit-auto;white-space:normal;margin:20px 0px 10px;padding:0px;border-width:0px 0px 1px;border-bottom-style:solid;border-bottom-color:#CCCCCC;-webkit-font-smoothing:antialiased;font-size:24px;font-family:Helvetica, arial, freesans, clean, sans-serif;">
整理自网络
</h3>
<p style="orphans:2;text-align:-webkit-auto;white-space:normal;margin-top:10px;margin-bottom:0px;border:0px;color:#333333;font-family:Helvetica, arial, freesans, clean, sans-serif;font-size:14px;line-height:22.3999996185303px;">
<strong style="margin:0px;padding:0px;border:0px;"><em style="margin:0px;padding:0px;border:0px;">Svoid</em></strong><br />
<strong style="margin:0px;padding:0px;border:0px;"><em style="margin:0px;padding:0px;border:0px;">2015-07-02</em></strong>
</p>
</div>