Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm-mysql-exporter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
system
gm-mysql-exporter
Commits
e3cb75d1
Commit
e3cb75d1
authored
Apr 04, 2019
by
胡凯旋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add project tag
parent
182c55bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
config.yaml.tpl
config.yaml.tpl
+2
-0
exporter.py
exporter.py
+5
-4
No files found.
config.yaml.tpl
View file @
e3cb75d1
...
...
@@ -61,6 +61,8 @@ tencent_instances:
memory_usage_factor: 1
# 数据库类型,主库(master)or从库(slave), 默认master
type: master
# 所属项目,默认gengmei, 选项 [gengmei/alpha]
project: gengmei
instance_id2:
name: instance_name2
...
...
exporter.py
View file @
e3cb75d1
...
...
@@ -57,11 +57,11 @@ class TencentExporter(Exporter):
metricname
=
metric
[
'name'
]
factor
=
metric
.
get
(
'factor'
,
None
)
avg_metric_family
=
GaugeMetricFamily
(
metricname
,
metricname
,
labels
=
[
'rds_name'
,
'type'
,
'service_provider'
'rds_name'
,
'type'
,
'service_provider'
,
'project'
])
with_factor_metricname
=
'{}_with_factor'
.
format
(
metricname
)
with_factor_metric_family
=
GaugeMetricFamily
(
with_factor_metricname
,
with_factor_metricname
,
labels
=
[
'rds_name'
,
'type'
,
'service_provider'
'rds_name'
,
'type'
,
'service_provider'
,
'project'
])
for
instance_data
in
instance_data_list
:
...
...
@@ -70,12 +70,13 @@ class TencentExporter(Exporter):
instance
=
self
.
instances
[
instance_id
]
instance_name
=
instance
[
'name'
]
instance_type
=
instance
.
get
(
'type'
,
'master'
)
instance_project
=
instance
.
get
(
'project'
,
'gengmei'
)
# 当前queryname,当前rds实例的因子,若没有配置,默认为1
rds_factor
=
instance
.
get
(
factor
,
1
)
for
value
in
timestamp_value_dict
.
values
():
avg_metric_family
.
add_metric
([
instance_name
,
instance_type
,
service_provider
],
value
)
avg_metric_family
.
add_metric
([
instance_name
,
instance_type
,
service_provider
,
instance_project
],
value
)
with_factor_metric_family
.
add_metric
(
[
'{}*{}'
.
format
(
instance_name
,
rds_factor
),
instance_type
,
service_provider
],
[
'{}*{}'
.
format
(
instance_name
,
rds_factor
),
instance_type
,
service_provider
,
instance_project
],
value
*
rds_factor
)
metrics_to_export
.
extend
([
avg_metric_family
,
with_factor_metric_family
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment