-
Notifications
You must be signed in to change notification settings - Fork 30
/
check_cdot_clusterconfig.sh
executable file
·38 lines (30 loc) · 1.26 KB
/
check_cdot_clusterconfig.sh
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
#!/bin/bash
# --
# check_cdot_clusterconf - Check some Configurations on all nodes
# Copyright (C) 2013 noris network AG, http://www.noris.net/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --
HOSTNAME=$1
USERNAME=$2
NODES=$(ssh $USERNAME@$HOSTNAME "node show" | awk '$0 ~ "entries were displayed" { print $1 }')
VLAN_DIFF=$(ssh $USERNAME@$HOSTNAME "network port vlan show -fields vlan-name" | awk '{ print $2 }' | grep ^a0a | sort | uniq -u)
FAILOVER_DIFF=$(ssh $USERNAME@$HOSTNAME "network interface failover-groups show -fields targets" | awk -F ',' 'NF != '$NODES' && $1 !~ "[0-9]_[0-9]" && $1 ~ "(failover_|([0-9]{1,3}.){4})" { print $0}')
if [ -n "$VLAN_DIFF" ] || [ -n "$FAILOVER_DIFF" ]; then {
if [ -n "$VLAN_DIFF" ]; then
echo "VLAN configuration is different: $VLAN_DIFF"
fi
if [ -n "$FAILOVER_DIFF" ]; then
echo "Failover-Group configuration is different: $FAILOVER_DIFF"
fi
exit 2
} else {
echo "Configuration is OK"
exit 0
}; fi
# Authors
#
# Alexander Krogloth <git at krogloth.de>
# Micha Krause < micha at noris.net>