/usr/share/nagios3/debian/httpd.webapps-common is in nagios3-cgi 3.5.1-1ubuntu1.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | # httpd-related functions
# taken from the webapps-common project
# copyright (c) 2005, sean finney (GPL)
wc_httpd_apaches="apache2"
# if they have not specified what they support, assume support for all
if [ ! "$wc_httpd_supported" ]; then
wc_httpd_supported="$wc_httpd_apaches"
fi
#
# wc_httpd_installed: test for installed httpds
# usage:
# wc_httpd_installed [ httpd1 httpd2 ... ]
#
# no arguments implies to test for all servers
wc_httpd_installed(){
local httpds
if [ "$*" ]; then
httpds=$*
else
httpds=$wc_httpd_supported
fi
for f in $httpds; do
if test -x /usr/sbin/$f; then
echo $f
fi
done
}
#
# wc_httpd_running: test for running httpds
# usage:
# wc_httpd_running [ httpd1 httpd2 ... ]
#
# no arguments implies to test for all servers
wc_httpd_running(){
local httpds
if [ "$*" ]; then
httpds=$*
else
httpds=$wc_httpd_supported
fi
for f in $httpds; do
if pgrep -fx "/usr/sbin/$f( .*)*$" >/dev/null; then
echo $f
fi
done
}
# wc_httpd_invoke: issue start/stop/etc command to web server init script
# usage:
# wc_httpd_invoke {start|stop|status|whatever} [ httpd1 httpd2 ... ]
#
# no servers implies to invoke all running servers
wc_httpd_invoke(){
local httpds cmd err
if [ ! "$1" ]; then
echo "i need at least a command!" 2>&1
return 1
fi
cmd="$1"
shift
if [ "$*" ]; then
httpds=$*
else
httpds=`wc_httpd_running`
fi
for f in $httpds; do
if [ -x /etc/init.d/$f ]; then
invoke-rc.d $f $cmd || return $?
fi
done
}
# wc_httpd_apache_include: include a file in the apache configuration
# usage:
# wc_httpd_apache_include file name [ httpd1 httpd2 ... ]
#
# no arguments implies all installed apache servers
wc_httpd_apache_include(){
local h incfile httpds confdir
if [ ! "$1" ]; then
echo "i need at least a file!" 2>&1
return 1
fi
incfile="$1"
shift
if [ ! "$1" ]; then
echo "i also need a name!" 2>&1
return 1
fi
name="$1"
shift
if [ ! -e "$incfile" ]; then
echo "include file $incfile does not exist!" 2>&1
return 1
fi
if [ "$*" ]; then
httpds=$*
else
httpds=`wc_httpd_installed $wc_httpd_supported`
fi
for h in $httpds; do
confdir="/etc/$h/conf.d"
conflink="$confdir/${name}.conf"
if [ -d "$confdir" -a ! -e "$conflink" ]; then
ln -s "$incfile" "$conflink"
fi
done
}
# wc_httpd_apache_configured: determine what servers are configured for a pkg
# usage:
# wc_httpd_apache_configured file name [ httpd1 httpd2 ... ]
#
# no arguments implies all installed apache servers
# outputs the list of servers that are configured with file->name
wc_httpd_apache_configured(){
local h incfile httpds confdir
if [ ! "$1" ]; then
echo "i need at least a file!" 2>&1
return 1
fi
incfile="$1"
shift
if [ ! "$1" ]; then
echo "i also need a name!" 2>&1
return 1
fi
name="$1"
shift
if [ ! -e "$incfile" ]; then
echo "include file $incfile does not exist!" 2>&1
return 1
fi
if [ "$*" ]; then
httpds=$*
else
httpds=`wc_httpd_installed $wc_httpd_supported`
fi
for h in $httpds; do
confdir="/etc/$h/conf.d"
conflink="$confdir/${name}.conf"
if [ -L "$conflink" ]; then
echo "$h "
fi
done
}
# wc_httpd_apache_uninclude: uninclude a file in the apache configuration
# usage:
# wc_httpd_apache_uninclude file name [ httpd1 httpd2 ... ]
#
# no arguments implies all installed apache servers
wc_httpd_apache_uninclude(){
local h incfile name httpds conflink
if [ ! "$1" ]; then
echo "i need at least a file!" 2>&1
return 1
fi
incfile="$1"
shift
if [ ! "$1" ]; then
echo "i also need a name!" 2>&1
return 1
fi
name="$1"
shift
if [ ! -e "$incfile" ]; then
echo "include file $incfile does not exist!" 2>&1
return 1
fi
if [ "$*" ]; then
httpds=$*
else
httpds=`wc_httpd_installed $wc_httpd_supported`
fi
for h in $httpds; do
conflink="/etc/$h/conf.d/${name}.conf"
if [ -L "$conflink" ]; then
rm -f "$conflink"
elif [ -e "$conflink" ]; then
echo "warning: $conflink exists but is not a link" >&2
fi
done
}
|