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
b7df4aae
Commit
b7df4aae
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Add nextcloud domains to uptime as well
parent
c7704419
No related branches found
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
+36
-14
36 additions, 14 deletions
action_plugins/uptime.py
with
36 additions
and
14 deletions
action_plugins/uptime.py
+
36
−
14
View file @
b7df4aae
...
...
@@ -92,10 +92,20 @@ class ActionModule(ActionBase):
options
=
self
.
config
.
options
(
'
Domains
'
)
if
self
.
config
.
has_section
(
'
Paths
'
):
paths
=
self
.
config
.
options
(
'
Paths
'
)
else
:
paths
=
{}
if
self
.
config
.
has_section
(
'
Matches
'
):
matches
=
self
.
config
.
options
(
'
Matches
'
)
else
:
matches
=
{}
display
.
vv
(
'
Process hosts
'
)
for
host
in
self
.
vars
.
get
(
'
ansible_play_hosts
'
):
display
.
vv
(
'
-
'
+
host
)
self
.
_host
(
host
,
options
)
self
.
_host
(
host
,
options
,
paths
,
matches
)
result
[
'
msg
'
]
=
'
Completed successfully!
'
return
result
...
...
@@ -201,17 +211,17 @@ class ActionModule(ActionBase):
return
False
def
_buildUrl
(
self
,
item
,
field
):
def
_buildUrl
(
self
,
item
,
field
,
path
):
authPrefix
=
''
auth
=
item
.
get
(
'
apache_auth
'
)
if
auth
and
auth
.
get
(
'
type
'
)
==
'
Basic
'
:
authPrefix
=
auth
.
get
(
'
user
'
)
+
'
:
'
+
auth
.
get
(
'
password
'
)
+
'
@
'
url
=
item
.
get
(
'
protocol
'
,
'
https
'
)
+
'
://
'
+
authPrefix
+
item
.
get
(
field
)
uptime
=
item
.
get
(
'
uptime
'
)
if
uptime
:
if
uptime
and
'
path
'
in
uptime
:
path
=
uptime
.
get
(
'
path
'
)
if
path
:
url
+=
'
/
'
+
path
if
path
and
path
!=
''
:
url
+=
'
/
'
+
path
return
url
...
...
@@ -262,7 +272,7 @@ class ActionModule(ActionBase):
return
check
def
_host
(
self
,
host
,
options
):
def
_host
(
self
,
host
,
options
,
paths
,
matches
):
host_vars
=
self
.
vars
[
'
hostvars
'
][
host
]
for
option
in
options
:
display
.
vv
(
'
-
'
+
option
)
...
...
@@ -270,10 +280,18 @@ class ActionModule(ActionBase):
if
items
:
parts
=
self
.
config
.
get
(
'
Domains
'
,
option
).
split
(
'
.
'
)
field
=
parts
.
pop
()
self
.
_part
(
host_vars
,
items
,
0
,
parts
,
field
)
def
_part
(
self
,
host_vars
,
items
,
level
,
parts
,
field
):
if
option
in
paths
:
path
=
self
.
config
.
get
(
'
Paths
'
,
option
)
else
:
path
=
''
if
option
in
matches
:
match
=
self
.
config
.
get
(
'
Matches
'
,
option
)
else
:
match
=
''
self
.
_part
(
host_vars
,
items
,
0
,
parts
,
field
,
path
,
match
)
def
_part
(
self
,
host_vars
,
items
,
level
,
parts
,
field
,
path
,
match
):
if
len
(
parts
)
>
level
:
next
=
parts
[
level
]
level
+=
1
...
...
@@ -281,17 +299,21 @@ class ActionModule(ActionBase):
for
item
in
items
:
nextitems
=
item
.
get
(
next
)
if
nextitems
:
self
.
_part
(
host_vars
,
nextitems
,
level
,
parts
,
field
)
self
.
_part
(
host_vars
,
nextitems
,
level
,
parts
,
field
,
path
,
match
)
else
:
for
item
in
items
:
value
=
item
.
get
(
field
)
if
value
:
display
.
vv
(
'
'
+
value
)
self
.
_processItem
(
host_vars
,
item
,
field
)
if
match
!=
''
:
if
not
item
.
has_key
(
'
pollerParams
'
):
item
[
'
pollerParams
'
]
=
{}
item
[
'
pollerParams
'
][
'
match
'
]
=
'
/
'
+
match
+
'
/
'
self
.
_processItem
(
host_vars
,
item
,
field
,
path
)
def
_processItem
(
self
,
host_vars
,
item
,
field
):
url
=
self
.
_buildUrl
(
item
,
field
)
def
_processItem
(
self
,
host_vars
,
item
,
field
,
path
):
url
=
self
.
_buildUrl
(
item
,
field
,
path
)
check
=
self
.
_buildCheck
(
host_vars
,
item
,
url
)
tracker_source
=
check
.
get
(
'
tracker_source
'
,
''
)
tracker_project_include
=
check
.
get
(
'
tracker_project_include
'
,
''
)
...
...
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