Skip to content
Snippets Groups Projects
Commit 1a7cc3d1 authored by Dennis Ahrens's avatar Dennis Ahrens
Browse files

Provide missing local checks from check-mk-plugins repository as states

parent 19d1e45b
Branches
Tags
No related merge requests found
Showing with 287 additions and 8 deletions
...@@ -59,19 +59,20 @@ It is a custom plugin from us - located in `checkmk/custom-files/gluster`. ...@@ -59,19 +59,20 @@ It is a custom plugin from us - located in `checkmk/custom-files/gluster`.
It provies a plugin `checkmk/custom-files/plugins/mount.gluster` to yield glusterfs mounts in the `<<<mounts>>>` section. It provies a plugin `checkmk/custom-files/plugins/mount.gluster` to yield glusterfs mounts in the `<<<mounts>>>` section.
It also provides a [local check](https://checkmk.com/cms_localchecks.html) that provides information about the glusterfs volumes and bricks. It also provides a [local check](https://checkmk.com/cms_localchecks.html) that provides information about the glusterfs volumes and bricks.
### `checkmk.debian.netstat`
Installs the [netstat.linux](https://checkmk.com/cms_check_netstat.html) agent plugin
### `checkmk.debian.nginx_status`
Installs the [nginx_status](https://checkmk.com/cms_check_nginx_status.html) agent plugin.
### `checkmk.debian.monitoring-exitcodes` ### `checkmk.debian.monitoring-exitcodes`
Installs the `monitoring-exitcodes` agent local check. Installs the `monitoring-exitcodes` agent local check.
Use it together with [hshtaskrunner](https://lab.it.hs-hannover.de/tools/hshtaskrunner). Use it together with [hshtaskrunner](https://lab.it.hs-hannover.de/tools/hshtaskrunner).
### `checkmk.debian.logstats.*`
Installs local checks that work on potentionally large log files.
Available states are:
* `checkmk.debian.logstats.radsecproxy` counts accepted and rejected login attempts
* `checkmk.debian.logstats.freeradius` counts failed and successful logins
* `checkmk.debian.logstats.postfix` creates a lot of metrics regarding our mailfrontend stack
### `checkmk.debian.mk_apt` ### `checkmk.debian.mk_apt`
Installs the [mk_apt](https://checkmk.com/cms_check_apt.html) agent plugin Installs the [mk_apt](https://checkmk.com/cms_check_apt.html) agent plugin
...@@ -84,6 +85,14 @@ Installs the [mk_logins](https://checkmk.com/cms_check_logins.html) agent plugin ...@@ -84,6 +85,14 @@ Installs the [mk_logins](https://checkmk.com/cms_check_logins.html) agent plugin
Installs the [mk_postgres](https://checkmk.com/cms_check_postgres_stats.html) agent plugin Installs the [mk_postgres](https://checkmk.com/cms_check_postgres_stats.html) agent plugin
### `checkmk.debian.netstat`
Installs the [netstat.linux](https://checkmk.com/cms_check_netstat.html) agent plugin
### `checkmk.debian.nginx_status`
Installs the [nginx_status](https://checkmk.com/cms_check_nginx_status.html) agent plugin.
### `checkmk.debian.radsec` ### `checkmk.debian.radsec`
Installs the radsec plugin. Installs the radsec plugin.
......
How custom files are placed here.
* `local` files here go to `/usr/lib/check_mk_agent/local`
* `plugins` files here go to `/usr/lib/check_mk_agent/plugins`
* `lib` files here go to `/usr/local/bin` and can be used by the other two.
#!/bin/bash
#
# This script is supposed to be called periodically.
# It goes through the last few lines of a freeradius log and counts events.
# The resulting numbers are then reported in the simple check_mk format.
#
# Debugging option
#set -x
# Go into appropriate directory
cd `dirname $0`
# Include log watch functions
. ./logwatch.functions.sh
# Use helper function to get $log_start and $log_end for current log
lookAtLog "/var/log/freeradius/radius.log" "freeradius-logstats.db"
### Initialize counters ###
login_ok=0
login_incorrect=0
### Do the statistics ###
login_ok=$(getLogLines | grep ' cli ' | grep 'Login OK' | wc -l)
login_incorrect=$(getLogLines | grep ' cli ' | grep 'Login incorrect' | wc -l)
### Report counter results ###
echo "P Freeradius-logstats login-ok=$login_ok|login-incorrect=$login_incorrect Additional metrics from freeradius"
# That's it.
exit 0
#!/bin/bash
# This function requires these variables to be set:
# $1 - Path of logfile to look at
# $2 - Path of file to store log offsets in
# This function sets these variables, which define the range of lines to look at:
# - log_start
# - log_end
function lookAtLog {
logfile=$1
dbfile=$2
### First time setup (if required)
if [ ! -f "$dbfile" ]; then
# Get initial log position
log_end=$(wc -l $logfile | cut -d ' ' -f 1)
# Write initial log position
echo $log_end > $dbfile
fi
# Get old log position
log_start=$(cat $dbfile)
# Get new log position
log_end=$(wc -l $logfile | cut -d ' ' -f 1)
# Write new log position into file
echo $log_end > $dbfile
# Make sure we do not have a log rotation going on
# This is the case when log_start > log_end.
if [ $log_end -lt $log_start ]; then
# In this case we start reading the new file from its beginning
log_start=0
fi
}
# This function requires these variables to be set:
# $logfile - The file to inspect
# $log_start - The line offset where to start inspecting
# $log_end - The line offset where to stop inspecting
function getLogLines {
sed -n "$log_start","$log_end"p $logfile
}
#!/bin/bash
#
# This script is supposed to be called periodically.
# It goes through the last few lines of a postfix mail.info log and counts events.
# The resulting numbers are then reported in the simple check_mk format.
#
# Debugging option
#set -x
# Go into appropriate directory
cd `dirname $0`
# Include log watch functions
. ./logwatch.functions.sh
# Use helper function to get $log_start and $log_end for current log
lookAtLog "/var/log/mail.info" "postfix-logstats.db"
### Initialize counters ###
log_lines_total=0
log_lines_smtp=0
log_lines_smtpd=0
mo_sent=0
mo_deferred=0
mo_bncd_total=0
mo_bncd_spam=0
mo_bncd_reputation=0
mo_deliverable=0
mo_undeliverable=0
mi_accept=0
mi_reject=0
mi_proxy_accept=0
mi_proxy_reject=0
mi_connects=0
mi_connects_tls=0
mi_dmarc_pass=0
mi_dmarc_fail=0
mi_dmarc_none=0
mi_dkim_signed=0
mi_dkim_error=0
mo_dkim_signed=0
mo_dkim_unsigned=0
### Do the statistics ###
# Collect number of log lines
log_lines_total=`expr $log_end - $log_start`
log_lines_smtp=$(getLogLines | grep '\/smtp\[' | wc -l)
log_lines_smtpd=$(getLogLines | grep '\/smtpd\[' | wc -l)
# Collect outbound email statistics - localhost is excluded.
mo_sent=$( getLogLines | grep '\/smtp\[' | grep 'status=sent' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l)
mo_deferred=$( getLogLines | grep '\/smtp\[' | grep 'status=deferred' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l)
mo_deliverable=$( getLogLines | grep '\/smtp\[' | grep 'status=deliverable' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l)
mo_undeliverable=$( getLogLines | grep '\/smtp\[' | grep 'status=undeliverable' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l)
mo_bncd_total=$( getLogLines | grep '\/smtp\[' | grep 'status=bounced' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l)
mo_bncd_spam=$( getLogLines | grep '\/smtp\[' | grep 'status=bounced' | grep -i 'spam' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l)
mo_bncd_reputation=$( getLogLines | grep '\/smtp\[' | grep -i 'reputation' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l)
# Collect inbound email statistics
mi_accept=$(getLogLines | grep '\/smtpd\[' | grep '\/smtpd\[' | grep ': [0-9A-F]*: client=' | wc -l)
mi_reject=$(getLogLines | grep '\/smtpd\[' | grep ': NOQUEUE: reject:' | wc -l)
mi_proxy_accept=$(getLogLines | grep '\/smtpd\[' | grep ': proxy-accept: END-OF-MESSAGE: ' | wc -l)
mi_proxy_reject=$(getLogLines | grep '\/smtpd\[' | grep ': proxy-reject: END-OF-MESSAGE: ' | wc -l)
# Collect connection data
mi_connects=$(getLogLines | grep '\/smtpd\[' | grep ': connect from' | wc -l)
mi_connects_tls=$(getLogLines | grep '\/smtpd\[' | grep 'Anonymous TLS connection established from' | wc -l)
# Collect DMARC data
mi_dmarc_pass=$(getLogLines | grep 'opendmarc\[' | grep 'pass$' | wc -l)
mi_dmarc_fail=$(getLogLines | grep 'opendmarc\[' | grep 'fail$' | wc -l)
mi_dmarc_none=$(getLogLines | grep 'opendmarc\[' | grep 'none$' | wc -l)
# Collect DKIM data
mi_dkim_signed=$(getLogLines | grep 'opendkim\[' | grep 'SSL$\|message has signatures from' | wc -l)
mi_dkim_error=$(getLogLines | grep 'opendkim\[' | grep -v 'SSL$\|message has signatures from\|DKIM-Signature field added\|no signing table match for' | wc -l)
mo_dkim_signed=$(getLogLines | grep 'opendkim\['| grep 'DKIM-Signature field added' | wc -l)
mo_dkim_unsigned=$(getLogLines | grep 'opendkim\['| grep 'no signing table match for' | wc -l)
### Report counter results ###
echo "P Postfix-logstats sent=$mo_sent|deferred=$mo_deferred|deliverable=$mo_deliverable|undeliverable=$mo_undeliverable|bounced=$mo_bncd_total|bounced-spam=$mo_bncd_spam|bounced-reputation=$mo_bncd_reputation|accepted=$mi_accept|proxy-accepted=$mi_proxy_accept|rejected=$mi_reject|proxy-rejected=$mi_proxy_reject|connections-in=$mi_connects|tls-connections-in=$mi_connects_tls|dmarc-pass=$mi_dmarc_pass|dmarc-fail=$mi_dmarc_fail|dmarc-none=$mi_dmarc_none|dkim-signed-in=$mi_dkim_signed|dkim-error-in=$mi_dkim_error|dkim-signed-out=$mo_dkim_signed|dkim-unsigned-out=$mo_dkim_unsigned Additional metrics related to postfix"
# That's it.
exit 0
#!/bin/bash
#
# This script is supposed to be called periodically.
# It goes through the last few lines of a radsecproxy log and counts events.
# The resulting numbers are then reported in the simple check_mk format.
#
# Debugging option
#set -x
# Go into appropriate directory
cd `dirname $0`
# Include log watch functions
. ./logwatch.functions.sh
# Use helper function to get $log_start and $log_end for current log
lookAtLog "/var/log/radsecproxy.log" "radsecproxy-logstats.db"
### Initialize counters ###
login_ok=0
login_incorrect=0
### Do the statistics ###
access_accept=$(getLogLines | grep 'Access-Accept for user' | wc -l)
access_reject=$(getLogLines | grep 'Access-Reject for user' | wc -l)
### Report counter results ###
echo "P RadSecProxy-logstats access-accept=$access_accept|access-reject=$access_reject Additional metrics from RadSecProxy"
# That's it.
exit 0
#!/bin/bash
# I just call a program provided in /usr/local/bin
/usr/local/bin/freeradius-logstats.sh
\ No newline at end of file
#!/bin/bash
# I just call a program provided in /usr/local/bin
/usr/local/bin/postfix-logstats.sh
\ No newline at end of file
#!/bin/bash
# I just call a program provided in /usr/local/bin
/usr/local/bin/radsecproxy-logstats.sh
\ No newline at end of file
/usr/local/bin/logwatch.functions.sh
file.managed:
- source: salt://checkmk/custom-files/lib/logwatch.functions.sh
- mode: 755
- user: root
- group: root
\ No newline at end of file
include:
- lib
/usr/local/bin/freeradius-logstats.sh
file.managed:
- source: salt://checkmk/custom-files/lib/freeradius-logstats.sh
hsh_checkmk_freeradius_logstats:
file.managed:
- name: /usr/lib/check_mk_agent/local/freeradius-logstats
- source: salt://checkmk/custom-files/local/freeradius-logstats
- mode: 755
- user: root
- group: root
include:
- lib
/usr/local/bin/postfix-logstats.sh
file.managed:
- source: salt://checkmk/custom-files/lib/postfix-logstats.sh
- mode: 755
- user: root
- group: root
hsh_checkmk_postfix_logstats:
file.managed:
- name: /usr/lib/check_mk_agent/local/postfix-logstats
- source: salt://checkmk/custom-files/local/postfix-logstats
- mode: 755
- user: root
- group: root
include:
- lib
/usr/local/bin/radsecproxy-logstats.sh
file.managed:
- source: salt://checkmk/custom-files/lib/radsecproxy-logstats.sh
- mode: 755
- user: root
- group: root
hsh_checkmk_radsecproxy_logstats:
file.managed:
- name: /usr/lib/check_mk_agent/local/radsecproxy-logstats
- source: salt://checkmk/custom-files/local/radsecproxy-logstats
- mode: 755
- user: root
- group: root
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment