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 Macos observability lib #28
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f733d86
Add gitignore to node-observ-lib
v-zhuravlev 343788f
Fix typo in node default filteringSelector
v-zhuravlev 7068038
Prep alert group names for macos
v-zhuravlev b84e513
Add macos-observ-lib
v-zhuravlev d6a30f1
Change overview dashboard:
v-zhuravlev 8eae54f
Add more alerts
v-zhuravlev 1d1dda9
Move alerts to sep file
v-zhuravlev eee116a
Breaking: Update layout
v-zhuravlev 947de18
Restructure
v-zhuravlev a8c76f9
Bring back NodeFilesystemAlmostOutOfFiles alert
v-zhuravlev d89da50
Show only errors when they occur
v-zhuravlev 55263fe
Only show network interfaces that had traffic change at least once du…
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
1 change: 0 additions & 1 deletion
1
...or/github.com/jsonnet-libs/xtd/.gitignore → docs/node-observ-lib/.gitignore
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
.jekyll-cache | ||
jsonnetfile.lock.json | ||
vendor |
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 was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
docs/node-observ-lib/annotations.libsonnet → ...de-observ-lib/linux/annotations.libsonnet
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
2 changes: 1 addition & 1 deletion
2
docs/node-observ-lib/links.libsonnet → docs/node-observ-lib/linux/links.libsonnet
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
docs/node-observ-lib/panels.libsonnet → docs/node-observ-lib/linux/panels.libsonnet
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
docs/node-observ-lib/targets.libsonnet → docs/node-observ-lib/linux/targets.libsonnet
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
2 changes: 1 addition & 1 deletion
2
docs/node-observ-lib/variables.libsonnet → ...node-observ-lib/linux/variables.libsonnet
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,86 @@ | ||
# MacOS exporter observability lib | ||
|
||
This jsonnet observability lib can be used to generate observability package for node exporter(MacOS). | ||
|
||
## 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 macoslib = import 'node-observ-lib/macos/main.libsonnet'; | ||
|
||
local mac = | ||
macoslib.new() | ||
+ macoslib.withConfigMixin({ | ||
filteringSelector: 'job=~".*mac.*"', | ||
groupLabels: ['job'], | ||
instanceLabels: ['instance'], | ||
dashboardNamePrefix: 'MacOS / ', | ||
dashboardTags: ['macos-mixin'], | ||
uid: 'darwin', | ||
// enable loki logs | ||
enableLokiLogs: true, | ||
}); | ||
|
||
{ | ||
grafanaDashboards+:: mac.grafana.dashboards, | ||
prometheusAlerts+:: mac.prometheus.alerts, | ||
prometheusRules+:: mac.prometheus.recordingRules, | ||
} | ||
|
||
``` | ||
For more examples see [node-observ-lib/linux](../linux). | ||
|
||
## 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_direct_scrape | ||
static_configs: | ||
- targets: | ||
- localhost | ||
labels: | ||
__path__: /var/log/*.log | ||
instance: '<your-instance-name>' | ||
job: integrations/macos-node | ||
pipeline_stages: | ||
- multiline: | ||
firstline: '^([\w]{3} )?[\w]{3} +[\d]+ [\d]+:[\d]+:[\d]+|[\w]{4}-[\w]{2}-[\w]{2} [\w]{2}:[\w]{2}:[\w]{2}(?:[+-][\w]{2})?' | ||
- regex: | ||
expression: '(?P<timestamp>([\w]{3} )?[\w]{3} +[\d]+ [\d]+:[\d]+:[\d]+|[\w]{4}-[\w]{2}-[\w]{2} [\w]{2}:[\w]{2}:[\w]{2}(?:[+-][\w]{2})?) (?P<hostname>\S+) (?P<sender>.+?)\[(?P<pid>\d+)\]:? (?P<message>(?s:.*))$' | ||
- labels: | ||
sender: | ||
hostname: | ||
pid: | ||
- match: | ||
selector: '{sender!="", pid!=""}' | ||
stages: | ||
- template: | ||
source: message | ||
template: '{{ .sender }}[{{ .pid }}]: {{ .message }}' | ||
- labeldrop: | ||
- pid | ||
- output: | ||
source: message | ||
``` |
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,23 @@ | ||
{ | ||
new(this, parentPrometheus): | ||
{ | ||
groups: | ||
//keep only alerts listed in alertsMacKeep | ||
std.filter( | ||
function(group) std.length(group.rules) > 0, | ||
[ | ||
{ | ||
name: group.name, | ||
rules: [ | ||
rule | ||
for rule in group.rules | ||
if std.length(std.find(rule.alert, this.config.alertsMacKeep)) > 0 | ||
], | ||
} | ||
for group in parentPrometheus.alerts.groups | ||
], | ||
|
||
), | ||
|
||
}, | ||
} |
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,59 @@ | ||
{ | ||
|
||
// any modular observability library should inlcude as inputs: | ||
// 'dashboardNamePrefix' - Use as prefix for all Dashboards and (optional) rule groups | ||
// 'filteringSelector' - Static selector to apply to ALL dashboard variables of type query, panel queries, alerts and recording rules. | ||
// 'groupLabels' - one or more labels that can be used to identify 'group' of instances. In simple cases, can be 'job' or 'cluster'. | ||
// 'instanceLabels' - one or more labels that can be used to identify single entity of instances. In simple cases, can be 'instance' or 'pod'. | ||
// 'uid' - UID to prefix all dashboards original uids | ||
|
||
filteringSelector: 'job="integrations/macos-node"', | ||
groupLabels: ['job'], | ||
instanceLabels: ['instance'], | ||
dashboardNamePrefix: 'MacOS / ', | ||
uid: 'darwin', | ||
|
||
dashboardTags: [self.uid], | ||
|
||
// Select the fstype for filesystem-related queries. If left | ||
// empty, all filesystems are selected. If you have unusual | ||
// filesystem you don't want to include in dashboards and | ||
// alerting, you can exclude them here, e.g. 'fstype!="tmpfs"'. | ||
fsSelector: 'fstype!=""', | ||
|
||
// Select the mountpoint for filesystem-related queries. If left | ||
// empty, all mountpoints are selected. For example if you have a | ||
// special purpose tmpfs instance that has a fixed size and will | ||
// always be 100% full, but you still want alerts and dashboards for | ||
// other tmpfs instances, you can exclude those by mountpoint prefix | ||
// like so: 'mountpoint!~"/var/lib/foo.*"'. | ||
fsMountpointSelector: 'mountpoint!=""', | ||
|
||
// Select the device for disk-related queries. If left empty, all | ||
// devices are selected. If you have unusual devices you don't | ||
// want to include in dashboards and alerting, you can exclude | ||
// them here, e.g. 'device!="tmpfs"'. | ||
diskDeviceSelector: 'device!=""', | ||
dashboardPeriod: 'now-1h', | ||
dashboardTimezone: 'default', | ||
dashboardRefresh: '1m', | ||
|
||
// Alerts to keep from node-observ-lib: | ||
alertsMacKeep: [ | ||
'NodeFilesystemAlmostOutOfSpace', | ||
'NodeNetworkReceiveErrs', | ||
'NodeNetworkTransmitErrs', | ||
'NodeTextFileCollectorScrapeError', | ||
'NodeFilesystemFilesFillingUp', | ||
'NodeFilesystemAlmostOutOfFiles', | ||
], | ||
// logs lib related | ||
enableLokiLogs: true, | ||
extraLogLabels: ['filename', 'sender'], | ||
logsVolumeGroupBy: 'sender', | ||
showLogsVolume: true, | ||
logsFilteringSelector: self.filteringSelector, | ||
logsExtraFilters: '', | ||
|
||
|
||
} |
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.
Oh maybe it is something we could discuss here then, I'm not a fan of how busy the network panels are as seen in the screenshot in the description. In particular the body is v. busy. At the very least I'd recommend dropping any metrics with 0/null values to clean up the legend.
Maybe right-aligning with a table as well, to stay consistent with our own style guide?
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.
updated