zabbix的监控方式:

zabbix-web缩能够现实的且可以指定为监控接口类型的监控方式:

Aagent:

passive

active

SNMP:Simple Network Management Protocol

MIB, SMI, SNMP(v1, v2c, v3)

IPMI:只会凭条管理接口(Intelligent Platform Management Interface)原本是一种Inter架构的企业系统的周边设备所采用的一种工业标准,IPMI是一个开放的免费标准,使用者无需支付额外的费用即可使用此标准。

JMX:Java Management Extensions,用于通过Java自己的接口对java程序进行监控;

zabbix-java-gateway用于获取监控数据;

Zabbix Architecture

 

SNMP监控方式:

操作:Get, GetNext, Set, Response, Trap

MIB:是悲管理对象的集合,而且还额外定义了被管理对象的名称、访问权限、数据类型等属性;

MIB视图:MIB的子集

授权:将某MIB视图与某Community绑定来实现;

OID:Object ID对象标识符,1.3.6.1.2.1

1:system

2:interface

4:ip

6:tcp

7:udp

JMX监控方式:

(1) 安装zabbix-java-gateway;

配置文件:/etc/zabbix/zabbix-java_gateway.conf

Listen_IP=

Listen_PORT=10052

zabbix server的配置文件/etc/zabbix/zabbix_server.conf

JavaGateWay=

JavaGateWayPort=10052

(2) Java应用程序开启JMX接口;

java -Dcom.sum.management.jmxremote -Dcom.sun.management.jmxremote.port=10053 -fvom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

监控Tomcat

export CATALINA_OPTS="$CATALINA_OPTS -Dcom.sum.management.jmxremote -Dcom.sun.management.jmxremote.port=10053 -fvom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"

Zabbix分布式监控:

Agenda

分布式监控概述

proxy and node

Zabbix的三种架构

Server-agent

Server-Node-agent

Server-Proxy-agent

监控Zabbix

zabbix分布式监控概述

Zabbix能高效地监控分布式IT架构

在大型环境中Zabbix提供两种解决方案

使用代理(proxy)

使用节点(node)

proxy or Node?

代理(proxy)用于本区域数据收集,并将数据发送给server

节点(node)提供完整的Zabbix server用于建立分布式监控中的层数

Server-Node-Client

 

Server-Node-Client特性

解决host过多时单台Server面临性能瓶颈的问题

使用多个instance

每个instance是独立的一套zabbix,有database和Frontend(optional)

支持热插拔,Node和Server的连接可以随时断开,但不影响Node的正常运行

Node定时给Server发送configuration, history, event

Server定时给Node发送configuration

所有配置变更只能在Node节点操作,不能再Server操作。

http://www.zabbix.com/forum/showthread.php?t=20863

支持树状结构,Node又可以是个Server

Server-Proxy-Client

 

Server-Proxy-Client工作特性

Proxy不会向Server同步Configuration,只会接收

Proxy的数据库定时会将数据传给Server,Proxy本地数据库只保存最近没有发送的数据

Proxy vs Node

Node本身是一台server,它有完整的web页面,完整的数据库,它将数据源源不断传送给Master

Proxy只有一个proxy的daemon进程,Proxy也有自己的数据库,但它的数据库只会保存一定时间的数据,它与Master通信是将一批信息打包后发送到Master,Master将这些数据merge入Master数据库

Master-Proxy相比Master-Node的优点有以下

Proxy压力小,数据库只存储一定时间数据

Master压力变小,数据不是源源不断获取,减小IO压力

架构更清晰,易维护

Zabbix proxy 的功能

功能

Monitor remote locations

Monitor locations having unreliable communications

Offload the Zabbix server when monitoring thousands of devices

Simplify the maintenance of distributed monitoring

The proxy requires only one TCP connection to the Zabbix server

This way it is easier to get around a firewall as you only need to configure one firewall rule

注意

Zabbix proxy must use a separate database

Pointing it to the Zabbix server database will break the configuration

Zabbix Proxy特性

All data collected by the proxy is stored locally before transmitting it over to the server

The proxyLocalBuffer and ProxyOfflineBuffer parameters in the proxy configuration file control for how long the data are kept locally

Zabbix proxy is a data collector

It does not calculate triggers,process events or send alerts

Zabbix Proxy特性

zabbix database需要用到的空间:

60000/60 = 1000条

历史数据=天数X美妙钟处理的数据量X24X3600X50Bytes

90X1000X86400X50Bytes

趋势数据:

每一个趋势128Bytes

大小=天数X监控项X24X128Bytes

事件数据:

每个占据130Bytes

大小:天数X86400X130Bytes

 

node4:linux-agent

[root@node4 ~]# yum -y install net-snmp net-snmp-utils net-snmp-libs
[root@node4 ~]# vim /etc/snmp/snmpd.conf
view    systemview    included   .1.3.6.1.2.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
[root@node4 ~]# service snmpd start

点击Confiugraion -- Hosts -- Create host,填写完成点击Add;

将node2安装为zabbix-proxy:

点击Configuration -- Hosts,选择node2节点点击删除,点击Go;

node2:zabbix-proxy

在之前已经安装了mysql服务;

[root@node2 ~]# ls
anaconda-ks.cfg                iksemel-1.4-2.el6.x86_64.rpm        install.log         libiksemel3-1.4-2_2.el6.x86_64.rpm
fping-2.4b2-10.el6.x86_64.rpm  iksemel-devel-1.4-2.el6.x86_64.rpm  install.log.syslog  zabbix-2.4.5
[root@node2 ~]# yum -y localinstall *.rpm
[root@node2 ~]# cd zabbix-2.4.5/
[root@node2 zabbix-2.4.5]# yum -y localinstall zabbix-proxy-2.4.5-1.el6.x86_64.rpm zabbix-proxy-mysql-2.4.5-1.el6.x86_64.rpm
[root@node2 zabbix-2.4.5]# mysql -uroot -ppassword
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE zabbix_proxy CHARACTER SET utf8;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL ON zabbix_proxy.* TO zbxuser@'172.16.%.%' IDENTIFIED BY 'zbxpass';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON zabbix_proxy.* TO zbxuser@'127.0.0.1' IDENTIFIED BY 'zbxpass';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON zabbix_proxy.* TO zbxuser@'localhost' IDENTIFIED BY 'zbxpass';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON zabbix_proxy.* TO zbxuser@'node2.smoke.com' IDENTIFIED BY 'zbxpass';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@node2 zabbix-2.4.5]# mysql -uroot -ppassword zabbix_proxy < /usr/share/doc/zabbix-proxy-mysql-2.4.5/create/schema.sql
[root@node2 zabbix-2.4.5]# vim /etc/zabbix/zabbix_proxy.conf
Server=172.16.100.6
Hostname=node2.smoke.com
DBHost=172.16.100.7
DBName=zabbix_proxy
DBUser=zbxuser
DBPassword=zbxpass
DBPort=3306
ConfigFrequency=600
DataSenderFrequency=1
[root@node2 zabbix-2.4.5]# service zabbix-proxy start
[root@node2 zabbix-2.4.5]# ss -tnl
State       Recv-Q Send-Q                                 Local Address:Port                                   Peer Address:Port
LISTEN      0      128                                               :::22                                               :::*
LISTEN      0      128                                                *:22                                                *:*
LISTEN      0      128                                               :::10050                                            :::*
LISTEN      0      128                                                *:10050                                             *:*
LISTEN      0      128                                               :::10051                                            :::*
LISTEN      0      128                                                *:10051                                             *:*
LISTEN      0      50                                                 *:3306                                              *:*
LISTEN      0      128                                               :::80                                               :::*

在zabbix-server页面点击Administration -- Proxies -- Create proxy,填写完成点击Add;

点击Configuration -- Hosts --Create host,使用zabbix-proxy只需要在Monitored by proxy选择node2主机就行;