Zabbix踩坑之旅 —— B类地址的自动发现
前言:由于公司服务器较多,因此需要对多台主机做监控很麻烦,由此又踩了个坑。以下环境是Zabbix 2.4版本。
* 一、实现多主机密钥登陆
* 二、使用ansible对多主机进行安装agent
* 三、Zabbix添加自动发现
一、实现多主机密钥登陆
Zabbix server 创建密钥:
# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/meihua/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/meihua/.ssh/id_rsa.
Your public key has been saved in /home/meihua/.ssh/id_rsa.pub.
The key fingerprint is:
38:41:a2:fb:a0:1f:d8:4f:97:5c:dd:74:aa:af:c3:dd meihua@mh-test4
The key's randomart image is:
+--[ RSA 2048]----+
| . . |
| . o |
|. . . .|
| . o . o o |
|o o S . o |
| + o . + . |
|o o o +... . |
| . + . o.. E|
|. . .o. |
+-----------------+ 使用脚本将密钥传递给每个主机:
由于密码是在TXT中记录好的,新建一个文件导入即可
#!/bin/env bash
#
source /etc/profile
while read A;do
IP=$(echo $A|awk '{print $1}') * 取出主机IP
passwd=$(echo $A|awk '{print $3}') * 取出主机密码
/usr/bin/expect
页:
[1]