Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
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
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
7746a2b3
Commit
7746a2b3
authored
9 years ago
by
Cameron Sparr
Browse files
Options
Downloads
Patches
Plain Diff
0.3.0: prometheus & puppetagent
parent
2749dcd1
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
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
plugins/prometheus/prometheus.go
+2
-2
2 additions, 2 deletions
plugins/prometheus/prometheus.go
plugins/puppetagent/puppetagent.go
+6
-5
6 additions, 5 deletions
plugins/puppetagent/puppetagent.go
with
10 additions
and
7 deletions
CHANGELOG.md
+
2
−
0
View file @
7746a2b3
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
-
**breaking change**
Plugin measurements aggregated into a single measurement.
-
**breaking change**
Plugin measurements aggregated into a single measurement.
-
`procstat`
cpu measurements are now prepended with
`cpu_time_`
instead of
-
`procstat`
cpu measurements are now prepended with
`cpu_time_`
instead of
only
`cpu_`
only
`cpu_`
-
The prometheus plugin schema has not been changed (measurements have not been
aggregated).
### Features
### Features
-
Plugin measurements aggregated into a single measurement.
-
Plugin measurements aggregated into a single measurement.
...
...
This diff is collapsed.
Click to expand it.
plugins/prometheus/prometheus.go
+
2
−
2
View file @
7746a2b3
...
@@ -80,14 +80,14 @@ func (g *Prometheus) gatherURL(url string, acc plugins.Accumulator) error {
...
@@ -80,14 +80,14 @@ func (g *Prometheus) gatherURL(url string, acc plugins.Accumulator) error {
return
fmt
.
Errorf
(
"error getting processing samples for %s: %s"
,
url
,
err
)
return
fmt
.
Errorf
(
"error getting processing samples for %s: %s"
,
url
,
err
)
}
}
for
_
,
sample
:=
range
samples
{
for
_
,
sample
:=
range
samples
{
tags
:=
map
[
string
]
string
{}
tags
:=
make
(
map
[
string
]
string
)
for
key
,
value
:=
range
sample
.
Metric
{
for
key
,
value
:=
range
sample
.
Metric
{
if
key
==
model
.
MetricNameLabel
{
if
key
==
model
.
MetricNameLabel
{
continue
continue
}
}
tags
[
string
(
key
)]
=
string
(
value
)
tags
[
string
(
key
)]
=
string
(
value
)
}
}
acc
.
Add
(
string
(
sample
.
Metric
[
model
.
MetricNameLabel
]),
acc
.
Add
(
"prometheus_"
+
string
(
sample
.
Metric
[
model
.
MetricNameLabel
]),
float64
(
sample
.
Value
),
tags
)
float64
(
sample
.
Value
),
tags
)
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
plugins/puppetagent/puppetagent.go
+
6
−
5
View file @
7746a2b3
...
@@ -104,15 +104,16 @@ func (pa *PuppetAgent) Gather(acc plugins.Accumulator) error {
...
@@ -104,15 +104,16 @@ func (pa *PuppetAgent) Gather(acc plugins.Accumulator) error {
return
fmt
.
Errorf
(
"%s"
,
err
)
return
fmt
.
Errorf
(
"%s"
,
err
)
}
}
structPrinter
(
&
puppetState
,
acc
)
tags
:=
map
[
string
]
string
{
"location"
:
pa
.
Location
}
structPrinter
(
&
puppetState
,
acc
,
tags
)
return
nil
return
nil
}
}
func
structPrinter
(
s
*
State
,
acc
plugins
.
Accumulator
)
{
func
structPrinter
(
s
*
State
,
acc
plugins
.
Accumulator
,
tags
map
[
string
]
string
)
{
e
:=
reflect
.
ValueOf
(
s
)
.
Elem
()
e
:=
reflect
.
ValueOf
(
s
)
.
Elem
()
fields
:=
make
(
map
[
string
]
interface
{})
for
tLevelFNum
:=
0
;
tLevelFNum
<
e
.
NumField
();
tLevelFNum
++
{
for
tLevelFNum
:=
0
;
tLevelFNum
<
e
.
NumField
();
tLevelFNum
++
{
name
:=
e
.
Type
()
.
Field
(
tLevelFNum
)
.
Name
name
:=
e
.
Type
()
.
Field
(
tLevelFNum
)
.
Name
nameNumField
:=
e
.
FieldByName
(
name
)
.
NumField
()
nameNumField
:=
e
.
FieldByName
(
name
)
.
NumField
()
...
@@ -123,10 +124,10 @@ func structPrinter(s *State, acc plugins.Accumulator) {
...
@@ -123,10 +124,10 @@ func structPrinter(s *State, acc plugins.Accumulator) {
lname
:=
strings
.
ToLower
(
name
)
lname
:=
strings
.
ToLower
(
name
)
lsName
:=
strings
.
ToLower
(
sName
)
lsName
:=
strings
.
ToLower
(
sName
)
acc
.
Add
(
fmt
.
Sprintf
(
"%s_%s"
,
lname
,
lsName
)
,
sValue
,
nil
)
fields
[
fmt
.
Sprintf
(
"%s_%s"
,
lname
,
lsName
)
]
=
sValue
}
}
}
}
acc
.
AddFields
(
"puppetagent"
,
fields
,
tags
)
}
}
func
init
()
{
func
init
()
{
...
...
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