Title: [opsview] [11534] Added 'Uptime Poller' service check, 'Uptime' is now passive, cascaded from Uptime Poller.
Revision
11534
Author
pknight
Date
2013-02-19 18:01:44 +0000 (Tue, 19 Feb 2013)

Log Message

Added 'Uptime Poller' service check, 'Uptime' is now passive, cascaded from Uptime Poller.
Removed 'ref's from the Opspack.

Modified Paths

Modified: trunk/opsview-core/import/opspacks_source/snmp-mib-ii/config.json
===================================================================
--- trunk/opsview-core/import/opspacks_source/snmp-mib-ii/config.json	2013-02-19 16:54:12 UTC (rev 11533)
+++ trunk/opsview-core/import/opspacks_source/snmp-mib-ii/config.json	2013-02-19 18:01:44 UTC (rev 11534)
@@ -14,49 +14,46 @@
          "description" : "SNMP checks for devices supporting MIB-II",
          "managementurls" : [],
          "name" : "SNMP - MIB-II",
-         "ref" : "/rest/config/hosttemplate/6",
          "servicechecks" : [
             {
                "exception" : null,
                "name" : "Discards",
-               "ref" : "/rest/config/servicecheck/186",
                "timed_exception" : null
             },
             {
                "exception" : null,
                "name" : "Errors",
-               "ref" : "/rest/config/servicecheck/185",
                "timed_exception" : null
             },
             {
                "exception" : null,
                "name" : "Interface",
-               "ref" : "/rest/config/servicecheck/184",
                "timed_exception" : null
             },
             {
                "exception" : null,
                "name" : "Interface Poller",
-               "ref" : "/rest/config/servicecheck/222",
                "timed_exception" : null
             },
             {
                "exception" : null,
                "name" : "Interface Status",
-               "ref" : "/rest/config/servicecheck/72",
                "timed_exception" : null
             },
             {
                "exception" : null,
                "name" : "SNMP Agent",
-               "ref" : "/rest/config/servicecheck/73",
                "timed_exception" : null
             },
             {
                "exception" : null,
                "name" : "Uptime",
-               "ref" : "/rest/config/servicecheck/74",
                "timed_exception" : null
+            },
+            {
+               "exception" : null,
+               "name" : "Uptime poller",
+               "timed_exception" : null
             }
          ]
       }
@@ -98,7 +95,6 @@
          "sensitive_arguments" : "1",
          "servicegroup" : {
             "name" : "Network - SNMP MIB-II",
-            "ref" : "/rest/config/servicegroup/2"
          },
          "stale_state" : "0",
          "stale_text" : "",
@@ -113,12 +109,10 @@
          "args" : "-H $HOSTADDRESS$ %INTERFACE:1% -D %INTERFACE:4%",
          "attribute" : {
             "name" : "INTERFACE",
-            "ref" : "/rest/config/attribute/2"
          },
          "calculate_rate" : "no",
          "cascaded_from" : {
             "name" : "Interface Poller",
-            "ref" : "/rest/config/servicecheck/222"
          },
          "check_attempts" : "3",
          "check_freshness" : "0",
@@ -150,7 +144,6 @@
          "sensitive_arguments" : "1",
          "servicegroup" : {
             "name" : "Network - SNMP MIB-II",
-            "ref" : "/rest/config/servicegroup/2"
          },
          "stale_state" : "0",
          "stale_text" : "",
@@ -165,12 +158,10 @@
          "args" : "-H $HOSTADDRESS$ %INTERFACE:1% -E %INTERFACE:3%",
          "attribute" : {
             "name" : "INTERFACE",
-            "ref" : "/rest/config/attribute/2"
          },
          "calculate_rate" : "no",
          "cascaded_from" : {
             "name" : "Interface Poller",
-            "ref" : "/rest/config/servicecheck/222"
          },
          "check_attempts" : "3",
          "check_freshness" : "0",
@@ -202,7 +193,6 @@
          "sensitive_arguments" : "1",
          "servicegroup" : {
             "name" : "Network - SNMP MIB-II",
-            "ref" : "/rest/config/servicegroup/2"
          },
          "stale_state" : "0",
          "stale_text" : "",
@@ -217,12 +207,10 @@
          "args" : "-H $HOSTADDRESS$ -i -o %INTERFACE:1% %INTERFACE:2%",
          "attribute" : {
             "name" : "INTERFACE",
-            "ref" : "/rest/config/attribute/2"
          },
          "calculate_rate" : "no",
          "cascaded_from" : {
             "name" : "Interface Poller",
-            "ref" : "/rest/config/servicecheck/222"
          },
          "check_attempts" : "3",
          "check_freshness" : "0",
@@ -236,7 +224,6 @@
          "dependencies" : [
             {
                "name" : "SNMP Agent",
-               "ref" : "/rest/config/servicecheck/73"
             }
          ],
          "description" : "SNMP interface throughput",
@@ -259,7 +246,6 @@
          "sensitive_arguments" : "1",
          "servicegroup" : {
             "name" : "Network - SNMP MIB-II",
-            "ref" : "/rest/config/servicegroup/2"
          },
          "stale_state" : "0",
          "stale_text" : "",
@@ -287,7 +273,6 @@
          "dependencies" : [
             {
                "name" : "SNMP Agent",
-               "ref" : "/rest/config/servicecheck/73"
             }
          ],
          "description" : "SNMP interface polling",
@@ -310,7 +295,6 @@
          "sensitive_arguments" : "1",
          "servicegroup" : {
             "name" : "Network - SNMP MIB-II",
-            "ref" : "/rest/config/servicegroup/2"
          },
          "stale_state" : "0",
          "stale_text" : "",
@@ -356,7 +340,6 @@
          "sensitive_arguments" : "1",
          "servicegroup" : {
             "name" : "Network - SNMP MIB-II",
-            "ref" : "/rest/config/servicegroup/2"
          },
          "stale_state" : "0",
          "stale_text" : "",
@@ -371,6 +354,52 @@
          "args" : "-H $HOSTADDRESS$ -C $SNMP_COMMUNITY$",
          "attribute" : null,
          "calculate_rate" : null,
+         "cascaded_from" : {
+            "name" : "Uptime poller",
+         },
+         "check_attempts" : "3",
+         "check_freshness" : "0",
+         "check_interval" : "5",
+         "checktype" : {
+            "name" : "Passive",
+         },
+         "critical_comparison" : null,
+         "critical_value" : null,
+         "dependencies" : [],
+         "description" : "Uptime of SNMP agent usually equivalent to device uptime",
+         "event_handler" : "",
+         "flap_detection_enabled" : "1",
+         "freshness_type" : "renotify",
+         "invertresults" : "0",
+         "keywords" : [],
+         "label" : null,
+         "level" : 0,
+         "markdown_filter" : "0",
+         "name" : "Uptime",
+         "notification_interval" : null,
+         "notification_options" : "w,c,r",
+         "oid" : null,
+         "plugin" : {
+            "name" : "check_snmp_uptime",
+         },
+         "retry_check_interval" : "1",
+         "sensitive_arguments" : "0",
+         "servicegroup" : {
+            "name" : "Network - SNMP MIB-II",
+         },
+         "stale_state" : "0",
+         "stale_text" : "",
+         "stale_threshold_seconds" : "3600",
+         "stalking" : null,
+         "volatile" : "0",
+         "warning_comparison" : null,
+         "warning_value" : null
+      },
+      {
+         "alert_from_failure" : "1",
+         "args" : "-H $HOSTADDRESS$ -C $SNMP_COMMUNITY$ -v $SNMP_VERSION$ -U $SNMP_AUTHUSERNAME$ -P $SNMP_AUTHPASSWORD$ -a $SNMP_AUTHPROTOCOL$ -x $SNMP_PRIVPASSWORD$ -e $SNMP_PRIVPROTOCOL$",
+         "attribute" : null,
+         "calculate_rate" : "",
          "cascaded_from" : null,
          "check_attempts" : "3",
          "check_freshness" : "0",
@@ -382,7 +411,7 @@
          "critical_comparison" : null,
          "critical_value" : null,
          "dependencies" : [],
-         "description" : "Uptime of SNMP agent usually equivalent to device uptime",
+         "description" : "Uptime poller",
          "event_handler" : "",
          "flap_detection_enabled" : "1",
          "freshness_type" : "renotify",
@@ -390,7 +419,7 @@
          "label" : null,
          "level" : 0,
          "markdown_filter" : "0",
-         "name" : "Uptime",
+         "name" : "Uptime poller",
          "notification_interval" : null,
          "notification_options" : "w,c,r",
          "oid" : null,
@@ -399,10 +428,9 @@
             "ref" : "/rest/config/plugin/check_snmp_uptime"
          },
          "retry_check_interval" : "1",
-         "sensitive_arguments" : "1",
+         "sensitive_arguments" : "0",
          "servicegroup" : {
             "name" : "Network - SNMP MIB-II",
-            "ref" : "/rest/config/servicegroup/2"
          },
          "stale_state" : "0",
          "stale_text" : "",

Modified: trunk/opsview-core/import/opspacks_source/snmp-mib-ii/info
===================================================================
--- trunk/opsview-core/import/opspacks_source/snmp-mib-ii/info	2013-02-19 16:54:12 UTC (rev 11533)
+++ trunk/opsview-core/import/opspacks_source/snmp-mib-ii/info	2013-02-19 18:01:44 UTC (rev 11534)
@@ -1,5 +1,5 @@
 NAME=com.opsview.opspack.snmp_mib_ii
-VERSION=1.0
+VERSION=2.0
 ALIAS=SNMP - MIB-II
 DEPENDENCIES=
 OPSVIEW_MIN_VERSION=

Modified: trunk/opsview-core/nagios-plugins/check_snmp_uptime
===================================================================
--- trunk/opsview-core/nagios-plugins/check_snmp_uptime	2013-02-19 16:54:12 UTC (rev 11533)
+++ trunk/opsview-core/nagios-plugins/check_snmp_uptime	2013-02-19 18:01:44 UTC (rev 11534)
@@ -43,6 +43,12 @@
     },
 );
 
+$np->add_arg(
+    'spec'    => 'cascade|c',
+    'help'    => "-c, --cascade PLUGIN\n   Plugin to cascade to",
+    'default' => ''
+);
+
 $np->getopts;
 
 my $oid_sysDescr =
@@ -51,6 +57,8 @@
 
 my $status       = 0;
 my $returnstring = "";
+my $prev_uptime  = 0;
+my $timeticks    = 0;
 
 # Cache file name
 my $hostname   = $np->opts->hostname;
@@ -67,6 +75,18 @@
     $status = 3;
 }
 
+if ( $np->opts->cascade ) {
+    if ( $prev_uptime > $timeticks ) {
+        require Opsview::Externalcommand;
+        my $cmd = Opsview::Externalcommand->new(
+            command => 'PROCESS_SERVICE_CHECK_RESULT',
+            args    => join( ';', $hostname, 'Uptime', '1', 'Uptime reset' ),
+        );
+        $cmd->send_to_master;
+        $np->nagios_exit( OK, 'OK' );
+    }
+}
+
 if ( $status == 0 ) {
     print "Status is OK - $returnstring\n";
 }
@@ -115,7 +135,6 @@
             return 1;
         }
     }
-    my $timeticks;
     foreach ( $s->var_bind_names() ) {
         $timeticks = $s->var_bind_list()->{$_};
     }

_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to