This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
212 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
date: 2016-11-30T13:01:53+01:00 | ||
title: 2.1.0 version released | ||
type: "news" | ||
url: "/210_version_released" | ||
--- | ||
New version released adding custom tags. | ||
|
||
<!--more--> | ||
|
||
# Custom Tags | ||
|
||
add custom tags to your data by adding a input section in the configuration file: | ||
|
||
``` toml | ||
[[input]] | ||
Measurement="PartitionProcessor" | ||
Name="partition" | ||
Match="adxlpar" | ||
[[input.tag]] | ||
Name="datacenter" | ||
Value="DC1" | ||
``` | ||
Custom tags are added at import time. | ||
It will add a tag named **datacenter** with value **DC1** if the tag **partition** in the measurement **PartitionProcessor** match the regular expression **adxlpar**. | ||
|
||
Attribute's description: | ||
|
||
* **Measurement**: it's the measurement where an additional tag could be added | ||
* **Name**: name of the tag to check | ||
* **Match**: the regular expression used to check the tag value. No need to put the regular expression between '/' characters. | ||
|
||
More informations on the [configuration file page](/configuration/file/). | ||
|
||
# enhancements | ||
|
||
* added **serial** tag to nmon files to permit grouping by managed system. | ||
* added information message if retention policy is set. | ||
* added error message on configuration file syntax error. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// nmon2influxdb | ||
// author: [email protected] | ||
|
||
package nmon2influxdblib | ||
|
||
import ( | ||
"fmt" | ||
"regexp" | ||
) | ||
|
||
//Tags array | ||
type Tags []Tag | ||
|
||
// Tag is a struct to store additional tags | ||
type Tag struct { | ||
Name string | ||
Value string | ||
Regexp *regexp.Regexp `toml:",skip"` | ||
} | ||
|
||
// TagParsers access struct : TagParsers[mesurement][tag name] | ||
type TagParsers map[string]map[string]Tags | ||
|
||
// ParseInputs process user inputs and compile regular expressions | ||
func ParseInputs(inputs Inputs) TagParsers { | ||
tagParsers := make(TagParsers) | ||
|
||
for _, input := range inputs { | ||
tagRegexp, RegCompErr := regexp.Compile(input.Match) | ||
if RegCompErr != nil { | ||
fmt.Printf("could not compile Config Input match parameter %s\n", input.Match) | ||
} | ||
|
||
// Intialize if empty struct | ||
if _, ok := tagParsers[input.Measurement]; !ok { | ||
tagParsers[input.Measurement] = make(map[string]Tags) | ||
} | ||
|
||
tagger := tagParsers[input.Measurement][input.Name] | ||
|
||
for _, tag := range input.Tags { | ||
tag.Regexp = tagRegexp | ||
tagger = append(tagger, tag) | ||
} | ||
|
||
tagParsers[input.Measurement][input.Name] = tagger | ||
|
||
} | ||
return tagParsers | ||
} |