more webcheck.template
###################WEBURL define start###################
define service{
use generic-service ; Name of service template to use
host_name webcheck
service_description WEBURL
check_command check_webpage!-H WEBURL -u INDEX
is_volatile 0
max_check_attempts 3
check_interval 1
retry_interval 1
check_period 24x7
notification_interval 5
notification_period 24x7
notification_options w,u,r,c
contact_groups admins
}
###################WEBURL define end###################
[root@bogon webcheckes]# more create.sh
#!/bin/bash
PATH=/bin:$PATH:$HOME/bin:/sbin:/usr/bin:/usr/sbin
export PATH
#echo $PATH
usage () {
echo -en "USAGE: $0 [web list] or $0 [template] [web list]\nFor example: $0 host.template host.list(Field : [WEB URL] [INDEX WEB PAGE])\n" 1>&2
exit 1
}
if [ $# -gt 2 ];then
usage
exit 1
fi
case "$#" in
2)
template=$1
host_list=$2
;;
1)
template='webcheck.template'
host_list=$1
;;
0)
# template='webcheck.template'
# host_list='host.list'
usage
;;
esac
if [ ! -f "${template}" ];then
echo "template : ${template} not exist!" 1>&2
exit 1
fi
if [ ! -f "${host_list}" ];then
echo "host list : ${host_list} not exist!" 1>&2
exit 1
fi
#echo $PWD/${host_list}
WEBTEMP="wcalltemp.txt"
rm $PWD/${WEBTEMP}
#cat $PWD/${host_list}
/bin/cat $PWD/${host_list}|
while read weburl index
do
#echo "${ip}"|grep -oP '^\d{1,3}(\.\d{1,3}){3}$' >/dev/null 2>&1 || Field='not ip'
#if [ "${Field}" = 'not ip' ];then
# echo "${ip} not ip!" 1>&2
# exit 1
#fi
#host_cfg="${hostname}-${ip}.cfg"
tmppage="webtemp.txt"
cp ${template} ${tmppage}
sed -i "s/WEBURL/${weburl}/g;s/INDEX/${index}/g" ${tmppage}
/bin/cat ${tmppage}>>${WEBTEMP}
done
/bin/cat webcheck_org.template>webcheck_${host_list}.cfg
/bin/cat ${WEBTEMP}>>webcheck_${host_list}.cfg
rm $PWD/${WEBTEMP}
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有