From cdc34fa78b326bd241aae7399190c739e25bf025 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 20 Jun 2016 13:08:15 +1200 Subject: Update to latest version with MKLivestatus No longer using NDOUtils at work, these are much nicer and more likely to work with any given Nagios installation now anyway. Added nagios-data-search, nagios-downtstream-list, nagios-exists, nagios-problem-list, and nagios-unhandled-list. --- nagios-problem-list | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 nagios-problem-list (limited to 'nagios-problem-list') diff --git a/nagios-problem-list b/nagios-problem-list new file mode 100755 index 0000000..3927feb --- /dev/null +++ b/nagios-problem-list @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +# +# nagios-problem-list(1) -- List all the hosts and services in a problem state, +# handled or not +# +# $ npl +# +# Author: Tom Ryder +# Copyright: 2016 +# + +# Name self +self=nagios-problem-list + +# Usage printing function +usage() { + printf 'USAGE: %s [-h]\n' "$self" +} + +# By default we search hosts, not services +services=0 + +# Handle options, just -h help at the moment +OPTIND=1 +while getopts 'h' opt ; do + case "$opt" in + h) + usage + exit 0 + ;; + '?') + usage >&2 + exit 1 + ;; + esac +done +shift "$((OPTIND-1))" + +# Any arguments after that are abuse +if (($#)) ; then + usage >&2 + exit 1 +fi + +# Define the path to the Livestatus socket +socket=${MK_LIVESTATUS_SOCKET:-/usr/local/nagios/var/rw/live} + +unixcat "$socket" <