-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathweb_site_code_status_01
More file actions
46 lines (39 loc) · 946 Bytes
/
web_site_code_status_01
File metadata and controls
46 lines (39 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# author: kukangl
# mail: kuangl@orient-media.com
web_SITE_discovery ()
{
web_SITE=($(cat /usr/local/zabbix/scripts/web.txt))
printf '{\n'
printf '\t"data":[\n'
for((i=0;i<${#web_SITE[*]};++i))
{
num=$(echo $((${#web_SITE[*]}-1)))
if [ "$i" != ${num} ];
then
printf "\t\t{ \n"
printf "\t\t\t\"{#WEBNAME}\":\"${web_SITE[$i]}\"},\n"
else
printf "\t\t{ \n"
printf "\t\t\t\"{#WEBNAME}\":\"${web_SITE[$num]}\"}]}\n"
# printf '\t"over":]\n'
# printf '}\n'
fi
}
}
web_site_code ()
{
/usr/bin/curl -o /dev/null -s -w %{http_code} http://$1
}
case "$1" in
web_site_discovery)
web_SITE_discovery
;;
web_site_code)
web_site_code $2
;;
*)
echo "Usage:$0 {web_site_discovery|web_site_code [URL]}"
;;
esac
exit $?