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
5d402351
Unverified
Commit
5d402351
authored
4 years ago
by
PICHOU Kyâne
Browse files
Options
Downloads
Patches
Plain Diff
Support Influx without authentication
parent
8eb327f3
No related branches found
Branches containing commit
Tags
v1.1
Tags containing commit
1 merge request
!2
Vmagent
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+22
-11
22 additions, 11 deletions
main.py
with
22 additions
and
11 deletions
main.py
+
22
−
11
View file @
5d402351
...
...
@@ -26,8 +26,8 @@ def influxb_connect(config):
:returns: InfluxDBClient object
"""
# Check configuration file
if
'
url
'
not
in
config
and
'
user
'
not
in
config
and
'
password
'
not
in
config
and
'
database
'
not
in
config
:
print
(
'
You need to add influxdb URL
, user, password
and database to configuration file.
'
)
if
'
url
'
not
in
config
and
'
database
'
not
in
config
:
print
(
'
You need to add influxdb URL and database to configuration file.
'
)
sys
.
exit
(
1
)
# Parse influx connection string
...
...
@@ -49,15 +49,26 @@ def influxb_connect(config):
# Connect to influx db
try
:
client
=
InfluxDBClient
(
host
=
o
.
hostname
,
port
=
port
,
username
=
config
[
'
user
'
],
password
=
config
[
'
password
'
],
database
=
config
[
'
database
'
],
ssl
=
ssl
,
verify_ssl
=
verify
)
if
'
user
'
in
config
and
'
password
'
in
config
:
# Influx authentication enabled
client
=
InfluxDBClient
(
host
=
o
.
hostname
,
port
=
port
,
username
=
config
[
'
user
'
],
password
=
config
[
'
password
'
],
database
=
config
[
'
database
'
],
ssl
=
ssl
,
verify_ssl
=
verify
)
else
:
# Influx authentication disabled
client
=
InfluxDBClient
(
host
=
o
.
hostname
,
port
=
port
,
database
=
config
[
'
database
'
],
ssl
=
ssl
,
verify_ssl
=
verify
)
client
.
ping
()
return
client
except
Exception
as
e
:
...
...
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