Skip to content
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

Make use of prometheus filter settings on IBM-MQ Metricbeat module #16971

Merged
merged 1 commit into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions x-pack/metricbeat/module/ibmmq/qmgr/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,7 @@ input:
metricset: collector
defaults:
metrics_path: /metrics

# The custom processor is responsible for filtering Prometheus metrics
# not stricly related to the IBM MQ domain, e.g. system load, process,
# metrics HTTP server.
processors:
- script:
lang: javascript
source: >
function process(event) {
var metrics = event.Get("prometheus.metrics");
if (metrics == null) {
event.Cancel();
return;
}
Object.keys(metrics).forEach(function(key) {
if (!(key.match(/^ibmmq_.*$/))) {
event.Delete("prometheus.metrics." + key);
}
});
metrics = event.Get("prometheus.metrics");
if (Object.keys(metrics).length == 0) {
event.Cancel();
}
}
# Filtering out Prometheus metrics that are not strictly related to the
# IBM MQ domain, e.g. system load, process, metrics HTTP server.
metrics_filters:
include: ["ibmmq_.*", "^up$"]
2 changes: 1 addition & 1 deletion x-pack/metricbeat/module/ibmmq/test_ibmmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ def test_qmgr(self):

# Verify if processors are correctly setup.
for metric in evt["prometheus"]["metrics"].keys():
assert metric.startswith("ibmmq_")
assert metric.startswith("ibmmq_") or metric == "up"