Thinking Analysis: Automatic discovery is actually the server's discovery rule in effect, found that the rule is responsible for detecting the host, detect the trigger action Action,action start Add host, add Host template event, if the server detects the host offline, then the discovery rules trigger another action, the implementation of removing the host , so here I'm going to add two action
1 Installing the agent on three CentOS hosts
IP is 90.90.90.5,90.90.90.6,90.90.90.7, respectively
The installation commands are generally as follows
#tar XF zabbix-2.4.6.tar.gz
#cd zabbix-2.4.6
#./configure--prefix=/usr/local--sysconfdir=/etc/zabbix--enable-agent
2 Add Discovery rule, do not enable, here time change, I forgot
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/32/wKiom1X3lPbghM_xAAJkRSeTW8c510.jpg "title=" 13.png "alt=" Wkiom1x3lpbghm_xaajkrsetw8c510.jpg "/>
3 Add the line action, notice the upper right corner select Discovery, conditions fill Discovery rule = i_find_you,discovery status = Discovered, add the host under Operation, Link template templates, I added the test NIC info, added to a group, I added the discovered hosts, and then select Enable the host
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/32/wKioL1X3uQuQcvrHAALNsoYXpBY176.jpg "title=" 14.png "alt=" Wkiol1x3uquqcvrhaalnsoyxpby176.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/35/wKiom1X3t7ijy5E4AAOHqwmk_TQ658.jpg "title=" 15.png "alt=" Wkiom1x3t7ijy5e4aaohqwmk_tq658.jpg "/>
Click Update to apply the action
4 Adding an outage action
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/37/wKioL1X33wqzrRunAAL0FQNTMYk353.jpg "title=" 22.png "alt=" Wkiol1x33wqzrrunaal0fqntmyk353.jpg "/>
Here I choose the condition is the offline time more than a minute to facilitate testing, and found that the status of lost, we do the following operation
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/3A/wKiom1X33I2QdbkYAALguvNHwN8562.jpg "title=" 21.png "alt=" Wkiom1x33i2qdbkyaalguvnhwn8562.jpg "/>
5 Start just Discovery rule
And then not for a few minutes, I went to the server log looked down, no fping incredibly
Source installation and then said permission denied, whether root, add the following suid is good, in short you just su-l Zabbix after the use of/usr/sbin/fping-s www.baidu.com success is no problem
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/3A/wKiom1X32NGyfvj1AAC75cuhyBw977.jpg "title=" 18.png "alt=" Wkiom1x32ngyfvj1aac75cuhybw977.jpg "/>
6 Go to the host section to view the next
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/37/wKioL1X32zbSKtc7AANVMzeCSRo694.jpg "title=" 19.png "alt=" wkiol1x32zbsktc7aanvmzecsro694.jpg "/> added successfully, and the template link success, today only to find that the previous few days of Perl problems, ignoring a few cases, the regular part of the modification of the line
#!/usr/bin/perl-w
My $nic = $ARGV [0];
My $type = $ARGV [1];
My $line = ' ifconfig $nic |grep bytes ';
My @info = $line =~/:(\d+\.? \d+) \s+/g;
if ("\u$type" eq "RX") {
Print $info [0];}
elsif ("\u$type" eq "TX") {
Print $info [1];}
else {
print 0;}
And so on after the blog changes, as for the other functions of the people to explore their own it
7 The status of the host to turn off, here I do not shut down, I did 5
Echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all prohibit ping reflow
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/37/wKioL1X33pSSwJdmAAUVJvUeRN0459.jpg "title=" 20.png "alt=" Wkiol1x33psswjdmaauvjvuern0459.jpg "/>
Now the head a bit dizzy, in fact, the specific situation, after all, monitoring I do not know very well.
This article is from the "Learning Path of Kai Learning" blog, please make sure to keep this source http://qixue.blog.51cto.com/7213178/1695016
Zabbix------Discovery Definition Auto-discovery