File: debci_containers

package info (click to toggle)
debci 3.13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,656 kB
  • sloc: ruby: 6,516; sh: 2,437; javascript: 100; makefile: 92; perl: 11
file content (40 lines) | stat: -rwxr-xr-x 1,399 bytes parent folder | download | duplicates (2)
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
39
40
#!/bin/sh
#
# Copyright (c) 2016 Antonio Terceiro
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
# 1991.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# Plugin to monitor the number of containers in a debci worker

if [ "$1" = "config" ]; then

	echo "graph_title number of debci containers per worker"
	echo 'graph_args --base 1000 -l 0'
	echo 'graph_vlabel Container'
	echo 'graph_category debci'
	echo 'graph_info This graph shows the number of containers in the host, by status.'
	echo 'graph_order stopped running'

	echo "running.label Running containers"
	echo "running.info Number of containers running"

	echo "stopped.label Stopped containers"
	echo "stopped.info Number of containers stopped"

	exit 0
fi

lxc-ls --fancy | awk '{ if (NR!=1 && $2 != "") {print(tolower($2))}}' | sort | uniq -c | awk '{print($2 ".value " $1)}'