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
8c6a6604
Commit
8c6a6604
authored
9 years ago
by
Sergio Jimenez
Browse files
Options
Downloads
Patches
Plain Diff
Comments and cleanup
parent
71702804
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/inputs/mesos/mesos.go
+17
-13
17 additions, 13 deletions
plugins/inputs/mesos/mesos.go
with
17 additions
and
13 deletions
plugins/inputs/mesos/mesos.go
+
17
−
13
View file @
8c6a6604
...
...
@@ -27,6 +27,18 @@ var defaultMetrics = []string{
"tasks"
,
"messages"
,
"evqueue"
,
"messages"
,
"registrar"
,
}
var
sampleConfig
=
`
# Timeout, in ms.
timeout = 100
# A list of Mesos masters. e.g. master1:5050, master2:5080, etc.
# The port can be skipped if using the default (5050)
# Default value is localhost:5050.
servers = ["localhost:5050"]
# Metrics groups to be collected.
# Default, all enabled.
metrics_collection = ["resources","master","system","slaves","frameworks","messages","evqueue","registrar"]
`
// SampleConfig returns a sample configuration block
func
(
m
*
Mesos
)
SampleConfig
()
string
{
return
sampleConfig
...
...
@@ -37,6 +49,7 @@ func (m *Mesos) Description() string {
return
"Telegraf plugin for gathering metrics from N Mesos masters"
}
// Gather() metrics from given list of Mesos Masters
func
(
m
*
Mesos
)
Gather
(
acc
telegraf
.
Accumulator
)
error
{
var
wg
sync
.
WaitGroup
var
errorChannel
chan
error
...
...
@@ -60,6 +73,7 @@ func (m *Mesos) Gather(acc telegraf.Accumulator) error {
close
(
errorChannel
)
errorStrings
:=
[]
string
{}
// Gather all errors for returning them at once
for
err
:=
range
errorChannel
{
if
err
!=
nil
{
errorStrings
=
append
(
errorStrings
,
err
.
Error
())
...
...
@@ -72,6 +86,7 @@ func (m *Mesos) Gather(acc telegraf.Accumulator) error {
return
nil
}
// metricsDiff() returns set names for removal
func
metricsDiff
(
w
[]
string
)
[]
string
{
b
:=
[]
string
{}
s
:=
make
(
map
[
string
]
bool
)
...
...
@@ -93,6 +108,7 @@ func metricsDiff(w []string) []string {
return
b
}
// masterBlocks serves as kind of metrics registry groupping them in sets
func
masterBlocks
(
g
string
)
[]
string
{
var
m
map
[
string
][]
string
...
...
@@ -233,19 +249,7 @@ func masterBlocks(g string) []string {
return
ret
}
var
sampleConfig
=
`
# Timeout, in ms.
timeout = 100
# A list of Mesos masters. e.g. master1:5050, master2:5080, etc.
# The port can be skipped if using the default (5050)
# Default value is localhost:5050.
servers = ["localhost:5050"]
# Metrics groups to be collected.
# Default, all enabled.
metrics_collection = ["resources","master","system","slaves","frameworks","messages","evqueue","registrar"]
`
// removeGroup(), remove unwanted groups
// removeGroup(), remove unwanted sets
func
(
m
*
Mesos
)
removeGroup
(
j
*
map
[
string
]
interface
{})
{
var
ok
bool
...
...
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