Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / agents / plugins / mk_docker_node
blob7bc1080cd171bcc2c5c3481da3a2543e2e1acfa8
1 #!/bin/bash
2 # +------------------------------------------------------------------+
3 # | ____ _ _ __ __ _ __ |
4 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
5 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
6 # | | |___| | | | __/ (__| < | | | | . \ |
7 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
8 # | |
9 # | Copyright Mathias Kettner 2016 mk@mathias-kettner.de |
10 # +------------------------------------------------------------------+
12 # This file is part of Check_MK.
13 # The official homepage is at http://mathias-kettner.de/check_mk.
15 # check_mk is free software; you can redistribute it and/or modify it
16 # under the terms of the GNU General Public License as published by
17 # the Free Software Foundation in version 2. check_mk is distributed
18 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
19 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
20 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
21 # tails. You should have received a copy of the GNU General Public
22 # License along with GNU Make; see the file COPYING. If not, write
23 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24 # Boston, MA 02110-1301 USA.
26 if type docker > /dev/null 2>&1; then
27 echo "<<<docker_node_info:sep(58)>>>"
28 # sed: protect leading whitespace
29 docker info | sed 's/^/|/'
31 echo "<<<docker_node_disk_usage:sep(0)>>>"
32 docker system df
34 echo "<<<docker_node_images>>>"
35 echo "[[[images]]]"
36 docker images --format "{{json .}}"
38 echo "[[[image_inspect]]]"
39 IMAGE_IDS=$(docker images | awk 'NR>1 {print $3}')
40 docker image inspect $IMAGE_IDS
42 echo "[[[containers]]]"
43 # equivalent of 'docker ps' for newer docker versions: 'docker container ls'
44 docker ps --all --format "{{json .}}"
46 echo "<<<docker_node_network:sep(0)>>>"
47 NETWORK_IDS=$(docker network ls -f 'driver=bridge' | awk 'NR>1 {print $1}')
48 docker network inspect $NETWORK_IDS