Advertisement
Guest User

tapuz-nagios

a guest
Jul 22nd, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. cd /usr/local/nagios/etc/objects/services/
  4. NEWSERVICE=$(ls *.conf | sort -h | tail -n 1 | cut -f1 -d".")
  5.  
  6. while read MONITOR OBJ SEVERITY
  7. do
  8.     (( NEWSERVICE++ ))
  9.    
  10.     cat <<EOF> ${NEWSERVICE}.conf
  11. define service{
  12.        host_name              mysql
  13.        service description  ${NEWSERVICE}
  14.        check_command     check_dummy!${SEVERITY}!"$MONITOR $OBJ"
  15. active_checks_enabled 0
  16. passive_checks_enabled 1
  17.        
  18. check_freshness 1      
  19. freshness_threshold 4000
  20.        }
  21.     EOF
  22. done
  23.  
  24. systemctl reload nagios
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement