1. cd /opt/aspire/product/zabbix/bin/GLXXXX_WEB
2. vim glxxxx_web.sh
#!/bin/bash
url='/opt/aspire/product/zabbix/bin/GLXXXX_WEB/glxxxx_url'
#zabbix sender
hostname="LGJF-YWGLXT-IPMI-SERVER01"
zabbix_sender='/opt/aspire/product/zabbix/bin/zabbix_sender'
zabbix_proxy='10.3.0.23'
#logfile
write_log(){
logfile="/opt/aspire/product/zabbix/bin/GLXXXX_WEB/glxxxt_web.log"
datestring=`date "+%Y-%m-%d %H:%M:%S"`
echo $datestring $* >> $logfile
}
zabbix_sender(){
$zabbix_sender -s $hostname -z $zabbix_proxy -k "$key" -o $request_get_code
}
cat $url | while read line
do
key=`echo $line | awk -F'|' '{print $1}'`
url_info=`echo $line | awk -F'|' '{print $2}'`
request_get_code=`curl --connect-timeout 10 -o /dev/null -s -w %{http_code} $url_info`
logstring=`echo $key $request_get_code`
write_log $logstring
zabbix_sender
done
3. vim glxxxx_url
web_status[http://10.3.25.1:8000/api/monitor/certificateApply]|http://10.3.25.1:8000/api/monitor/certificateApply
web_status[http://10.3.25.1:8000/api/monitor/synSapOrgUser]|http://10.3.25.1:8000/api/monitor/synSapOrgUser
4. touch glxxxt_web.log
5. crontab -e
#拨测管理信息系统接口任务
*/10 * * * * sudo /opt/aspire/product/zabbix/bin/GLXXXX_WEB/glxxxx_web.sh &>/dev/null