Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Monitor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
Monitor
Commits
191dd3a8
Commit
191dd3a8
authored
Dec 16, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of gitlab.laihua.com:linshizhi/monitor
parents
bd477469
647c9206
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Lib.hs
src/Lib.hs
+5
-5
No files found.
src/Lib.hs
View file @
191dd3a8
...
...
@@ -36,8 +36,8 @@ monitorUrls = [
defaultMI
"http://69.234.216.199:5001/ppt2newdraft"
]
buildCMD
::
WebHook
->
Msg
->
String
buildCMD
wh
msg
=
cmdFactory
::
WebHook
->
Msg
->
String
cmdFactory
wh
msg
=
"curl "
++
wh
++
" -H 'Content-Type: application/json'"
++
" -d '"
++
...
...
@@ -74,8 +74,8 @@ onFailure mi = do
connected
<-
checkServerConn
let
cmd
=
if
connected
then
buildCMD
webHook
(
"Fail to access api "
++
url
mi
)
else
buildCMD
webHook
"Server (69.234.216.199) down"
then
cmdFactory
webHook
(
"Fail to access api "
++
url
mi
)
else
cmdFactory
webHook
"Server (69.234.216.199) down"
current
<-
getCurrentTime
-- FIXME: system may failed need to check it's return code
...
...
@@ -86,7 +86,7 @@ onSuccess mi = do
current
<-
getCurrentTime
if
not
$
status
mi
then
do
let
cmd
=
buildCMD
webHook
(
"Api has recovered: "
++
url
mi
)
then
do
let
cmd
=
cmdFactory
webHook
(
"Api has recovered: "
++
url
mi
)
system
cmd
>>
return
(
MI
(
url
mi
)
True
current
)
else
return
mi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment