Didier Denoual
2 months ago
2 changed files with 51 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||
#!/bin/bash |
|||
#on récupère toutes les variables et mdp |
|||
KAZ_ROOT=/kaz |
|||
. $KAZ_ROOT/bin/.commonFunctions.sh |
|||
setKazVars |
|||
. $DOCKERS_ENV |
|||
. $KAZ_ROOT/secret/SetAllPass.sh |
|||
|
|||
URL_AGORA=https://$matterHost.$domain/api/v4 |
|||
EQUIPE=kaz |
|||
|
|||
PostMattermost() { |
|||
PostM=$1 |
|||
CHANNEL=$2 |
|||
TEAMID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" "${URL_AGORA}/teams/name/${EQUIPE}" | jq .id | sed -e 's/"//g') |
|||
CHANNELID=$(curl -s -H "Authorization: Bearer ${mattermost_token}" ${URL_AGORA}/teams/${TEAMID}/channels/name/${CHANNEL} | jq .id | sed -e 's/"//g') |
|||
curl -s i-X POST -i -H "Authorization: Bearer ${mattermost_token}" -d "{\"channel_id\":\"${CHANNELID}\",\"message\":\"${PostM}\"}" "${URL_AGORA}/posts" >/dev/null 2>&1 |
|||
} |
|||
|
|||
LISTEORGA=$(ls -F1 /var/lib/docker/volumes/ | grep cloudData | sed -e 's/^orga_//g' -e 's/-cloudData\///g') |
|||
for CLOUD in ${LISTEORGA} |
|||
do |
|||
/kaz/bin/gestContainers.sh -cloud -occ "maintenance:mode" ${CLOUD} | grep -i enable && PostMattermost "ERREUR : Le cloud ${CLOUD} est en mode maintenance" "Sysadmin-alertes" |
|||
done |
@ -0,0 +1,27 @@ |
|||
#!/bin/bash |
|||
# supervision de sympa |
|||
#KAZ_ROOT=$(cd "$(dirname $0)"/..; pwd) |
|||
KAZ_ROOT=/kaz |
|||
. $KAZ_ROOT/bin/.commonFunctions.sh |
|||
setKazVars |
|||
|
|||
. $DOCKERS_ENV |
|||
. $KAZ_ROOT/secret/SetAllPass.sh |
|||
|
|||
URL_AGORA=$(echo $matterHost).$(echo $domain) |
|||
MAX_QUEUE=50 |
|||
|
|||
OLDIFS=$IFS |
|||
IFS=" " |
|||
COUNT_MAILQ=$(docker exec -ti mailServ mailq | tail -n1 | gawk '{print $5}') |
|||
|
|||
docker exec ${mattermostServName} bin/mmctl --suppress-warnings auth login $httpProto://$URL_AGORA --name local-server --username $mattermost_user --password $mattermost_pass >/dev/null 2>&1 |
|||
|
|||
if [ "${COUNT_MAILQ}" -gt "${MAX_QUEUE}" ]; then |
|||
echo "---------------------------------------------------------- " |
|||
echo -e "Mail queue Postfix ALert, Messages: ${RED}${COUNT_MAILQ}${NC}" |
|||
echo "---------------------------------------------------------- " |
|||
docker exec mattermostServ bin/mmctl post create kaz:Sysadmin-alertes --message "Alerte mailq Postfix : La file d' attente est de ${COUNT_MAILQ} messages" >/dev/null 2>&1 |
|||
fi |
|||
|
|||
IFS=${OLDIFS} |
Loading…
Reference in new issue