Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Imldeployment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Imldeployment
Commits
2ca21984
Commit
2ca21984
authored
10 years ago
by
Axel Hahn
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public_html/appmonitor/appmonitor-checks.class.php
+38
-1
38 additions, 1 deletion
public_html/appmonitor/appmonitor-checks.class.php
public_html/appmonitor/appmonitor-client.class.php
+16
-14
16 additions, 14 deletions
public_html/appmonitor/appmonitor-client.class.php
with
54 additions
and
15 deletions
public_html/appmonitor/appmonitor-checks.class.php
+
38
−
1
View file @
2ca21984
...
@@ -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(
...
...
This diff is collapsed.
Click to expand it.
public_html/appmonitor/appmonitor-client.class.php
+
16
−
14
View file @
2ca21984
...
@@ -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
.
'"> <--- '
.
$aMsg
[
$iCode
]
.
' </span>'
,
$sOut
);
$sOut
=
preg_replace
(
'/(\"result\":\ '
.
$iCode
.
')/'
,
'$1 <span class="result'
.
$iCode
.
'"> <--- '
.
$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:#
e9
0;">$1</span>":'
,
$sOut
);
$sOut
=
preg_replace
(
'/\"(.*)\":/U'
,
'"<span style="color:#
84
0;">$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>'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment