24
24
def get_args ():
25
25
""" Parse Arguments """
26
26
parser = ArgumentParser (
27
- description = "Icinga/Nagios plugin which statistics of a \
28
- Container" ,
29
- epilog = ""
30
- )
27
+ description = "Icinga/Nagios plugin which checks health and statistics of a \
28
+ Container" )
31
29
parser .add_argument ("-c" , "--container" , required = True ,
32
30
help = "Name of the Container which should be checked" ,
33
31
type = str , dest = 'container_name' )
@@ -39,26 +37,28 @@ def get_args():
39
37
DOCKER_HOST" ,
40
38
type = str , dest = 'socket' ,
41
39
default = "unix:///var/run/docker.sock" )
42
- parser .add_argument ("--cpuwarn" , required = False ,
43
- help = "warning threshold for CPU usage (in %%)" ,
44
- type = float , dest = 'cpuwarn' )
45
- parser .add_argument ("--cpucrit" , required = False ,
46
- help = "critical threshold for CPU usage (in %%)" ,
47
- type = float , dest = 'cpucrit' )
48
- parser .add_argument ("--memwarn" , required = False ,
49
- help = "warning threshold for memory usage (in Bytes)" ,
50
- type = int , dest = 'memwarn' )
51
- parser .add_argument ("--memcrit" , required = False ,
52
- help = "critical threshold for memory usage (in Bytes)" ,
53
- type = int , dest = 'memcrit' )
54
- parser .add_argument ("--pidwarn" , required = False ,
55
- help = "warning threshold for number of processes in container" ,
56
- type = int , dest = 'pidwarn' )
57
- parser .add_argument ("--pidcrit" , required = False ,
58
- help = "critical threshold for number of processes in container" ,
59
- type = int , dest = 'pidcrit' )
60
40
parser .add_argument ('--wildcard' , dest = 'wildcard' , action = 'store_true' ,
61
41
help = "--container is a wildcard, not an exact match" )
42
+ thresholds = parser .add_argument_group ('Thresholds' )
43
+ thresholds .add_argument ("--cpuwarn" , required = False ,
44
+ help = "warning threshold for CPU usage (in %%)" ,
45
+ type = float , dest = 'cpuwarn' )
46
+ thresholds .add_argument ("--cpucrit" , required = False ,
47
+ help = "critical threshold for CPU usage (in %%)" ,
48
+ type = float , dest = 'cpucrit' )
49
+ thresholds .add_argument ("--memwarn" , required = False ,
50
+ help = "warning threshold for memory usage (in Bytes)" ,
51
+ type = int , dest = 'memwarn' )
52
+ thresholds .add_argument ("--memcrit" , required = False ,
53
+ help = "critical threshold for memory usage (in Bytes)" ,
54
+ type = int , dest = 'memcrit' )
55
+ thresholds .add_argument ("--pidwarn" , required = False ,
56
+ help = "warning threshold for number of processes in container" ,
57
+ type = int , dest = 'pidwarn' )
58
+ thresholds .add_argument ("--pidcrit" , required = False ,
59
+ help = "critical threshold for number of processes in container" ,
60
+ type = int , dest = 'pidcrit' )
61
+
62
62
args = parser .parse_args ()
63
63
return args
64
64
0 commit comments