/
install.shinken-monitoring.org
59 lines (49 loc) · 1.5 KB
/
install.shinken-monitoring.org
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
#!/bin/bash
CURDIR=`pwd`
SHINKEN_PACKAGE=shinken-1.2.tar.gz
SHINKEN_URI=http://www.shinken-monitoring.org/pub/$SHINKEN_PACKAGE
download_url() {
if [ -x "/usr/bin/curl" ] ; then
/usr/bin/curl -# -O $1
elif [ -x "/usr/bin/wget" ] ; then
/usr/bin/wget -q $1
else
echo "Unable to install Shinken: can't find wget or curl in /usr/bin."
exit 1
fi
}
do_with_root() {
# already root? "Just do it" (tm).
if [ `whoami` = 'root' ] ; then
$*
elif [ -x /bin/sudo -o -x /usr/bin/sudo ] ; then
echo
echo "Sudo detected, Shinken will request root privileges to"
echo "install. You may be prompted for a password. If you prefer to not use"
echo "sudo, please re-run this script as root."
echo "sudo $*"
sudo $*
else
echo "Shinken requires root privileges to install. Please re-run this script as"
echo "root."
exit 1
fi
}
TMPDIR=`mktemp -d -t shinken-install-XXXXXXX`
echo
echo "Preparing the temporary directory " $TMPDIR
cd "$TMPDIR"
download_url $SHINKEN_URI
echo
echo "Unziping the Shinken package" $SHINKEN_PACKAGE
tar xfz $SHINKEN_PACKAGE
cd shinken-*
do_with_root ./install -i
do_with_root ./install -p nagios-plugins
do_with_root ./install -p check_mem
do_with_root ./install -p manubulon
do_with_root ./install -a pnp4nagios
# Bail out
echo "Exiting"
cd "$CURDIR"
rm -rf "$TMPDIR"