Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uptime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
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
Ansible
Plugins
uptime
Commits
46516ae0
Commit
46516ae0
authored
9 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Include Mattermost into Uptime
parent
920162b1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
action_plugins/uptime.py
+19
-7
19 additions, 7 deletions
action_plugins/uptime.py
with
19 additions
and
7 deletions
action_plugins/uptime.py
+
19
−
7
View file @
46516ae0
...
...
@@ -203,10 +203,22 @@ class ActionModule(ActionBase):
}
def
_buildCheck
(
self
,
item
,
url
):
def
_addHostSettings
(
self
,
host_vars
,
section
,
check
):
settings
=
host_vars
.
get
(
section
)
if
settings
:
for
key
in
settings
:
item
=
section
+
'
_
'
+
key
check
[
item
]
=
settings
[
key
]
if
not
item
in
self
.
pollerParams
:
self
.
pollerParams
.
append
(
item
)
return
check
def
_buildCheck
(
self
,
host_vars
,
item
,
url
):
check
=
self
.
_defaultCheck
()
check
[
'
url
'
]
=
url
check
[
'
type
'
]
=
item
.
get
(
'
protocol
'
,
'
https
'
)
check
=
self
.
_addHostSettings
(
host_vars
,
'
mattermost
'
,
check
)
uptime
=
item
.
get
(
'
uptime
'
)
if
uptime
:
for
key
in
self
.
_defaultCheck
():
...
...
@@ -236,10 +248,10 @@ class ActionModule(ActionBase):
if
items
:
parts
=
self
.
config
.
get
(
'
Domains
'
,
option
).
split
(
'
.
'
)
field
=
parts
.
pop
()
self
.
_part
(
items
,
0
,
parts
,
field
)
self
.
_part
(
host_vars
,
items
,
0
,
parts
,
field
)
def
_part
(
self
,
items
,
level
,
parts
,
field
):
def
_part
(
self
,
host_vars
,
items
,
level
,
parts
,
field
):
if
len
(
parts
)
>
level
:
next
=
parts
[
level
]
level
+=
1
...
...
@@ -247,18 +259,18 @@ class ActionModule(ActionBase):
for
item
in
items
:
nextitems
=
item
.
get
(
next
)
if
nextitems
:
self
.
_part
(
nextitems
,
level
,
parts
,
field
)
self
.
_part
(
host_vars
,
nextitems
,
level
,
parts
,
field
)
else
:
for
item
in
items
:
value
=
item
.
get
(
field
)
if
value
:
display
.
vv
(
'
'
+
value
)
self
.
_processItem
(
item
,
field
)
self
.
_processItem
(
host_vars
,
item
,
field
)
def
_processItem
(
self
,
item
,
field
):
def
_processItem
(
self
,
host_vars
,
item
,
field
):
url
=
self
.
_buildUrl
(
item
,
field
)
check
=
self
.
_buildCheck
(
item
,
url
)
check
=
self
.
_buildCheck
(
host_vars
,
item
,
url
)
existing
=
self
.
_findExistingCheck
(
url
,
check
[
'
type
'
])
if
existing
:
if
check
[
'
enabled
'
]:
...
...
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