windows導出系統監控數據 typeperf -qx > c:\windows-item.txtphp
zabbix-被動模式---server端向agent端發送請求數據,數據量大了會影響server性能, java
zabbix-主動模式---agent端主動向server端發送數據,node
vim /etc/zabbix/zabbix_agentd.confpython
ServerActive=10.240.17.100 主動模式mysql
Hostname=真實的主機名linux
建立主動模式模板----configuration----Template-----找到Template OS linux點進去----Full clone----改個名字改爲Template os linux Active---add---點進去Template os linux Active ---Linked templates----Unlink and clear ----update-----在點Items---所有勾選中點Mass update----tyep裏選擇Template os linux Acetive -----update sql
經過JMX來監控java應用apache
wget http://mirrors.shuosc.org/apache/tomcat/tomcat-8/v8.5.23/bin/apache-tomcat-8.5.23.tar.gzvim
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpmwindows
[root@node2]#yum install -y zabbix-java-gateway java-1.8.0
[root@node2]#vim /etc/zabbix/zabbix_java_gateway.conf
[root@node2]#systemctl start zabbix-java-getway
[root@node2]#netstast -lntp |grep 10052
[root@node1]#vim /etc/zabbix/zabbix_server #############若是用proxy模式須要在proxy模式下也開啓下面2個參數##################
219 javaGateway=10.240.17.103
235 StartJavaPollers=5
[root@node1]#systemctl restart zabbix-server
[root@node2]#vim /usr/local/tomcat/bin/catalina.sh
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
在zabbix監控頁面上給主機找到Template App Generic Java JMX加上便可
注意:若是開啓zabbix_proxy作代理的話,須要更改vim /etc/zabbix/zabbix_proxy.conf裏的
JavaGateway=192.168.1.12
StartJavaPollers=5
zabbix---監控mysql
mysqladmin -u root -p 123123 ping |grep -c alive
vim /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin -uroot -p123.com ping|grep -c alive
systemctl restart maridb
去zabbix頁面添加items----create items----
---建立Triggers
添加完成監控mysql down
rpm -ivh https://www.percona.com/downloads/percona-monitoring-plugins/percona-monitoring-plugins-1.1.7/binary/redhat/7/x86_64/percona-zabbix-templates-1.1.7-2.noarch.rpm
cd /var/lib/zabbix/percona/scripts/
vim ss_get_mysql_stats.php.cnf
<?php
$mysql_user='root';
$mysql_pass='123.com';
./get_mysql_stats_wrapper.sh gg
cp /var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf /etc/zabbix/zabbix_agentd.d/
2
然和倒入模版Percona-MySQL-Server-Template.xml
zabiix 自動註冊----
vim /etc/zabbix/zabbix_agentd.conf
ServerActive=10.240.17.100
HostMetadata=system.uname
配置--Actions----Auto registration----create Actions---填寫那麼agent自動註冊----Conditions----Host metadata like Linux ----Operations ---Operation type add host -----add
zabbix生產高可用架構
經過API方式 結合CMDB作自動化方案流程
[root@linux-node1 ~]# cat api.py 簡單的Api調用
#!/usr/bin/env python from pyzabbix import ZabbixAPI zapi = ZabbixAPI("http://10.240.17.100/zabbix/") zapi.login("Admin", "123123") print("Connected to Zabbix API Version %s" % zapi.api_version()) for h in zapi.host.get(output="extend"): print(h['hostid']) print(h['host'])