zabbix--3.0--2
zabbix页面注意事项
1、 工作中使用zabbix常遇到的问题:生产一台机器告警了顺手关闭了,然后忘记打开了
4、生产中,一定好划分好主机组,可以按业务划分
5、这里可以找某台机器的最新数据,这是3.0版本之后加的过滤
一些最新数据
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203007055-1355103529.png)
准备新加一台机器node2
node2上执行如下操作
rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm yum install zabbix-agent -y
配置zabbix-agent配置文件
主机名这里写成正确主机名
过滤查看下
[root@linux-node2 ~]# vim /etc/zabbix/zabbix_agentd.conf [root@linux-node2 ~]# grep '^[a-Z]' /etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=192.168.58.11 ServerActive=127.0.0.1 Hostname=linux-node2.nmap.com Include=/etc/zabbix/zabbix_agentd.d/ [root@linux-node2 ~]# systemctl start zabbix-agent [root@linux-node2 ~]#
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203211086-285738074.png)
点进去,点击下面的Full clone
输入如下信息
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203514883-730941489.png)
添加之后如下
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203637914-946957956.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203652070-28012007.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203738305-1772412405.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203752602-175568090.png)
添加链接
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203845039-1664928739.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203900914-2079390206.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330203917617-1302486707.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204014883-317018619.png)
net.if.in[{#IFNAME}] net.if.out[{#IFNAME}]
{linux-node2.nmap.com:net.if.out[eth0].last(0)}
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204203539-506642275.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204218274-849660811.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204234649-637567194.png)
监控事件和告警
1、怎么通知Action
2、通知给谁
action不仅仅是告警,默认的动作是报警,还能配置下自动执行一些脚本。其实报警这个动作肯定是执行了脚本等实现的
默认情况下通知的内容
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204714445-1753569112.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204730586-323772503.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204822805-1026843366.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204838945-1310679778.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204902008-503666489.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204919336-163939206.png)
报警媒介相关
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330204938492-230036437.png)
设置ssl连接方式发送和接收邮件
配置用户使用email告警
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330205431820-659109652.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330205522336-1837652604.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330205612852-173585093.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330205653117-245148378.png)
1、创建用户组。 添加权限 权限只能按用户组分配
2、创建用户 选择用户角色
3、报警媒介
4、Action 添加新主机后,要确认权限分配
1、项目规划
主机分组:
交换机,Nginx,Tomcat,Mysql
监控对象识别:
1、使用snmp监控交换机
2、使用IPMI监控服务器硬件
3、使用Agent监控服务器
4、使用JMX监控java
5、监控MySQL
6、监控Web状态
7、监控Nginx状态
监控网络设备,比如交换机的大体步骤
1、对于交换机,需要在交换机上开启snmp config t snmp-server community public ro end 2、zabbix上添加监控
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330210808164-2101830902.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330210822336-1756166598.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330210906008-1273394487.png)
通过zabbix监控交换机大体步骤
1、对于交换机,需要在交换机上开启snmp config t snmp-server community public ro end 2、zabbix上添加监控 设置snmp interfaces 3、关联监控模板 IPMI: 建议:使用自定义item,本地执行ipmitool命令获取数据
监控JVM
监控jvm可以通过java gateway来
官网链接如下
[root@linux-node1 ~]# yum install -y zabbix-java-gateway java-1.8.0 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirror01.idc.hinet.net * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Package zabbix-java-gateway-3.0.8-2.el7.x86_64 already installed and latest version Package 1:java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64 already installed and latest version Nothing to do
编辑配置
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330212245445-223330729.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330212348633-1932432746.png)
启动服务并设置开机启动
[root@linux-node1 ~]# systemctl start zabbix-java-gateway.service [root@linux-node1 ~]# systemctl enable zabbix-java-gateway.service Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-java-gateway.service to /usr/lib/systemd/system/zabbix-java-gateway.service. [root@linux-node1 ~]#
检查监听情况
[root@linux-node1 ~]# netstat -lntp | grep 100 tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2373/zabbix_agentd tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 1500/zabbix_server tcp6 0 0 :::10050 :::* LISTEN 2373/zabbix_agentd tcp6 0 0 :::10051 :::* LISTEN 1500/zabbix_server tcp6 0 0 :::10052 :::* LISTEN 18836/java [root@linux-node1 ~]#
检查java gateway进程和java版本
[root@linux-node1 ~]# ps aux | grep java zabbix 18836 1.2 0.9 3455096 37672 ? Sl 13:42 0:00 java -server -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml -classpath lib:lib/android-json-4.3_r3.1.jar:lib/logback-classic-0.9.27.jar:lib/logback-core-0.9.27.jar: lib/slf4j-api-1.6.1.jar:bin/zabbix-java-gateway-3.0.8.jar -Dzabbix.pidFile=/var/run/zabbix/zabbix_java.pid -Dzabbix.timeout=3 -Dsun.rmi.transport.tcp.responseTimeout=3000 com.zabbix.gateway.JavaGateway root 18913 0.0 0.0 112644 964 pts/0 S+ 13:43 0:00 grep --colour=auto java [root@linux-node1 ~]# [root@linux-node1 ~]# java -version openjdk version "1.8.0_121" OpenJDK Runtime Environment (build 1.8.0_121-b13) OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode) [root@linux-node1 ~]#
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330212724320-792366206.png)
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330212805117-519918432.png)
[root@linux-node1 ~]# vim /etc/zabbix/zabbix_server.conf [root@linux-node1 ~]# systemctl restart zabbix-server.service [root@linux-node1 ~]#
yum install -y java-1.8.0 cd /usr/local/src/ wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz tar xfz apache-tomcat-8.0.36.tar.gz mv apache-tomcat-8.0.36 /usr/local/ ln -s /usr/local/apache-tomcat-8.0.36/ /usr/local/tomcat [root@linux-node2 src]# netstat -lntp | grep 8080 tcp6 0 0 :::8080 :::* LISTEN 8137/java [root@linux-node2 src]#
![](https://images2015.cnblogs.com/blog/1076878/201703/1076878-20170330213305695-687592467.png)
以上步骤可以总结为
JMX:(使用zabbix java Gateway代理)
1、安装 yum install -y zabbix-java-gateway java-1.8.0
2、配置vim /etc/zabbix/zabbix_java_gateway.conf
3、启动systemctl start zabbix-java-gateway
4、检查端口和进程
5、配置zabbix server关联java gateway
6、重启zabbix server