]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/monitoring/plugins/check_git
Change syden’s url
[perso/Immae/Config/Nix.git] / modules / private / monitoring / plugins / check_git
1 #!/usr/bin/env bash
2
3 SSH_KEY="$1"
4
5 TMPDIR=$(mktemp -d)
6
7 if [ ! -d "$TMPDIR" ]; then
8 echo "gitolite UNKNOWN - impossible to create temp dir"
9 exit 3
10 fi
11
12 trap "rm -rf $TMPDIR" EXIT
13
14 ERRORS=""
15 OUTPUT=""
16
17 cd "$TMPDIR"
18 OUT=$(git clone -q git://git.immae.eu/perso/Immae/Projets/Ruby/Monitor.git 2>&1)
19 ERR=$?
20 if [ -n "$OUT" ]; then
21 OUTPUT="$OUTPUT
22 $OUT"
23 fi
24 if [ "$ERR" != 0 ]; then
25 ERRORS="$ERRORS git://"
26 fi
27 rm -rf Monitor
28
29 OUT=$(git clone -q http://git.immae.eu/perso/Immae/Projets/Ruby/Monitor.git 2>&1)
30 ERR=$?
31 if [ -n "$OUT" ]; then
32 OUTPUT="$OUTPUT
33 $OUT"
34 fi
35 if [ "$ERR" != 0 ]; then
36 ERRORS="$ERRORS http://"
37 fi
38 rm -rf Monitor
39
40 OUT=$(git clone -q https://git.immae.eu/perso/Immae/Projets/Ruby/Monitor.git 2>&1)
41 ERR=$?
42 if [ -n "$OUT" ]; then
43 OUTPUT="$OUTPUT
44 $OUT"
45 fi
46 if [ "$ERR" != 0 ]; then
47 ERRORS="$ERRORS https://"
48 fi
49 rm -rf Monitor
50
51 OUT=$(GIT_SSH_COMMAND="ssh -i $SSH_KEY -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no" git clone -q gitolite@git.immae.eu:perso/Immae/Projets/Ruby/Monitor 2>&1)
52 ERR=$?
53 if [ -n "$OUT" ]; then
54 OUTPUT="$OUTPUT
55 $OUT"
56 fi
57 if [ "$ERR" != 0 ]; then
58 ERRORS="$ERRORS ssh"
59 fi
60 rm -rf Monitor
61
62 if [ -n "$ERRORS" ]; then
63 echo "gitolite CRITICAL - impossible to clone via$ERRORS|$OUTPUT"
64 exit 2
65 else
66 echo "gitolite OK - ssh, git, http and https work|$OUTPUT"
67 exit 0
68 fi