forked from prometheus/node_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
Add node-observ-lib #25
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
Merged
Merged
Changes from all 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 hidden or 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,163 @@ | ||
| # Node exporter observability lib | ||
|
|
||
| This jsonnet observability lib can be used to generate observability 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({ | ||
|
Member
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?
Author
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', | ||
| // enable loki logs | ||
| enableLokiLogs: true, | ||
| }); | ||
|
|
||
| { | ||
| grafanaDashboards+:: linux.grafana.dashboards, | ||
| prometheusAlerts+:: linux.prometheus.alerts, | ||
| prometheusRules+:: linux.prometheus.recordingRules, | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
| ### Example 2: Fill in monitoring-mixin with default config values and enable loki logs: | ||
|
|
||
|
|
||
| ```jsonnet | ||
| // mixin.libsonnet file | ||
| local nodelib = import 'node-observ-lib/main.libsonnet'; | ||
|
|
||
| local linux = | ||
| nodelib.new() | ||
| + nodelib.withConfigMixin({ | ||
| enableLokiLogs: true, | ||
| }); | ||
|
|
||
| { | ||
| grafanaDashboards+:: linux.grafana.dashboards, | ||
| prometheusAlerts+:: linux.prometheus.alerts, | ||
| prometheusRules+:: linux.prometheus.recordingRules, | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
| ### Example 3: Override some of default config values from file: | ||
|
|
||
|
|
||
| ```jsonnet | ||
| // overrides.libsonnet | ||
| { | ||
| // Memory utilzation (%) level on which to trigger the | ||
| // 'NodeMemoryHighUtilization' alert. | ||
| memoryHighUtilizationThreshold: 80, | ||
|
|
||
| // Threshold for the rate of memory major page faults to trigger | ||
| // 'NodeMemoryMajorPagesFaults' alert. | ||
| memoryMajorPagesFaultsThreshold: 1000, | ||
|
|
||
| // Disk IO queue level above which to trigger | ||
| // 'NodeDiskIOSaturation' alert. | ||
| diskIOSaturationThreshold: 20, | ||
| } | ||
|
|
||
| // mixin.libsonnet file | ||
| local configOverride = import './overrides.libsonnet'; | ||
| local nodelib = import 'node-observ-lib/main.libsonnet'; | ||
|
|
||
| local linux = | ||
| nodelib.new() | ||
| + nodelib.withConfigMixin(configOverride); | ||
|
|
||
| { | ||
| grafanaDashboards+:: linux.grafana.dashboards, | ||
| prometheusAlerts+:: linux.prometheus.alerts, | ||
| prometheusRules+:: linux.prometheus.recordingRules, | ||
| } | ||
|
|
||
| ``` | ||
|
|
||
| ### Example 4: 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
observabilitytoobservfor 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