forked from prometheus/node_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
4c355b0
commit 8327300
Showing
17 changed files
with
276 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# AIX exporter observability lib | ||
|
||
This jsonnet observability lib can be used to generate observability package for node exporter(AIX). | ||
|
||
## Import | ||
|
||
```sh | ||
jb init | ||
jb install https://github.com/prometheus/node_exporter/docs/node-mixin/lib/aix | ||
``` | ||
|
||
## Examples | ||
|
||
### Example 1: Basic example | ||
|
||
You can use observ-lib to fill in monitoring-mixin structure: | ||
|
||
```jsonnet | ||
// mixin.libsonnet file | ||
local aixlib = import 'aix/main.libsonnet'; | ||
local aix = | ||
aixlib.new() | ||
+ aixlib.withConfigMixin({ | ||
filteringSelector: 'job=~".*aix.*"', | ||
groupLabels: ['job'], | ||
instanceLabels: ['instance'], | ||
dashboardNamePrefix: 'AIX / ', | ||
dashboardTags: ['aix-mixin'], | ||
uid: 'aix', | ||
// enable loki logs | ||
enableLokiLogs: true, | ||
}); | ||
{ | ||
grafanaDashboards+:: aix.grafana.dashboards, | ||
prometheusAlerts+:: aix.prometheus.alerts, | ||
prometheusRules+:: aix.prometheus.recordingRules, | ||
} | ||
``` | ||
For more examples see [node-mixin/lib/linux](../linux). |
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 alertsKeep | ||
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.alertsKeep)) > 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,27 @@ | ||
{ | ||
// Rest of the config is imported from linux | ||
filteringSelector: 'job="aix"', | ||
dashboardNamePrefix: 'MacOS / ', | ||
//uid prefix | ||
uid: 'aix', | ||
|
||
dashboardTags: ['aix-mixin'], | ||
|
||
|
||
// Alerts to keep from node-observ-lib: | ||
alertsKeep: [ | ||
'NodeFilesystemAlmostOutOfSpace', | ||
'NodeNetworkReceiveErrs', | ||
'NodeNetworkTransmitErrs', | ||
'NodeTextFileCollectorScrapeError', | ||
'NodeFilesystemFilesFillingUp', | ||
'NodeFilesystemAlmostOutOfFiles', | ||
'NodeCPUHighUsage', | ||
'NodeSystemSaturation', | ||
'NodeMemoryHighUtilization', | ||
'NodeDiskIOSaturation', | ||
], | ||
// logs lib related | ||
enableLokiLogs: false, | ||
|
||
} |
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,65 @@ | ||
local g = import '../g.libsonnet'; | ||
local nodelib = import '../linux/main.libsonnet'; | ||
local alerts = import './alerts.libsonnet'; | ||
local config = import './config.libsonnet'; | ||
local panels = import './panels.libsonnet'; | ||
local targets = import './targets.libsonnet'; | ||
|
||
|
||
// inherit nodelib | ||
nodelib | ||
{ | ||
|
||
new(): | ||
super.new() | ||
+ nodelib.withConfigMixin(config) | ||
+ | ||
{ | ||
local this = self, | ||
local parentGrafana = super.grafana, | ||
local parentPrometheus = super.prometheus, | ||
|
||
grafana+: { | ||
// drop backToFleet link | ||
links+: { | ||
local link = g.dashboard.link, | ||
backToFleet:: {}, | ||
backToOverview: | ||
link.link.new('Back to ' + this.config.dashboardNamePrefix + 'overview', '/d/' + this.grafana.dashboards['nodes-darwin.json'].uid) | ||
+ link.link.options.withKeepTime(true), | ||
}, | ||
annotations: { | ||
// keep only reboot annotation | ||
reboot: parentGrafana.annotations.reboot, | ||
}, | ||
// override targets (memory) | ||
targets+: targets.new(this), | ||
// override panels (update description and targets in panels) | ||
panels+: panels.new(this), | ||
|
||
// keep only overview and logs(optionally) dashes | ||
dashboards: | ||
{ | ||
'nodes-aix.json': | ||
parentGrafana.dashboards['nodes.json'] | ||
+ g.dashboard.withUid( | ||
(if this.config.uid == 'aix' then std.md5('nodes-aix.json') else this.config.uid + '-overview') | ||
), | ||
} | ||
+ | ||
( | ||
if this.config.enableLokiLogs | ||
then | ||
{ | ||
'logs-aix.json': parentGrafana.dashboards['logs.json'], | ||
} | ||
else {} | ||
), | ||
}, | ||
prometheus+: { | ||
recordingRules: {}, | ||
alerts: alerts.new(this, parentPrometheus), | ||
}, | ||
}, | ||
|
||
} |
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,24 @@ | ||
local g = import '../g.libsonnet'; | ||
local commonlib = import 'common-lib/common/main.libsonnet'; | ||
|
||
{ | ||
new(this): | ||
{ | ||
local t = this.grafana.targets, | ||
local table = g.panel.table, | ||
local fieldOverride = g.panel.table.fieldOverride, | ||
local instanceLabel = this.config.instanceLabels[0], | ||
|
||
// override description and targets | ||
memory+: { | ||
memoryUsageTsBytes+: | ||
g.panel.timeSeries.queryOptions.withTargets([ | ||
t.memory.memoryUsedBytes, | ||
t.memory.memoryTotalBytes, | ||
t.memory.memorySwapUsedBytes, | ||
]) | ||
+ commonlib.panels.generic.timeSeries.threshold.stylizeByRegexp('Physical memory'), | ||
}, | ||
|
||
}, | ||
} |
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,61 @@ | ||
local g = import '../g.libsonnet'; | ||
local prometheusQuery = g.query.prometheus; | ||
local lokiQuery = g.query.loki; | ||
|
||
{ | ||
new(this): { | ||
local variables = this.grafana.variables.main, | ||
local config = this.config, | ||
local prometheusDatasource = '${' + variables.datasources.prometheus.name + '}', | ||
local lokiDatasource = '${' + variables.datasources.loki.name + '}', | ||
|
||
// override memory targets (other metrics in macos) | ||
memory+: { | ||
memoryTotalBytes: | ||
prometheusQuery.new( | ||
prometheusDatasource, | ||
'node_memory_total_bytes{%(queriesSelector)s}' % variables | ||
) | ||
+ prometheusQuery.withLegendFormat('Physical memory'), | ||
|
||
memoryUsedBytes: | ||
prometheusQuery.new( | ||
prometheusDatasource, | ||
||| | ||
( | ||
node_memory_total_bytes{%(queriesSelector)s} - | ||
node_memory_available_bytes{%(queriesSelector)s} | ||
) | ||
||| % variables | ||
) | ||
+ prometheusQuery.withLegendFormat('Memory used'), | ||
|
||
memoryUsagePercent: | ||
prometheusQuery.new( | ||
prometheusDatasource, | ||
||| | ||
( | ||
( | ||
node_memory_total_bytes{%(queriesSelector)s} - | ||
node_memory_available_bytes{%(queriesSelector)s} | ||
) | ||
/avg(node_memory_total_bytes{%(queriesSelector)s}) | ||
) * 100 | ||
||| | ||
% variables, | ||
), | ||
memorySwapTotal: | ||
prometheusQuery.new( | ||
prometheusDatasource, | ||
'node_memory_swap_total_bytes{%(queriesSelector)s}' % variables | ||
), | ||
|
||
memorySwapUsedBytes: | ||
prometheusQuery.new( | ||
prometheusDatasource, | ||
'node_memory_swap_used_bytes{%(queriesSelector)s}' % variables | ||
) | ||
+ prometheusQuery.withLegendFormat('Swap used'), | ||
}, | ||
}, | ||
} |
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
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
Oops, something went wrong.