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