Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
perun-proxy-utils
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
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
Perun
Perun ProxyIdP
perun-proxy-utils
Commits
5041bcde
Verified
Commit
5041bcde
authored
2 years ago
by
Jan Pavlíček
Browse files
Options
Downloads
Patches
Plain Diff
feat: script for running monitoring probes
parent
c47c8e9f
No related branches found
No related tags found
No related merge requests found
Pipeline
#261000
failed
2 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
perun/proxy/config_templates/run_probes_cfg.yaml
+16
-0
16 additions, 0 deletions
perun/proxy/config_templates/run_probes_cfg.yaml
perun/proxy/utils/run_probes.py
+49
-0
49 additions, 0 deletions
perun/proxy/utils/run_probes.py
setup.py
+1
-0
1 addition, 0 deletions
setup.py
with
66 additions
and
0 deletions
perun/proxy/config_templates/run_probes_cfg.yaml
0 → 100644
+
16
−
0
View file @
5041bcde
check_mongodb
:
path
:
nagios/check_mongodb.py
runs
:
-
host
:
hostname
u
:
mongoadmin
p
:
password
A
:
connect
W
:
2
C
:
4
-
host
:
hostname
u
:
mongoadmin
p
:
password
A
:
connections
W
:
70
C
:
80
This diff is collapsed.
Click to expand it.
perun/proxy/utils/run_probes.py
0 → 100644
+
49
−
0
View file @
5041bcde
import
argparse
import
os
import
sys
from
threading
import
Thread
import
yaml
def
parse_args
():
parser
=
argparse
.
ArgumentParser
(
prog
=
"
MonitoringProbes
"
,
description
=
"
runs monitoring probes defined in config
"
)
parser
.
add_argument
(
"
-c
"
,
"
--config
"
,
required
=
True
,
help
=
"
Filepath to config
"
)
args
=
parser
.
parse_args
()
return
args
.
config
def
open_file
(
filepath
):
try
:
with
open
(
filepath
)
as
f
:
return
f
.
read
()
except
OSError
as
e
:
print
(
f
"
Cannot open config with path:
{
filepath
}
, error:
{
e
.
strerror
}
"
,
file
=
sys
.
stderr
)
exit
(
2
)
def
run_probe
(
command
):
os
.
system
(
command
)
def
main
():
config
=
yaml
.
safe_load
(
open_file
(
parse_args
()))
if
not
config
:
return
for
name
,
options
in
config
.
items
():
for
args
in
options
.
get
(
"
runs
"
):
probe_run_builder
=
"
python
"
+
options
[
"
path
"
]
for
arg_name
,
arg_val
in
args
.
items
():
if
len
(
arg_name
)
==
1
:
arg_name
=
"
-
"
+
arg_name
else
:
arg_name
=
"
--
"
+
arg_name
probe_run_builder
+=
"
"
+
arg_name
+
"
"
+
str
(
arg_val
)
Thread
(
target
=
run_probe
,
args
=
[
probe_run_builder
]).
start
()
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
5041bcde
...
...
@@ -13,5 +13,6 @@ setuptools.setup(
"
asyncssh~=2.13
"
,
"
docker~=6.0
"
,
"
beautifulsoup4~=4.12
"
,
"
yaml~=6.0
"
,
],
)
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