In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Chapter III; Discovery, automatic Registration and web Monitoring
Alarm implementation: should be implemented using a dedicated mailbox service, using a dedicated account and password
Use Fetion robot and use script to send messages
Action action: condition,operation (remote,command,send message)
Item: data item ()-> mysql server is saved in the database-- > web gui
Key: the tag that server needs to get data from agent
/ / multiple item can be generated from one key
/ / user parameter, userParameter=
/ / key can also accept parameters
/ / key and item do not correspond one to one
Trigger: trigger action, action,//trigger defines the threshold of an item, key
Action: condition condition, operation (remote command,send message)
Complete monitoring: add host (host group)-- > add item (built-in simple graphics)-- > trigger (event)-- >
Action (send notifications (notification information includes a large number of macros), condition,operation (step))
Item: built by myself
Trigger: define a reasonable range, beyond which event is generated (OK--- > problem)
Action: it can be a message or a remote command. Once restored, problem-- > OK is required.
Notification information makes extensive use of macros, requiring conditions and actions
Action: a trigger may not necessarily depend on the conditions for executing the operation, but it also needs to meet the condition.
Define steps in action.Operation and define the implementation of step duratiion// alarm upgrade
There is no steps in action.Recovery
Trigger can cause events, but only if action.condition is satisfied
Media type:email,External Script,Jabber,SMS, / / the first two are the most commonly used. External scripts can call external applications to send messages.
Meida:google_mail,our_mail, etc., the medium is a specific entity.
/ / item and trigger are at the host level and need to be defined on the host or board.
/ / action: not at the host level, because when multiple hosts monitor the same metric, you can define an action to let the same metric on multiple hosts, and colleagues give an alarm.:: you can define the actions when multiple hosts monitor the same metric.
/ / action.condition can define host.group,trigger,hosts and other simultaneous monitoring
The destination of the message: zabbix users, the way each user is tied, and the custom destination to send
Graph: display the same type of item data items in the same graph
Screen: put multiple graph in one big screen
Map: define the topological relationship between each node by graph, map
Template: batch monitoring of each host
When adding a host, you can directly apply the template to the host. It is recommended to make several more templates. Each template only focuses on a few metrics, and then
When adding a host, you only need to associate a few more metrics
You can associate a host with multiple templates, templates can be nested, and templates and hosts are at the same level
You can also define item,application,trigger,graph, etc.
Discovery:
How it was discovered:
Agent
Agentless,ssh,ping// agentless mode
SNMP
JMX: an environment dedicated to monitoring java virtual machines. Tomcat does not support jmx by default. You need to add specific classes for toomcat. Download, install, restart / / if you only monitor the number of connections to tomcat and the number of web pages being opened, you no longer need JMX and script.
The network discovery function of zabbix can be based on the following information
IP range
According to Service (FTP,SSH,WEB,POP3,IMAP,TCP)
A message from zabbix agent, agent can
SNMP proxy implementation
Discovery: process stage: discovery-- > action
Events in Discovery:
Service up,service down
Host up,host down
Service discovered,service lost
Host discovered,host lost
Action: {condition,operation} add hosts and associate templates
Sending notification: sending notification
Adding/removing hosts: add or remove hosts
Adding hosts to a group: adding hosts to group
Enabling / disabled hosts: activate or disable a group
Removing hosts from a group
Linking hosts to/unlinking from a template
Remote scripts
Interface is automatically created when added to network discovery
1.the services detected / / for example, if the detection is successful based on SNMP, a SNMP excuse will be created.
two。 If a service responds to both agent and snmp, two interfaces are created
3. If the same discovery mechanism (such as agentd) returns non-unique data, the first interface is the default, and the other is the extra interface
4. Even if a host starts with only an agent interface and then discovers it through SNMP, it will also add additional SNMP excuses.
5. Different hosts-if the same data is returned, the first host will be added and the remaining hosts will be used as an additional excuse for the first host
Lab: auto-discovery, environment: zabbix_server, another host, newly established host
/ / server is 200 and 101:server is specified to be enabled for server,zabbix-agent.
1. New template
Test template
Test group / / Group name
/ / not defined in the template, discovery, defined elsewhere
two。 Create item--trigger--graph
/ / agentd has a record of UserParameter=memory.usage [*], / bin/cat / proc/meminfo | awk'/ ^ $1UserParameter=memory.usage / {print $$2}'on server. It is recommended to use the agent-get command on server to test the effect.
/ / zabbix_get-s 10.0.0.101Murk "agent.ping" / / is a key and a key of the other party
Create 3 item
/ / make sure that the key of item can be used
Memory.usage [MemAvailable] / / * 1024
Memory.usage [MemFree] / / * 1024
Memory.usage [Active] / / * 1024
Memory.usage [Inactive] / / * 1024
Create a trigger:
Name: free memory too low
Alarm at Severity:High / / high level
Expression:
Item:test-template: memory.usage [MemFree]
Function:Average value of a period T is
< N Last off(T) : 30 //最后30s的平均值,小于51M TIme shift: N: 51200 //51M小于51M为阈值,默认单位为k OK event generation:None //不会附带产生其他的问题 创建 graph Name:mem-usage-depaly 3.配置configuration->Discovery--- > create discovery / / discovery creation
Name:linux_in localhost
DIscover by proxy: No proxy
Ip range: 10.0.0.100-10.0.0.101 / / your own ip should also be included
Delay (in sec): 120 / / delay
Check New:
Check type: zabbix agent
Key:memory.usage [MemFree] / / the key here is used as an auxiliary means to add hosts
/ / the discovery here can only be found, but after the discovery, choose yo action
The unique identifier of the Device uniqueness criteria:IP address device is IP
4. Configuring action / / discovery can only be found, but they don't know what to do after discovery.
Configuration--action-event source {discovery}-create action
Action:
Name:auto discovery linux in localnet
Condition:Host IP.:10.0.0.100-10.0.0.101 / / will be added only when the conditions are met.
: Discovery status = Discovered / / will be added only when the status is found
: Discovery rule = linux_in_localhost / / this condition is defined in discovery
Operation:
Add host
Link tooard templates: test server/test template
/ / on monitoring--dashboard, you can see if any hosts have discovered
Result: the host can be found, but its status cannot be detected
5. Tom / create CTO, join the CTO group, tom can accept, any type of mail
Send to:tom@localhost / / server has tom as a system user
Create media:administrator--media types-- > create a new media types
Create user group:administrator-users-create users groups
Create a user:
User: join the group you just created
Media:
Type:local media find
Send to:tom@localhost
/ / useradd tom on server and add user tom
Troubleshooting: mainly based on configuration {hosts,actions,discovery}
Note: be sure to check whether configuration-hosts has custom item, riggers, etc.
/ / problem. You can only see a host alive on dashboard, but cannot add it to host.
/ / after a new host is finally opened, it is automatically discovered successfully.
/ / solution: delete condition:Discovery status = Discovered in action to solve the problem.
/ / because this has been discovered for a long time, and then the status has changed, not discovered's.
/ / restart
/ / error zabbix_get [43432]: Get value error: cannot connect to [[10.0.0.101]: 10050]: [113] No route to host
[root@localhost ~] # zabbix_get-s 10.0.0.101-k "memory.usage [MemFree]"
Method: iptable-F / / turn off the firewall
6. Define another action, auto_remove
Createa actions:
Name: remove host
Conditions:host ip 10.0.0.100-102
: Discovery status = Lost
Operations:remove host
/ / stop the service by systemctl zabbix-agent stop on agent
Summary of the steps:
Create template (item,trigger,graph)-create discovery- create action
Question:
Automatic remove does not have
Agent auto-registration:
1.Zabbix supports active agent's automatic registration (auto-resistration) function, which is usually used for re-launch after previous agent failures.
two。 Passive detection can also be added based on active agent's automatic registration mechanism, which is through the "listen IP" provided by active agent registration.
With listen port.
After receiving the automatic registration request, the 3.Server side takes the received IP and Port as interface attributes.
Network discovery: configuring active agent auto-registration
Configuration--actions--Event source (atuo registration)-create action
Action: add host/link to template
Condition:
Operation: only define operation, not condition
In addition: configure the working properties of agent and restart agent
Zabbix-agentd..conf
ServerActive=172.16.100.15 / / points to server
/ / later
/ / then service agent stop here
Web Monitoring:
1. To create a web monitor for a step, you need to define a web scheme (scenarios).
The Web scenario includes one or more HTTP requests or "step {step}}"
The execution of step {step} is performed in a predefined order
two。 You can get some information through web monitoring.
The average download speed of all step in the entire web scheme
Failed step number
Failed error message
3. In the specific step of the web scenario, the following information can be used as needed
Download speed of the step
Response time
Response status code
4.zabbix can detect whether the acquired HTML page contains a preset string, and it can also log in and click on the page.
Achieve:
1. Create two pages. 1.htmlje cp / var/log/message / var/log/www/html/2.html
Chmod 644 / var/ww/html/*.html
two。 Create a new application:name: web-test
Configuration---hosts--web: check web
Scenario
Steps: / / URL write right, required codes:200 is OK
Authentication:
/ / you can see it in monitoring.
/ / item automatically created by Scenario
Web.test.in [Scenario,bps], download speed
Web.test.fail [Scenario], number of failed steps
Web.test.error [Scenario], last error code
But if you need to customize it, if you call it, you need to replace the web name defined by Scenario.
For example: create a trigger:
{host.web.test.fail [www.magedu.com] .last (0)} # 0 / / the last error code is not 0 and # is not equal to 0, which proves that it failed.
{host: web.test.in [www.magedu.com] .last (0)} 3
/ / when configuration-host--trigger customizes trigger: you can see the item automatically created by web in Expression
For example:
Item:10.0.0.101: Response code for step "1.html" of scenario "web-test
Function:Last (most recent) T value is > N
The threshold of NRV 3max / response time is 3s.
Chapter 4:
Zabbix distributed monitoring
Thousands of hosts, multiple proxy summary messages, and then summarized to the server
Three architectures of Zabbix
Server--agent
Serer-node-agent / / early on.
Server-proxy--agent / / zabbix1.8 followed by proxy
Proxy or Node?
Agent proxy is used for data collection in this area and sends the data to server// without analysis, monitoring or display
Node node provides a complete Zabbix server to establish levels in distributed monitoring.
/ / node is a complete monitoring platform, which can be directly web on node.
Maintenance: maintenance / / centralised centralization, / / embedded embedded
Proxy does not provide GUI, but node does
Node needs to create DB manually, but proxy is in server
/ / the data collection of proxy is created after it is obtained from server.
Centralised configuration: centralized management, which can be realized by proxy. Node needs to configure each object that node needs to monitor separately.
Comparison between Proxy and node
1.node itself is a server. It has a complete web page and a complete database. It sends data to Master continuously.
2.Proxy has only one daemon process of proxy, and Proxy also has its own database, but its database will only save data for a certain period of time. It communicates with Master by packaging a batch of information and sending it to Master,Master to merge the data into the Master database.
Advantages of 3.Mater-Proxy over Master-Node
1.Proxy pressure is small, and the database stores data for a certain period of time.
2.Master pressure becomes smaller, data is not continuously obtained, reducing IO pressure
3. Clearer architecture and easier maintenance
/ / DB,web,master pressure, send data: {send continuously | send by package}
/ / proxy: you only need to import schema.sq, not data.sql,p_w_picpath.sql
Do not need to configure yourself, copy the configuration from the server, only save the data for a period of time, and then package and send the data after a while
/ / for node, you need to import all three databases, install the web interface, and configure which interfaces to install.
Frontend: front end, where users view data through the front segment
Server-Proxy-CLient model
/ / node: independent configuration, independent DB. Independent frontend,master is only responsible for summarizing it.
Server: you also need to collect configuration information of node. Configuration modified on node must be synchronized to server.
Server-Node-client features:
1. To solve the performance bottleneck of a single Server when there are too many host, multiple instance (each node) is used, and each instance is an independent zabbix.
two。 Hot plug is supported. The connection between node and server can be disconnected at any time, but it does not affect the normal operation of node.
3.Node sends configuration,history,event to Server regularly.
4.Server regularly sends configuration / / Node and server information such as timing synchronization configuration to Node.
5. All configuration changes can only be performed on the Node node, not Server
6. Support tree structure, and Node can be a Server.
/ / 6. It means that node can continue to enfetch its own child child, and then become a server, but it is also a node.
Server-Proxy-Client model: lightweight
Proxy does not have a separate configuration file. You need to obtain the item assigned by server to the host you monitor from server.
Periodically sent to server, saved by server in server.DB
Proxy will not synchronize configuration with Server, only accept
Proxy's database periodically transfers data to Server,Proxy 's local database to save only data that has not been sent recently.
/ / data that has been sent is no longer saved
Functions of Zabbix Proxy:
1. Monitor remote area
two。 Monitor locations with unreliable communication
3. Relieve the pressure on server
4. Distributed maintenance
Note:
1.zabbix proxy must use a separate database, even if it is on the same host, it has been determined that you cannot drink server and use the same database.
The database that 2.proxy points to zabbix server will break the configuration information.
Features of Zabbix:
ProxyLocalBuffer and ProxyOfflineBuffer// are responsible for how long the configuration data is kept.
Proxy is just a data collector, does not analyze, does not handle events, and sends alarm messages alive.
Lab: zabbix-proxy implementation
/ / ntpdate 10.0.0.1 time must be consistent
Server:200, proxy:100,agent:141// asked 53 to monitor 141,
Proxy: only need to install: zabbix-proxy,zabbix-proxy-MySQL,zabbix-agent,zabbix
1.Proxy::proxy temporarily does not install agent
Install mysql, create database: library name, whatever you want, for example: zabbix_proxy
Create database zabbix_proxy default character set utf8
Grant all on zabbix_proxy.* to 'zbproxy'@'10.0.0.%' identifide by' zbproxy'
Insert into mysql.user (host,password,user) value ('10.0.0.13) zbproxy' (' zbproxy')
Mysql-uzbproxy-pzbproxy-h20.0.0.53 / / Test results
Flush privileges
/ / yum install http://mirrors.163.com/centos/7/extras/x86_64/Packages/epel-release-7-5.noarch.rpm
Yum install zabbix-proxy zabbix-proxy-mysql / / install zabbix-proxy, there will be dependencies, install using yum
/ / rpm-ql zabbix-proxy-mysql, you need to import the database
Mysql: just import schema.sql
Mysql-uzbproxy-pzbproxy-h20.0.0.53 zabbix_proxy
< /usr/share/doc/zabbix-proxy-mysql-2.4.8/create/schema.sql //导入数据库 2..proxy:vim /etc/zabbix/zabbix_proxy.conf [root@localhost yum.repos.d]# grep -v "^#" /etc/zabbix/zabbix_proxy.conf | grep -v "^$" Server=10.0.0.200,172.16.1.1 //允许来拉取数据的主机的IP地址 ServerActive=127.0.0.1,172.16.1.1 //主动通知来拉取数据的主机的IP地址(只有server与agent在同一主机时才有127.0.0.1) Hostname=server.zhou.com //需与主机名保持一致 这个配置和该机器实际的主机名没有关系,但必须和zabbix server中添加该机器的时候的主机名一致,否则zabbix server获取不到信息 Hostname=10.0.0.53 //这个将会被server识别 DBHost=10.0.0.53 DBName=zabbix_proxy DBUser=zbproxy DBPassword=zbproxy ConfigFrequency=1 //zabbix proxy向服务器检索配置数据信息的频率, DataSenderFrequency=60 //zabbix proxy发送收集的数据给zabbix server的频率tart zabbix-proxy netstat -tunlp | grep zabbix //它也监控在server上,因为他自己也相当于server端,在被动模式下,该参数将来被忽略 3agent:. Yum -y install zabbix-agent //安装agent vim /etc/zabbix/zabbix_agentd.conf Server :指向proxy的ip,而不是server ServerActive:指向proxy的ip,而不是server Hostname: UserParameter=test.Mem[*],/usr/bin/cat /proc/meminfo | awk '/$1:/{print $$2}' //提供测试用 systemctl enable zabbix-agent systemctl start zabbix-agent 4.在server 上添加被监控主机, 首先得让server知道有一个proxy, Administration--proxy--create proxy Proxy name: 尽量使用ip,除非能够解析到主机 Proxy mode: Active:proxy主动到server拉取配置文件 ,一般使用 Passive:等到server想自己发发送配置文件 Host:不要添加其他主机 在proxy上测试agent错误: [root@localhost yum.repos.d]# zabbix_get -s 10.0.0.141 -k "test.if" zabbix_get [21365]: Get value error: cannot connect to [[10.0.0.141]:10050]: [113] No route to host 解决方式: //很有可能是虚拟机的问题 1.iptables -F; iptables-save 2.Setenforce 0 3.Shutdown -h now 4.Pkill zabbix-agent ;systemctl restart zabbix-agent 然后,添加被监控主机:create hosts Host name:10.0.0.141 Visible name:agent-141 New group:proxy-discovery:1 Agent interfaces:10.0.0.141 Monitored by proxy:10.0.0.53 //由53代为监控 //在monitoring--Dashboard上的Hosts tatus上看结果,就能发现已经能够检测得到 创建一个item进行测试: 注意事项: //tail /var/log/zabbix/zabbix_proxy.log //随时查看日志 1.proxy的配置文件的Hostname= //必须和Administrator--proxy中定义的主机名一致 2.通过agent的server和server active都需要指定为proxy的ip 3.加快server和proxy的同步 zabbix-proxy.conf //配置文件 ConfigFrequency=1 //拉取配置文件,默认是3600s DataSenFrequency=1 //默认是1s ProxyLocalBuffer=0 //本地数据保存多长时间,0:不保存 ProxyOfflineBuffer=1 //proxy联系不到server后数据保存多长时间,1:1小时 //agent上有自定义监控mysql的UserParameter //在/etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf 项目案例: ConfigFrequency=300 DataSenderFrequency=60 //只需要在proxy上配置 Zabbix-server上需要的操作:添加proxy,添加host.proxy为主动模式, Agent上修改配置后,需要重启agent服务 关键是在zabbix server的前端创建代理节点的名字时,该名字应和zabbix代理配置文件中指定的Hostname值相同 .配置zabbixproxy的配置文件zabbix_proxy.conf, 该文件中有两个重要的参数: ConfigFrequency=60 #zabbix proxy 向服务器检索配置数据信息的频率,在被动模式下该参数将被忽略 DataSenderFrequency=60 #zabbix proxy发送收集的数据给zabbix server的频率 配置完毕 现在server上,建立proxy,然后建立host.proxy 问题:server从proxy上获取不到agent的数据 1.server端与proxy端时间不同步 //ntpdate 120.25.108.11 2.server端分配的缓存不够 3.server端分配的线程不够 4.server端负载比较大{CPU,IO,MEM} 1.查看zabbix_server有没有出现 Zabbix poller processes more than 75% busy 告警 2.htop iotop iostat //查看服务器的负载情况 3. vim /usr/local/zabbix/etc/zabbix_server.conf StartPollers=500 StartPollersUnreachable=50 StartTrappers=30 StartDiscoverers=6 CacheSize=1G CacheUpdateFrequency=300 StartDBSyncers=20 HistoryCacheSize=512M TrendCacheSize=256M HistoryTextCacheSize=80M ValueCacheSize=1G 4. crontab -e */3 */1 * * * /usr/sbin/ntpdate -u 202.120.2.101 &>/ dev/null
Restart the server and proxy services
Two questions:
1.Too many processes on Zabbix server
2.Server cannot get data from proxy / / server points to proxy on agent
3. The realization of alarm Mechanism
4.Zabbix-node-agent implementation
Proxy FAQ:
The names configured in 1.proxy 's Hostname and server's web are not the same. It must be noted that both proxy and server or agent and server Hostname are the same.
Attachment: detailed explanation of zabbix_proxy.conf file
1.ProxyMode=0 / / 0 bit default, active, 1 bit passive
2.Server=IP address # description: this parameter is used to set the zabbix Server IP address. In active mode, the secondary agent transmits the collected data to the server where the IP is located. # but in mode, this parameter is ignored
3.# Note: system.hostname is a built-in ZABBIX method to automatically obtain the hostname. To facilitate configuration, it is recommended to enable this parameter and disable the Hostname parameter #.
4. HostnameItem=system.hostname / / system.hostname is an automatic hostname acquisition method built into ZABBIX. To facilitate configuration, it is recommended to enable this parameter and disable Hostname parameter #.
When the 5.LogFileSize=1 / / log file reaches how many M, it rotates and overwrites automatically.
6. StartPollersUnreachable=1 / / description: it is used to set the number of receiving processes for data submitted by SNMP STRAPPER scenarios. If the client has more SNMP TRAPPER technologies, it is recommended to increase this parameter value.
7.App / http://www.bkjia.com/xtzh/926118.html address
/ / the solution that server cannot receive information from proxy
Note: server will not receive configuration information until proxy is added to server.
/ / tail / var/log/zabbix/zabbix_proxy.log so that you can receive the message
And then automatically create one.
Agent:
Server: for proxy
Serveractive: for proxy
Proxy:server is zabbix.server
/ etc/zabbix/proxy/zabbix_proxy.conf
Server: it's zabbix-server 's ip.
/ etc/zabbix/proxy/zabbix_agent.conf
Server
Server.active / / are all ip addresses of zabbix--server
/ / it should be noted that there is no problem with the theory, just the problem of the virtual machine.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.