From b07a8bf8401e9d9fdab73a70c9b527e3f43f3f59 Mon Sep 17 00:00:00 2001
From: hahn <axel.hahn@iml.unibe.ch>
Date: Fri, 6 Jul 2018 08:49:02 +0200
Subject: [PATCH] 2064-update appmonitor client * Client wurde aktualisiert. *
 IP-Restriction gesetzt * neu 8 Checks (vorher 2) * FIX: add slash in the
 sqlite check * set tags

---
 public_html/appmonitor/general_include.php | 24 ++++++++++++++++++++--
 public_html/appmonitor/index.php           |  1 +
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/public_html/appmonitor/general_include.php b/public_html/appmonitor/general_include.php
index 0b7b2dac..36cc8076 100644
--- a/public_html/appmonitor/general_include.php
+++ b/public_html/appmonitor/general_include.php
@@ -31,11 +31,31 @@ $oMonitor->checkIp(array(
 // $oMonitor->checkTokem('token', '123');
 
 
-
 // ----------------------------------------------------------------------
 // NOTIFICATION
 // ----------------------------------------------------------------------
 
 // $oMonitor->addEmail('sysadmin@example.com');
 // $oMonitor->addSlackWebhook(array("mywebhook"=> "https://hooks.slack.com/services/(...)"));
-$oMonitor->addEmail('axel.hahn@iml.unibe.ch');
\ No newline at end of file
+$oMonitor->addEmail('axel.hahn@iml.unibe.ch');
+
+
+// ----------------------------------------------------------------------
+// set a tag with phase
+// ----------------------------------------------------------------------
+$sHost=$_SERVER['HTTP_HOST'];
+$sHost2=$sHost=php_uname("n");   
+$sMyPhase='live';
+foreach (array('dev', 'preview', 'stage', 'demo') as $sPhase){
+    if(
+        strstr($sHost.'.', $sPhase)!==false
+        || strstr($sHost.'-', $sPhase)!==false
+        || strstr($sHost2.'.', $sPhase)!==false
+        || strstr($sHost2.'-', $sPhase)!==false
+    ) {
+        $sMyPhase=$sPhase;
+        break;
+    }
+}
+$oMonitor->addTag($sMyPhase);
+
diff --git a/public_html/appmonitor/index.php b/public_html/appmonitor/index.php
index 034078d5..9fb40bba 100644
--- a/public_html/appmonitor/index.php
+++ b/public_html/appmonitor/index.php
@@ -4,6 +4,7 @@ require_once('classes/appmonitor-client.class.php');
 $oMonitor = new appmonitor();
 @include 'general_include.php';
 
+$oMonitor->addTag('deployment');
 
 $oMonitor->addCheck(
         array(
-- 
GitLab