Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 2c73df0a authored by Guillaume Mella's avatar Guillaume Mella
Browse files

Helper script that computes a list of active machine for a list of vlans

parents
#!/bin/bash
#
#Plages Nom du VLAN
VLANS="129.88.191.0/24 SPR-OSUG
129.88.192.0/24 SPR-OSUG-DC
129.88.193.0/27 SPR-IPAG
152.77.134.32/27 VM-OSUG-DC-06
152.77.134.128/29 VM-OSUG-DC-01
152.77.134.136/29 VM-OSUG-DC-02
152.77.134.144/29 VM-OSUG-DC-03
152.77.134.176/28 VM-OSUG-ISTERRE
152.77.134.192/26 VM-OSUG-IPAG
152.77.135.56/30 VM-OSUG-OWNCLOUD
152.77.135.60/30 VM-OSUG-LDAP
152.77.135.100/30 VM-OSUG-URBASIS
152.77.135.104/30 VM-OSUG-MONITORING
152.77.135.144/28 VM-OSUG-DC-INFRA
152.77.135.160/27 VM-OSUG-DC-04
152.77.135.160/27 VM-OSUG-DC-05"
skipExpr="x670-bio-cermo\|spring-tn-osug"
handleIp(){
IP=$1
if HOSTR=$(host $IP)
then
HOST=${HOSTR##* }
if ! echo $HOST | grep $skipExpr &> /dev/null
then
echo "|$IP|$HOST| |"
fi
fi
}
handleVlan(){
ADDRESS=$1
NAME=$2
LPART=${ADDRESS%%/*}
NETSIZE=${ADDRESS##*/}
IPSUFFIX=${LPART%.*}
RIP=${LPART##*.}
let FROM="$RIP"
let TO="$FROM+2**(32-$NETSIZE)-2"
echo -e "^VLAN $NAME | $IPSUFFIX.$FROM -> $IPSUFFIX.$TO | Note |"
for IPNUM in $(seq $FROM $TO)
do
IP=$IPSUFFIX.$IPNUM
handleIp $IP
done
}
echo "$VLANS" | while read vlan ; do handleVlan $vlan; done
echo -e "\n\nNote: Filtered names using : '$skipExpr'"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment