Monday, February 6, 2017

Docker container monitoring script for Nagios

#!/bin/bash

CONTAINER=ubuntu

RUNNING=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null)

if [ "$RUNNING" == "false" ]; then
  echo "CRITICAL - $CONTAINER is not running."
  exit 2
else
echo "OK - $CONTAINER is running."
exit  0

fi

No comments:

Post a Comment