From f2d52219c6242a53121d802f3e1aa651fb1fb70b Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Mon, 6 Nov 2006 09:12:46 +0000
Subject: [PATCH] Added check_link_status and check_true.

---
 Makefile          |  4 +++-
 check_link_status | 19 +++++++++++++++++++
 check_true        |  7 +++++++
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100755 check_link_status
 create mode 100755 check_true

diff --git a/Makefile b/Makefile
index b597b6e..907b80d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,9 @@
 DESTDIR = /usr/local/nagios/libexec/
-SCRIPTS = check_cups check_glsa check_saned check_lpd check_hddtemp
+SCRIPTS = check_cups check_glsa check_saned check_lpd check_hddtemp \
+	check_link_status check_true
 
 all:;
 
 install:
+	mkdir -p $(DESTDIR)
 	for s in $(SCRIPTS); do install $$s $(DESTDIR)/$$s || exit 1; done
diff --git a/check_link_status b/check_link_status
new file mode 100755
index 0000000..e66008d
--- /dev/null
+++ b/check_link_status
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# This check script is maintained in a Subversion repository at
+# http://lsvn.lysator.liu.se/svnroot/nagios-plugins.  Contact
+# <ceder@lysator.liu.se> for commit access.
+
+LINK_TMP=`tempfile`
+trap "rm $LINK_TMP" 0
+sudo /sbin/mii-tool $1 > $LINK_TMP 2>&1
+grep 'link ok' < $LINK_TMP >/dev/null 2>&1
+RC=$?
+if [ $RC -eq 0 ]
+then
+    echo OK - link ok
+    exit 0
+else
+    echo CRITICAL - `cat $LINK_TMP`
+    exit 2
+fi
diff --git a/check_true b/check_true
new file mode 100755
index 0000000..5be3fbe
--- /dev/null
+++ b/check_true
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# This check script is maintained in a Subversion repository at
+# http://lsvn.lysator.liu.se/svnroot/nagios-plugins.  Contact
+# <ceder@lysator.liu.se> for commit access.
+
+echo OK - untestable, assumed OK
-- 
GitLab