zabbix監控客戶端安裝

dbasdk發表於2017-04-24
<div> <h3 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使用者 </h3> <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&gt; groupadd zabbix shell&gt; useradd -r -g zabbix zabbix</code></pre> <h3 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 編譯安裝 </h3> <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&gt; tar zxvf zabbix-2.4.5.tar.gz shell&gt; cd zabbix-2.4.5/ 編譯安裝zabbix shell&gt; ./configure --prefix=/usr/local/zabbix_agent --enable-agent shell&gt; make &amp;&amp; make install shell&gt; ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/ shell&gt; ln -s /usr/local/zabbix/bin/* /usr/local/bin/</code></pre> <h3 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 配置 </h3> <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&gt; 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&gt; 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> <h3 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客戶端 </h3> <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&gt; cp misc/init.d/fedora/zabbix_agentd /etc/init.d/ shell&gt; /etc/init.d/zabbix_agentd start Starting zabbix_agentd: [確定] zabbix伺服器端執行 shell&gt; zabbix_get -s192.168.56.211 -p10050 -k"system.uptime" 8748</code></pre> <h3 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;"> 新增自定義監控 </h3> <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> <h3 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 </h3> <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 --&gt; items --&gt; Create item<br /> Name : mysql.status<br /> Type :Zabbix agent<br /> Key : mysql.status['zabbix','123@qwe']<br /> 其他根據需要做修改,儲存 </p> <h3 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 </h3> <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 --&gt; graph --&gt; 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> <h2 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;"> 整理自網路 </h2> <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>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29734436/viewspace-2137841/,如需轉載,請註明出處,否則將追究法律責任。

相關文章