[nagiosplug] check_nt: make UPTIME accept warning/critical ...

"Thomas Guyot-Sionnest" <[email protected]>
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
 Module: nagiosplug
 Branch: master
 Commit: 6989366b8d3ccd03b428610ca059f22be724f8be
 Author: Thomas Guyot-Sionnest <[email protected]>
   Date: Wed Oct 13 00:10:25 2010 -0400
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=6989366

check_nt: make UPTIME accept warning/critical levels

Patch originally by Ryan Kelly

---

 THANKS.in          |    1 +
 plugins/check_nt.c |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/THANKS.in b/THANKS.in
index 6666de4..ac2b1c2 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -265,3 +265,4 @@ Dann Frazier
 Stephane Chazelas
 Craig Leres
 Brian Landers
+Ryan Kelly
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index 32d4ff6..60806bb 100644
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
@@ -203,7 +203,12 @@ int main(int argc, char **argv){
 		uphours = (uptime % 86400) / 3600;
 		upminutes = ((uptime % 86400) % 3600) / 60;
 		asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
-		return_code=STATE_OK;
+		if (check_critical_value==TRUE && uptime <= critical_value)
+			return_code=STATE_CRITICAL;
+		else if (check_warning_value==TRUE && uptime <= warning_value)
+			return_code=STATE_WARNING;
+		else
+			return_code=STATE_OK;
 		break;
 
 	case CHECK_USEDDISKSPACE:


------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.