NAME
Monitoring::Sneck::Checks::config_value - checks values in config files
VERSION
Version 0.0.1
SYNOPSIS
!pass_max_days|control=CIS-5.5.1.1 framework=CIS|perl:config_value -f /etc/login.defs -e 'PASS_MAX_DAYS<=365' -e 'PASS_MIN_DAYS>=1'
!no_forwarding||perl:config_value -f /etc/sysctl.conf -S = -e net.ipv4.ip_forward=0 -d net.ipv4.ip_forward=0
!sendmail_off||perl:config_value -f /etc/rc.conf -S = -e sendmail_enable=NO|NONE
!umask||perl:config_value -f /etc/login.defs -e UMASK=027|077
DESCRIPTION
Reads a file of settings, one per line, and checks each given with --expect, the same way as Monitoring::Sneck::Checks::sysctl, with =, !=, <, <=, >, or >=. One that is not as wanted, or is not set and has no --default, is CRITICAL, as is the file not being readable.
By default the name and value are split by spaces or a =, as for login.defs and the like. --separator sets what splits them. Spaces around it, and quotes around the value, are dropped, so 'x="YES"' is x YES. Lines starting with # are left out, as is anything after a # that has a space before it.
The last value wins, as for rc.conf and sysctl.conf, unless --first is given. Names and values are compared without case, unless --case-sensitive is given.
OPTIONS
- -f, --file :: The file. Required.
- -e, --expect :: "name=value", or with !=, <, <=, >, or >=. May be given more than once. Required.
- -d, --default :: "name=value", what is used if it is not set. May be given more than once.
- -S, --separator :: What splits a name and its value. Default :: spaces or a =
- -F, --first :: The first value wins.
- -C, --case-sensitive :: Compare names and values with case.
METHODS
check
Does the check.
settings
Reads the file into a hash ref of names, lower cased unless --case-sensitive, to values. Returns why if it can not be read.