Batch generation of Nagios monitoring hosts

Source: Internet
Author: User

#!/bin/bashexec <22.txtwhile read linedo############################# echo  ' Define  host {'  >>ping.host echo  '         use                       linux-server '  >>ping.host echo           host_name                 ' echo  $line |awk  ' {print $1} ' " >>ping.host echo "          alias                     ' echo  $line |awk  ' {print $1} '   '  >> ping.host echo  "        address                   ' echo  $line |awk  ' {print $2} '   '  >> ping.host echo  '         register                 1 '  >>ping.host echo   '         contact_groups           misadmin '  >>ping.host echo  "}"  >>ping.host ###### ####################################            #P   i n gecho  ' define service {'  >>ping.host echo  '          use                      generic-service '  >>ping.host echo   "&NBSP;&NBSP;&NBSP;&NBSP;&Nbsp;   host_name                 ' echo  $line |awk  ' {print $1} ' " >>ping.host echo "          service_description     linux_PING  "  >>ping.host echo  "        check_command            check_ping!100.0,20%!500.0,60%  " >> ping.host echo  ' register1 '  >>ping.host echo  ' contact_groupsmisadmin '  > >ping.host echo  "}"  >>ping.host###########################             #C  p u#################################################### ###########################                          #Memory       #$ echo  ' define  service {'  >>ping.host# echo  '         use                       generic-service '  >>ping.host# echo           host_name                 ' echo  $line |awk  ' {print $1} ' " >>ping.host# echo "          service_description     ESXi Memory  Usage " >>ping.host# echo  '         check_command            check_nrpe_memory '    >> ping.host# echo  ' RegisTer1 '  >>ping.host# echo  ' contact_groupsmisadmin '  >>ping.host# echo  " } " >>ping.host##########################################                                       #Network  echo  ' Define service  {'  >>ping.host echo  '         use                       generic-service '  >>ping.host echo           host_name                ' Echo   $line |awk  ' {print $1} ' " >>ping.host echo "          seRvice_description     linux_http " >>ping.host echo "          check_command            check_http '    >>ping.host echo  ' Register1 '  >>ping.host  echo  ' contact_groupsmisadmin '  >>ping.host echo  '} '  >>ping.host########### ##############################                echo  ' define service {'  >>ping.host echo  '          use                      generic-service '  >>ping.host echo  "         host_name                 ' echo  $line |awk  ' {print $1} ' " >>ping.host echo "          service_description     linux_ssh "  >>ping.host echo  '         check_command            check_ssh '    >>ping.host echo   ' register1 '  >>ping.host echo  ' contact_groupsmisadmin '  >>ping.host  echo  "}"  >>ping.host###########################################                     #io_read  echo  ' define service {'  >>ping.host echo  '          use                      Generic-service '  >>ping.host echo  '         host_ name                ' echo  $line |awk  ' {print $1} '  >>ping.host echo  '          service_description     linux_swap " >>ping.host echo   '         check_command            check_local_swap!20!10 '    >>ping.host echo  ' register1 '  >>ping.host echo  ' contact_groupsmisadmin '  >>ping.host echo  '} '  >>ping.host########################################### echo  ' define service {'  >>ping.host echo  '         use        &nbsP;             generic-service '  >> ping.host echo  "        host_name                 ' echo  $line |awk  ' {print $1} ' " >>ping.host echo "         service_description      linux-disk " >>ping.host echo "          check_command           check_ local_disk!20%!10%!/'    >>ping.host echo  ' Register1 '  >>ping.host  echo  ' contact_groupsmisadmin '  >>ping.host echo  '} '  >>ping.host##### ###################################### echo  ' define service {'  >>ping.host  echo  '         use                      generic-service '  >>ping.host echo  "         host_name                 ' echo  $line |awk  ' {print $1} ' " >>ping.host  echo  "        service_description      linux_users " >>ping.host echo "          Check_command           check_local_users!20!50 '     >>ping.host echo  ' register1 '  >>ping.host echo  ' contact_ Groupsmisadmin '  >>ping.host echo  "}"  >>ping.host############################## ################ #done


This article is from the "Starry Sky" blog, so be sure to keep this source http://liuxiaolan.blog.51cto.com/7789055/1621689

Batch generation of Nagios monitoring hosts

Related Article

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.