Skip to content

Commit

Permalink
MON-3113: filter unneccessary metrics from mountstats collector.
Browse files Browse the repository at this point in the history
  • Loading branch information
raptorsun committed Apr 23, 2023
1 parent 12eae25 commit 8c87a93
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
8 changes: 8 additions & 0 deletions assets/node-exporter/minimal-service-monitor.yaml
Expand Up @@ -14,6 +14,14 @@ spec:
- bearerTokenFile: ""
interval: 15s
metricRelabelings:
- action: replace
regex: (node_mountstats_nfs_read_bytes_total|node_mountstats_nfs_write_bytes_total|node_mountstats_nfs_operations_requests_total)
replacement: "true"
sourceLabels:
- __name__
targetLabel: __tmp_keep
- action: labeldrop
regex: __tmp_keep
- action: keep
regex: (node_cpu_info|node_cpu_seconds_total|node_disk_io_time_seconds_total|node_disk_io_time_weighted_seconds_total|node_disk_read_time_seconds_total|node_disk_reads_completed_total|node_disk_write_time_seconds_total|node_disk_writes_completed_total|node_filefd_allocated|node_filefd_maximum|node_filesystem_avail_bytes|node_filesystem_files|node_filesystem_files_free|node_filesystem_free_bytes|node_filesystem_readonly|node_filesystem_size_bytes|node_load1|node_memory_Buffers_bytes|node_memory_Cached_bytes|node_memory_MemAvailable_bytes|node_memory_MemFree_bytes|node_memory_MemTotal_bytes|node_memory_Slab_bytes|node_netstat_TcpExt_TCPSynRetrans|node_netstat_Tcp_OutSegs|node_netstat_Tcp_RetransSegs|node_network_receive_bytes_total|node_network_receive_drop_total|node_network_receive_errs_total|node_network_receive_packets_total|node_network_transmit_bytes_total|node_network_transmit_drop_total|node_network_transmit_errs_total|node_network_transmit_packets_total|node_network_up|node_nf_conntrack_entries|node_nf_conntrack_entries_limit|node_textfile_scrape_error|node_timex_maxerror_seconds|node_timex_offset_seconds|node_timex_sync_status|node_vmstat_pgmajfault|process_start_time_seconds|virt_platform)
sourceLabels:
Expand Down
14 changes: 14 additions & 0 deletions assets/node-exporter/service-monitor.yaml
Expand Up @@ -13,6 +13,20 @@ spec:
endpoints:
- bearerTokenFile: ""
interval: 15s
metricRelabelings:
- action: replace
regex: (node_mountstats_nfs_read_bytes_total|node_mountstats_nfs_write_bytes_total|node_mountstats_nfs_operations_requests_total)
replacement: "true"
sourceLabels:
- __name__
targetLabel: __tmp_keep
- action: drop
regex: node_mountstats_nfs_.+;
sourceLabels:
- __name__
- __tmp_keep
- action: labeldrop
regex: __tmp_keep
port: https
relabelings:
- action: replace
Expand Down
36 changes: 36 additions & 0 deletions jsonnet/components/node-exporter.libsonnet
Expand Up @@ -31,6 +31,42 @@ function(params)
'monitoring.openshift.io/collection-profile': 'full',
},
},
spec+: {
endpoints: [
endpoint {
local metricRelabelingsOld = if std.objectHas(endpoint, 'metricRelabelings') then endpoint.metricRelabelings else [],
metricRelabelings:
metricRelabelingsOld +
[
{
// Drop other metrics from mountstats collector than these 3 metrics:
// 1. node_mountstats_nfs_read_bytes_total
// 2. node_mountstats_nfs_write_bytes_total
// 3. node_mountstats_nfs_operations_requests_total
sourceLabels: ['__name__'],
regex+: '(' + std.join('|', [
'node_mountstats_nfs_read_bytes_total',
'node_mountstats_nfs_write_bytes_total',
'node_mountstats_nfs_operations_requests_total',
]) + ')',
action: 'replace',
targetLabel: '__tmp_keep',
replacement: 'true',
},
{
action: 'drop',
sourceLabels: ['__name__', '__tmp_keep'],
regex: 'node_mountstats_nfs_.+;',
},
{
action: 'labeldrop',
regex: '__tmp_keep',
},
],
}
for endpoint in super.endpoints
],
},
},

minimalServiceMonitor: generateServiceMonitor.minimal(
Expand Down

0 comments on commit 8c87a93

Please sign in to comment.