[checkmk-commits] Check_MK Git: check_mk: apache_status: Optical cleanup of PNP template

Mathias Kettner mk at mathias-kettner.de
Wed Aug 27 10:59:57 CEST 2014


Module: check_mk
Branch: master
Commit: 4a0c8655245ff1c3d41d9fda9aa60c3d2a9d8630
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4a0c8655245ff1c3d41d9fda9aa60c3d2a9d8630

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Wed Aug 27 10:59:49 2014 +0200

apache_status: Optical cleanup of PNP template

---

 pnp-templates/check_mk-apache_status.php |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/pnp-templates/check_mk-apache_status.php b/pnp-templates/check_mk-apache_status.php
index 0513b50..f64e405 100644
--- a/pnp-templates/check_mk-apache_status.php
+++ b/pnp-templates/check_mk-apache_status.php
@@ -24,8 +24,6 @@
 # Boston, MA 02110-1301 USA.
 
 # Modded: Thomas Zyska (tzyska at testo.de)
-$i=0;
-
 $RRD = array();
 foreach ($NAME as $i => $n) {
     $RRD[$n] = "$RRDFILE[$i]:$DS[$i]:MAX";
@@ -35,25 +33,21 @@ foreach ($NAME as $i => $n) {
     $MAX[$n]  = $MAX[$i];
     $ACT[$n]  = $ACT[$i];
 }
+
+$total_slots = intval($ACT['TotalSlots']);
+
 #
 # First graph with all data
 #
+$i=1;
 $ds_name[$i] = "Apache Status";
 $def[$i]  = "";
 $opt[$i]  = " --vertical-label 'Connections' --title '$hostname: $servicedesc' -l 0";
 
 $def[$i] .= "DEF:varTotal=${RRD['TotalSlots']} ";
 $def[$i] .= "DEF:varOpen=${RRD['OpenSlots']} ";
-$def[$i] .= "HRULE:${ACT['TotalSlots']}#000000:\"Total Slots ${ACT['TotalSlots']}\" ";
-$def[$i] .= "COMMENT:\"\\n\" ";
-
-# get UsedSlots
-$def[$i] .= "CDEF:usedslots=varTotal,varOpen,- ";
-$def[$i] .= "GPRINT:usedslots:LAST:\"UsedSlots \t\t Last %5.1lf\" ";
-$def[$i] .= "GPRINT:usedslots:MAX:\"Max %5.1lf\" ";
-$def[$i] .= "GPRINT:usedslots:AVERAGE:\"Average %5.1lf\" ";
-$def[$i] .= "GPRINT:usedslots:LAST:\"Used %5.0lf of ${ACT['TotalSlots']}\" ";
-$def[$i] .= "COMMENT:\"\\n\" ";
+$def[$i] .= "HRULE:${ACT['TotalSlots']}#000000:\"Total Slots\\: ${total_slots}\\n\" ";
+$def[$i] .= "COMMENT:\" \\n\" ";
 
 foreach ($this->DS as $KEY=>$VAL) {
     if(preg_match('/^State_/', $VAL['NAME'])) {
@@ -66,6 +60,15 @@ foreach ($this->DS as $KEY=>$VAL) {
    }
 }
 
+# get UsedSlots
+$def[$i] .= "CDEF:usedslots=varTotal,varOpen,- ";
+$def[$i] .= "LINE:usedslots#ffffff:\"UsedSlots \t    \" ";
+$def[$i] .= "GPRINT:usedslots:LAST:\"Last %5.1lf\" ";
+$def[$i] .= "GPRINT:usedslots:MAX:\"Max %5.1lf\" ";
+$def[$i] .= "GPRINT:usedslots:AVERAGE:\"Average %5.1lf\\n\" ";
+# $def[$i] .= "GPRINT:usedslots:LAST:\"Used            %5.0lf of ${total_slots}\" ";
+$def[$i] .= "COMMENT:\"\\n\" ";
+
 #
 # Requests per Second
 #



More information about the checkmk-commits mailing list