forked from prometheus/node_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add node-observ-lib #25
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8649f29
Add node-observ-lib
v-zhuravlev f5802af
Remove trends support (not in 10.0 schema)
v-zhuravlev db019c5
Make filteringSelector for logs dashboard configurable
v-zhuravlev 79b4153
Temp change dependency (until PR is merged for commonlib)
v-zhuravlev 784cf59
Refactor config
v-zhuravlev d9f8ea2
Update jsonnetfile.json
v-zhuravlev 016bfac
Update README
v-zhuravlev 0e78ebf
Add separate loki example
v-zhuravlev 21c8272
Add sep file example
v-zhuravlev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Node exporter observ lib | ||
|
||
This jsonnet observ lib can be used to generate observ package for node exporter. | ||
|
||
## Import | ||
|
||
```sh | ||
jb init | ||
jb install https://github.com/grafana/node_exporter/docs/node-observ-lib | ||
``` | ||
|
||
## Examples | ||
|
||
### Example 1: Basic example | ||
|
||
You can use observ-lib to fill in monitoring-mixin structure: | ||
|
||
```jsonnet | ||
// mixin.libsonnet file | ||
local nodelib = import 'node-observ-lib/main.libsonnet'; | ||
|
||
local linux = | ||
nodelib.new() | ||
+ nodelib.withConfigMixin({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should add a little explanation/example with separate configuration? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
filteringSelector: 'job=~".*node.*"', | ||
groupLabels: ['job'], | ||
instanceLabels: ['instance'], | ||
dashboardNamePrefix: 'Node exporter / ', | ||
dashboardTags: ['node-exporter-mixin'], | ||
uid: 'node', | ||
}) | ||
+ nodelib.withConfigMixin( | ||
{ | ||
// enable loki logs | ||
enableLokiLogs: true, | ||
} | ||
); | ||
|
||
{ | ||
grafanaDashboards+:: linux.grafana.dashboards, | ||
prometheusAlerts+:: linux.prometheus.alerts, | ||
prometheusRules+:: linux.prometheus.recordingRules, | ||
} | ||
|
||
``` | ||
|
||
### Example 2: Modify specific panel before rendering dashboards | ||
|
||
```jsonnet | ||
local g = import './g.libsonnet'; | ||
// mixin.libsonnet file | ||
local nodelib = import 'node-observ-lib/main.libsonnet'; | ||
|
||
local linux = | ||
nodelib.new() | ||
+ nodelib.withConfigMixin({ | ||
filteringSelector: 'job=~".*node.*"', | ||
groupLabels: ['job'], | ||
instanceLabels: ['instance'], | ||
dashboardNamePrefix: 'Node exporter / ', | ||
dashboardTags: ['node-exporter-mixin'], | ||
uid: 'node', | ||
}) | ||
+ { | ||
grafana+: { | ||
panels+: { | ||
networkSockstatAll+: | ||
+ g.panel.timeSeries.fieldConfig.defaults.custom.withDrawStyle('bars') | ||
} | ||
} | ||
}; | ||
|
||
{ | ||
grafanaDashboards+:: linux.grafana.dashboards, | ||
prometheusAlerts+:: linux.prometheus.alerts, | ||
prometheusRules+:: linux.prometheus.recordingRules, | ||
} | ||
|
||
``` | ||
|
||
## Collectors used: | ||
|
||
Grafana Agent or combination of node_exporter/promtail can be used in order to collect data required. | ||
|
||
### Logs collection | ||
|
||
Loki logs are used to populate logs dashboard and also for annotations. | ||
|
||
To use logs, you need to opt-in, with setting `enableLokiLogs: true` in config. | ||
|
||
See example above. | ||
|
||
The following scrape snippet can be used in grafana-agent/promtail: | ||
|
||
```yaml | ||
- job_name: integrations/node_exporter_journal_scrape | ||
journal: | ||
max_age: 24h | ||
labels: | ||
instance: '<your-instance-name>' | ||
job: integrations/node_exporter | ||
relabel_configs: | ||
- source_labels: ['__journal__systemd_unit'] | ||
target_label: 'unit' | ||
- source_labels: ['__journal__boot_id'] | ||
target_label: 'boot_id' | ||
- source_labels: ['__journal__transport'] | ||
target_label: 'transport' | ||
- source_labels: ['__journal_priority_keyword'] | ||
target_label: 'level' | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpicks throughout: I don't mind shortening
observability
toobserv
for the folder name, but it feels pretty awkward everywhere elseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one, updated readme