How to Get zabbix to monitor the IP addresses of all machines

Source: Internet
Author: User

Objective: To obtain the IP addresses of all monitored machine hosts in zabbix

 

Method 1 use zabbix API to interface Python Program

Method 2 directly use the database for query and export

 

Here we will use method 2 to introduce

Mysql-uusername-ppassword log on to MySQL

Mysql> Use zabbix select zabbix Library

Mysql> select * from interface limit; table for viewing interface information. One field in the table is IP address (the hosts table contains the host and name fields, but there is no interface IP field)
+ ------------- + -------- + ------ + ------- + ---------------- + ----- + ------- +
| Interfaceid | hostid | main | type | useip | IP | DNS | Port |
+ ------------- + -------- + ------ + ------- + ---------------- + ----- + ------- +
| 255 | 10361 | 1 | 1 | 1 | 192.168.213.21 | 10050 |
| 256 | 10362 | 1 | 1 | 1 | 192.168.213.22 | 10050 |
| 257 | 10363 | 1 | 1 | 1 | 192.168.213.23 | 10050 |
| 258 | 10364 | 1 | 1 | 1 | 192.168.213.24 | 10050 |
| 259 | 10365 | 1 | 1 | 1 | 192.168.213.25 | 10050 |
| 261 | 10367 | 1 | 1 | 1 | 192.168.213.27 | 10050 |
| 262 | 10368 | 1 | 1 | 1 | 192.168.213.28 | 10050 |
| 263 | 10369 | 1 | 1 | 1 | 192.168.213.29 | 10050 |
| 264 | 10370 | 1 | 1 | 1 | 192.168.213.30 | 10050 |
| 265 | 10371 | 1 | 1 | 1 | 192.168.213.31 | 10050 |
+ ------------- + -------- + ------ + ------- + ---------------- + ----- + ------- +

 


Mysql> select * from interface into OUTFILE '/tmp/zabbix. ip'; the table has been exported in text format (note that the exported path is required for database login. You have the write permission for this path, and the/tmp permission is 777)

 

How to Get zabbix to monitor the IP addresses of all machines

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.