批量添加Nagios的脚本

Linux大全评论451 views阅读模式
  1. #!/bin/bash 
  2. #by cuiyuanrong 
  3. #QQ:295749093 
  4. #add ips to nagios 
  5.  
  6. for ips in `cat ips.txt` 
  7. do 
  8. echo -e "define host{ 
  9.         use           chunbai-host 
  10.         host_name     $ips 
  11.         alias         $ips 
  12.         address       $ips 
  13.         process_perf_data 1 
  14.         }" >> hosts.cfg 
  15.  
  16. sed -i "s/127.0.0.1/127.0.0.1,$ips/g" hostgroups.cfg 
  17. done 

企鹅博客
  • 本文由 发表于 2019年9月8日 03:37:42
  • 转载请务必保留本文链接:https://www.qieseo.com/154169.html

发表评论