commit dc6ebb5a12c267ceba4d7a383e33332be892d630d7f09c24f8df7baec5b3f329 Author: Lars Vogdt Date: Sun Dec 28 13:14:55 2014 +0000 remove old link to Factory OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-nis?expand=0&rev=3 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/check_nis_1.2 b/check_nis_1.2 new file mode 100644 index 0000000..9577f41 --- /dev/null +++ b/check_nis_1.2 @@ -0,0 +1,147 @@ +#!/bin/sh +############################################### +# +# Nagios script to check NIS status on a host +# +# Copyright 2007, 2008 Ian Yates +# +# See usage for command line switches +# +# Created: 2006-07-04 (i.yates@uea.ac.uk) +# Updated: 2007-07-30 (i.yates@uea.ac.uk) - Added user lookup and error checking +# Updated: 2008-11-27 (i.yates@uea.ac.uk) - Added GPLv3 licence +# +# 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, either version 3 of the License, or +# (at your option) any later version. +# +# 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, see . +# +############################################### + +. /usr/local/nagios/libexec/utils.sh + + +VERSION="1.2" + +AWK=/bin/awk +SED=/bin/sed +GREP=/bin/grep +YPPOLL=/usr/sbin/yppoll +YPCAT=/usr/bin/ypcat + + +FLAG_VERBOSE=FALSE +NIS_HOST="" +NIS_DOMAIN="" +NIS_USER_TEST="" +RESULT="" +EXIT_STATUS=$STATE_OK + + +############################################### +# +## FUNCTIONS +# + +## Print usage +usage() { + echo " check_nis $VERSION - Nagios NIS check script" + echo "" + echo " Usage: check_nis -H -d [ -u ] [ -v ] [ -h ]" + echo "" + echo " -H Name of host running the NIS service you wish to check" + echo " -d NIS domain" + echo " -u Username to query NIS with" + echo " -v Verbose output" + echo " -h Show this page" + echo "" +} + +## Process command line options +doopts() { + if ( `test 0 -lt $#` ) + then + while getopts H:d:u:vh myarg "$@" + do + case $myarg in + h|\?) + usage + exit;; + H) + NIS_HOST=$OPTARG;; + d) + NIS_DOMAIN=$OPTARG;; + u) + NIS_USER_TEST=$OPTARG;; + v) + FLAG_VERBOSE=TRUE;; + *) # Default + usage + exit;; + esac + done + else + usage + exit + fi +} + + +# Write output and return result +theend() { + echo $RESULT + exit $EXIT_STATUS +} + + +# +## END FUNCTIONS +# + +############################################# +# +## MAIN +# + + +# Handle command line options +doopts $@ + +# Do the do +OUTPUT=`$YPPOLL -h $NIS_HOST -d $NIS_DOMAIN passwd.byname 2> /dev/null | $GREP 'is supported'` +if test "$OUTPUT" != "" ; then + if test -n "$NIS_USER_TEST" ; then + ## If we're checking user lookup + OUTPUT=`$YPCAT -h $NIS_HOST -d $NIS_DOMAIN passwd | grep $NIS_USER_TEST` + if test -n "$OUTPUT" ; then + OUTPUT=`echo "$OUTPUT" | grep "RPC"` + if test "$OUTPUT" != "" ; then + RESULT="NIS CRITICAL - domain $NIS_DOMAIN, user \"$NIS_USER_TEST\" lookup failed" + EXIT_STATUS=$STATE_CRITICAL + else + RESULT="NIS OK - domain $NIS_DOMAIN, user \"$NIS_USER_TEST\" lookup succeeded" + EXIT_STATUS=$STATE_OK + fi + else + RESULT="NIS CRITICAL - domain $NIS_DOMAIN, user \"$NIS_USER_TEST\" lookup failed" + EXIT_STATUS=$STATE_CRITICAL + fi + else + RESULT="NIS OK - domain $NIS_DOMAIN" + EXIT_STATUS=$STATE_OK + fi +else + RESULT="NIS CRITICAL - domain $NIS_DOMAIN not answering" + EXIT_STATUS=$STATE_CRITICAL +fi + +# Quit and return information and exit status +theend diff --git a/monitoring-plugins-nis.changes b/monitoring-plugins-nis.changes new file mode 100644 index 0000000..b177e06 --- /dev/null +++ b/monitoring-plugins-nis.changes @@ -0,0 +1,29 @@ +------------------------------------------------------------------- +Wed Jul 30 10:53:34 UTC 2014 - lars@linux-schulserver.de + +- package renamed to monitoring-plugins-nis + +------------------------------------------------------------------- +Thu Jul 12 20:56:17 UTC 2012 - lars@linux-schulserver.de + +- specfile cleanup: + + fix URL + + fix license to be in spdx format + + use nagios-rpm-macros + +------------------------------------------------------------------- +Mon Sep 26 10:55:16 UTC 2011 - coolo@suse.com + +- remove nonsense requires to licenses + +------------------------------------------------------------------- +Mon Dec 1 17:19:11 CET 2008 - lrupp@suse.de + +- update to 1.2: Author added license information +- add licenses package to requires + +------------------------------------------------------------------- +Fri Jul 25 16:10:05 CEST 2008 - lrupp@suse.de + +- initial version 1.1 + diff --git a/monitoring-plugins-nis.spec b/monitoring-plugins-nis.spec new file mode 100644 index 0000000..36ebe33 --- /dev/null +++ b/monitoring-plugins-nis.spec @@ -0,0 +1,68 @@ +# +# spec file for package monitoring-plugins-nis +# +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: monitoring-plugins-nis +Version: 1.2 +Release: 0 +Summary: Check the status of a NIS server on a specified host and NIS domain +License: GPL-3.0+ +Group: System/Monitoring +Url: https://www.monitoringexchange.org/inventory/Check-Plugins/Operating-Systems/Linux/check_nis +Provides: nagios-plugins-nis = %{version}-%{release} +Obsoletes: nagios-plugins-nis <= 1.2 +Source0: check_nis_%{version} +BuildRequires: nagios-rpm-macros +Requires: yp-tools +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildArch: noarch + +%description +Check the status of a NIS server on a specified host and NIS domain by asking +NIS server for "passwd.byname". + +As an additional check, a username may be specified which will then be +"looked up" on the NIS server, note that this is optional and only +introduced in v1.1 + +Script returns OK if it gets an acceptable answer, CRITICAL if not. + +This *nix script has been designed and written for the lowest common +denominator of shells (sh), uses yppoll, ypcat and grep as external +commands. + +%prep + +%build + +%install +mkdir -p %{buildroot}/%{nagios_plugindir} +sed -e "s|/usr/local/nagios/libexec|%{nagios_plugindir}|g; \ + s|FLAG_VERBOSE=FALSE|unset LANG;\n\nFLAG_VERBOSE=FALSE|g" %{SOURCE0} > %{buildroot}/%{nagios_plugindir}/check_nis +chmod +x %{buildroot}/%{nagios_plugindir}/check_nis + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +# avoid build dependecy of nagios - own the dirs +%dir %{nagios_libdir} +%dir %{nagios_plugindir} +%{nagios_plugindir}/check_nis + +%changelog