Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Picametrics
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
Picasoft
Technique
Picametrics
Commits
4ccadd2f
Verified
Commit
4ccadd2f
authored
4 years ago
by
Quentin Duchemin
Browse files
Options
Downloads
Patches
Plain Diff
Better exception handling and informations on stdout
parent
508a84c7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
etherpad/etherpad.py
+6
-1
6 additions, 1 deletion
etherpad/etherpad.py
main.py
+13
-9
13 additions, 9 deletions
main.py
mattermost/mattermost.py
+2
-2
2 additions, 2 deletions
mattermost/mattermost.py
with
21 additions
and
12 deletions
etherpad/etherpad.py
+
6
−
1
View file @
4ccadd2f
...
...
@@ -75,6 +75,7 @@ class EtherpadCollector(object):
'
value
'
:
data
[
'
totalUsers
'
]
}
})
print
(
"
Etherpad : data collected for instance {}
"
.
format
(
instance
[
'
name
'
]))
return
metrics
...
...
@@ -88,7 +89,11 @@ class EtherpadCollector(object):
# Send request
stats_plugin
=
requests
.
get
(
instance
[
'
url
'
]
+
"
/stats.json
"
)
stats_native
=
requests
.
get
(
instance
[
'
url
'
]
+
"
/stats
"
)
if
stats_plugin
.
status_code
!=
200
or
stats_native
.
status_code
!=
200
:
if
stats_plugin
.
status_code
!=
200
:
print
(
"
Unable to get stats.json : HTTP {}
"
.
format
(
stats_plugin
.
status_code
))
return
None
if
stats_native
.
status_code
!=
200
:
print
(
"
Unable to get stats : HTTP {}
"
.
format
(
stats_plugin
.
status_code
))
return
None
try
:
plugin
=
json
.
loads
(
stats_plugin
.
text
)
...
...
This diff is collapsed.
Click to expand it.
main.py
+
13
−
9
View file @
4ccadd2f
...
...
@@ -47,15 +47,19 @@ def influxb_connect(config):
verify
=
True
# Connect to influx db
return
InfluxDBClient
(
host
=
o
.
hostname
,
port
=
port
,
username
=
config
[
'
user
'
],
password
=
config
[
'
password
'
],
database
=
config
[
'
database
'
],
ssl
=
ssl
,
verify_ssl
=
verify
)
try
:
return
InfluxDBClient
(
host
=
o
.
hostname
,
port
=
port
,
username
=
config
[
'
user
'
],
password
=
config
[
'
password
'
],
database
=
config
[
'
database
'
],
ssl
=
ssl
,
verify_ssl
=
verify
)
except
Exception
as
e
:
print
(
"
Cannot connect to {} : {}
"
.
format
(
o
.
hostname
,
e
))
print
(
"
If InfluxDB has just started, this is normal, please wait!
"
)
def
main
():
...
...
This diff is collapsed.
Click to expand it.
mattermost/mattermost.py
+
2
−
2
View file @
4ccadd2f
...
...
@@ -53,7 +53,7 @@ class MattermostCollector(object):
try
:
mat_api
.
login
()
except
Exception
as
err
:
print
(
"
Cannot login to {} : {}
"
.
format
(
instance
,
err
))
print
(
"
Cannot login to {} : {}
"
.
format
(
instance
[
'
name
'
]
,
err
))
continue
self
.
instances
.
append
(
{
...
...
@@ -157,7 +157,7 @@ class MattermostCollector(object):
'
value
'
:
daily_data
[
'
daily_users_with_posts
'
][
'
value
'
]
}
})
print
(
"
Mattermost : data collected for instance {}
"
.
format
(
instance
[
'
config
'
][
'
name
'
]))
return
metrics
@classmethod
...
...
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