From bd05126309911cd00f63b1c45e82ff9ee23df326 Mon Sep 17 00:00:00 2001 From: "Huang, Scott (sh2725)" Date: Mon, 19 Nov 2018 13:39:49 -0500 Subject: [PATCH] Add Nagios Elasticsearch Query Command Change-Id: I74a965a5397101793cae71228a6a5bd442bf9f5a --- nagios/templates/configmap-etc.yaml | 1 + nagios/templates/deployment.yaml | 6 ++++++ nagios/values.yaml | 10 +++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/nagios/templates/configmap-etc.yaml b/nagios/templates/configmap-etc.yaml index 75a54c6b4..a8b88d3b7 100644 --- a/nagios/templates/configmap-etc.yaml +++ b/nagios/templates/configmap-etc.yaml @@ -34,6 +34,7 @@ type: Opaque data: cgi.cfg: {{ include "nagios.utils.to_nagios_conf" .Values.conf.nagios.cgi | b64enc }} nagios.cfg: {{ include "nagios.utils.to_nagios_conf" .Values.conf.nagios.nagios | b64enc }} + query_es_clauses.json: {{ .Values.conf.nagios.query_es_clauses | toJson | b64enc }} nagios_objects.cfg: {{ include "configmap_etc._nagios_objects" $ | b64enc }} #NOTE(portdirect): this must be last, to work round helm ~2.7 bug. {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.httpd "key" "httpd.conf" "format" "Secret") | indent 2 }} diff --git a/nagios/templates/deployment.yaml b/nagios/templates/deployment.yaml index c4ee3ff7c..2b0a7e4b3 100644 --- a/nagios/templates/deployment.yaml +++ b/nagios/templates/deployment.yaml @@ -190,6 +190,12 @@ spec: mountPath: /opt/nagios/etc/nagios_objects.cfg subPath: nagios_objects.cfg readOnly: true +{{- if .Values.conf.es_query_clauses }} + - name: nagios-etc + mountPath: /opt/nagios/etc/objects/query_es_clauses.json + subPath: query_es_clauses.json + readOnly: true +{{ end }} - name: pod-var-log mountPath: /opt/nagios/var/log readOnly: false diff --git a/nagios/values.yaml b/nagios/values.yaml index 7fb2b9cf5..c8f96b0ff 100644 --- a/nagios/values.yaml +++ b/nagios/values.yaml @@ -401,9 +401,6 @@ conf: - check_prom_alert: command_name: check_prom_alert command_line: "$USER1$/query_prometheus_alerts.py --prometheus_api $USER2$ --alertname '$ARG1$' --msg_format '$ARG2$' --ok_message '$ARG3$'" - - check_es_alert: - command_name: check_es_alert - command_line: "$USER1$/check_elasticsearch_query.py --es_url $USER9$ --logger '$ARG1$' --range_mins '$ARG2$' --alert_level '$ARG3$' --critical '$ARG4$' --es_type '$ARG5$'" - check_filespace_mounts-usage-rate-fullin4hrs: command_name: check_filespace_mounts-usage-rate-fullin4hrs command_line: $USER1$/query_prometheus_alerts.py --prometheus_api $USER2$ --alertname 'node_filesystem_full_in_4h' --labels_csv 'instance=~"$HOSTADDRESS$.*"' --msg_format 'CRITICAL- Mountpoint {mountpoint} will be full in four hours' --ok_message 'OK- All mountpoints usage rate is normal' @@ -470,6 +467,12 @@ conf: - check_prometheus_hosts: command_name: check_prometheus_hosts command_line: $USER1$/check_update_prometheus_hosts.py --prometheus_api $USER2$ --object_file_loc /opt/nagios/etc/objects/prometheus_discovery_objects.cfg + - check_es_query: + command_name: check_es_query + command_line: $USER1$/query_elasticsearch.py $USER9$ '$ARG1$' '$ARG2$' '$ARG3$' '$ARG4$' '$ARG5$' --simple_query '$ARG6$' --simple_query_fields '$ARG7$' --match '$ARG8$' --range '$ARG9$' + - check_es_query_w_file: + command_name: check_es_query_w_file + command_line: $USER1$/query_elasticsearch.py $USER9$ '$ARG1$' '$ARG2$' '$ARG3$' '$ARG4$' '$ARG5$' --simple_query '$ARG6$' --simple_query_fields '$ARG7$' --query_file '/opt/nagios/etc/objects/query_es_clauses.json' --query_clause '$ARG8$' --match '$ARG9$' --range '$ARG10$' services: - notifying_service: name: notifying_service @@ -1187,3 +1190,4 @@ conf: http: primary_target: 127.0.0.1:3904/events secondary_target: 127.0.0.1:3904/events + query_es_clauses: "null"