最近線上機器猛增,添加監控挺煩人的,就動手寫了一個小腳本。ios
- #!/bin/bash
- #by cuiyuanrong
- #QQ:295749093
- #add ips to nagios
- for ips in `cat ips.txt`
- do
- echo -e "define host{
- use chunbai-host
- host_name $ips
- alias $ips
- address $ips
- process_perf_data 1
- }" >> hosts.cfg
- sed -i "s/127.0.0.1/127.0.0.1,$ips/g" hostgroups.cfg
- done
有問題,能夠聯繫我,O(∩_∩)O~sql