Skip to content
Snippets Groups Projects
Commit 2ca21984 authored by Axel Hahn's avatar Axel Hahn
Browse files

switched elements from bootstrap v2 to v3

- upgrade used components
-- bootstrap 3.3.4
-- jquery 2.1.3
-- appmonitor
parent 56b76e89
No related branches found
No related tags found
No related merge requests found
...@@ -20,8 +20,9 @@ define("RESULT_ERROR", 3); ...@@ -20,8 +20,9 @@ define("RESULT_ERROR", 3);
* <br> * <br>
* --- HISTORY:<br> * --- HISTORY:<br>
* 2014-10-24 0.5 axel.hahn@iml.unibe.ch<br> * 2014-10-24 0.5 axel.hahn@iml.unibe.ch<br>
* 2015-04-08 0.9 axel.hahn@iml.unibe.ch added sochket test: checkPortTcp<br>
* --------------------------------------------------------------------------------<br> * --------------------------------------------------------------------------------<br>
* @version 0.5 * @version 0.9
* @author Axel Hahn * @author Axel Hahn
* @link TODO * @link TODO
* @license GPL * @license GPL
...@@ -283,7 +284,43 @@ class appmonitorcheck { ...@@ -283,7 +284,43 @@ class appmonitorcheck {
} }
} }
/**
* check if system is listening to a given port
* @param array $aParams
* array(
* "port"
* "host" (optional: 127.0.0.1 is default)
* )
* @return boolean
*/
private function checkPortTcp($aParams) {
$this->_checkArrayKeys($aParams, "port");
$sHost=array_key_exists('host',$aParams)?$aParams['host']:'127.0.0.1';
$iPort=(int)$aParams['port'];
// from http://php.net/manual/de/sockets.examples.php
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {
$this->_setReturn(RESULT_UNKNOWN, "ERROR: $sHost:$iPort was not checked. socket_create() failed: " . socket_strerror(socket_last_error()));
return false;
}
$result = socket_connect($socket, $sHost, $iPort);
if ($result === false) {
$this->_setReturn(RESULT_ERROR, "ERROR: $sHost:$iPort failed. " . socket_strerror(socket_last_error($socket)));
socket_close($socket);
return false;
} else {
$this->_setReturn(RESULT_OK, "OK: $sHost:$iPort was connected.");
socket_close($socket);
return true;
}
}
/** /**
* DEPRECATED - use checkPortTcp instead
* check if system is listening to a given port * check if system is listening to a given port
* @param array $aParams * @param array $aParams
* array( * array(
......
...@@ -15,8 +15,9 @@ ...@@ -15,8 +15,9 @@
* <br> * <br>
* --- HISTORY:<br> * --- HISTORY:<br>
* 2014-10-24 0.5 axel.hahn@iml.unibe.ch<br> * 2014-10-24 0.5 axel.hahn@iml.unibe.ch<br>
* 2014-11-21 0.6 axel.hahn@iml.unibe.ch removed meta::ts <br>
* --------------------------------------------------------------------------------<br> * --------------------------------------------------------------------------------<br>
* @version 0.5 * @version 0.6
* @author Axel Hahn * @author Axel Hahn
* @link TODO * @link TODO
* @license GPL * @license GPL
...@@ -77,7 +78,6 @@ class appmonitor { ...@@ -77,7 +78,6 @@ class appmonitor {
"host" => false, "host" => false,
"website" => false, "website" => false,
"ttl" => false, "ttl" => false,
"ts" => (int) date("U"),
"result" => false "result" => false
); );
...@@ -237,9 +237,9 @@ class appmonitor { ...@@ -237,9 +237,9 @@ class appmonitor {
if ($bHighlight) { if ($bHighlight) {
$aMsg=array( $aMsg=array(
0=>"OK", 0=>"OK",
1=>"WARNING", 1=>"UNKNOWN",
2=>"ERROR", 2=>"WARNING",
255=>"UNKNOWN" 3=>"ERROR"
); );
foreach(array_keys($aMsg) as $iCode){ foreach(array_keys($aMsg) as $iCode){
$sOut = preg_replace('/(\"result\":\ '.$iCode.')/', '$1 <span class="result'.$iCode.'"> &lt;--- '.$aMsg[$iCode].' </span>', $sOut); $sOut = preg_replace('/(\"result\":\ '.$iCode.')/', '$1 <span class="result'.$iCode.'"> &lt;--- '.$aMsg[$iCode].' </span>', $sOut);
...@@ -247,7 +247,7 @@ class appmonitor { ...@@ -247,7 +247,7 @@ class appmonitor {
$sOut = preg_replace('/:\ \"(.*)\"/U', ': "<span style="color:#66e;">$1</span>"', $sOut); $sOut = preg_replace('/:\ \"(.*)\"/U', ': "<span style="color:#66e;">$1</span>"', $sOut);
$sOut = preg_replace('/:\ ([0-9]*)/', ': <span style="color:#3a3; font-weight: bold;">$1</span>', $sOut); $sOut = preg_replace('/:\ ([0-9]*)/', ': <span style="color:#3a3; font-weight: bold;">$1</span>', $sOut);
$sOut = preg_replace('/\"(.*)\":/U', '"<span style="color:#e90;">$1</span>":', $sOut); $sOut = preg_replace('/\"(.*)\":/U', '"<span style="color:#840;">$1</span>":', $sOut);
$sOut = preg_replace('/([{\[])/', '$1<blockquote>', $sOut); $sOut = preg_replace('/([{\[])/', '$1<blockquote>', $sOut);
$sOut = preg_replace('/([}\]])/', '</blockquote>$1', $sOut); $sOut = preg_replace('/([}\]])/', '</blockquote>$1', $sOut);
...@@ -257,15 +257,17 @@ class appmonitor { ...@@ -257,15 +257,17 @@ class appmonitor {
$sOut = '<!DOCTYPE html><html><head>' $sOut = '<!DOCTYPE html><html><head>'
. '<style>' . '<style>'
. 'body{background:#282830; color:#9ac; font-family: verdana,arial;}'
. 'blockquote{background:rgba(215,180,255,0.03); border-left: 5px solid #222; margin-top: 0; padding: 0; ;}' . 'body{background:#e0e8f8; color:#235; font-family: verdana,arial;}'
. 'blockquote blockquote:hover{border-color: #345; }' . 'blockquote{background:rgba(0,0,0,0.03); border-left: 0px solid rgba(0,0,0,0.06); margin: 0 0 0 3em; padding: 0; border-radius: 1em; border-top-left-radius: 0;}'
. 'blockquote blockquote:hover{; }'
. 'blockquote blockquote blockquote:hover{border-color: #808;}' . 'blockquote blockquote blockquote:hover{border-color: #808;}'
. 'pre{background:#222; padding: 1em; border-radius: 1em;}' . 'pre{background:rgba(0,0,0,0.05); padding: 1em; border-radius: 1em;}'
. '.result0{background:#080; border-right: 1em solid #0f0;}' . '.result0{background:#aca; border-right: 0em solid #080;}'
. '.result1{background:#860; border-right: 1em solid #fc0;}' . '.result1{background:#666; border-right: 0em solid #ccc;}'
. '.result2{background:#800; border-right: 1em solid #f00;}' . '.result2{background:#fc9; border-right: 0em solid #860;}'
. '.result255{background:#666; border-right: 1em solid #ccc;}' . '.result3{background:#800; border-right: 0em solid #f00;}'
. '</style>' . '</style>'
. '<title>'.__CLASS__.'</title>' . '<title>'.__CLASS__.'</title>'
. '</head><body>' . '</head><body>'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment