From 99befc248443aa7bb5217ec1a01da71e2ead99dc Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Tue, 28 Nov 2017 13:40:03 -0600 Subject: [PATCH] Nagios Chart This adds the nagios chart to osh-infra to provide additional monitoring functionality. It uses helper functions to consume yaml definitions for services, commands, hosts and hostgroups to generate the required configurations for those entities in nagios's configuration Change-Id: I6238bb8cb1e5c8dc48594ddea50693f3e7b0a176 --- nagios/Chart.yaml | 22 ++ nagios/requirements.yaml | 18 ++ nagios/templates/_helpers.tpl | 41 +++ nagios/templates/configmap-bin.yaml | 27 ++ nagios/templates/configmap-etc.yaml | 32 +++ nagios/templates/deployment.yaml | 108 +++++++ nagios/templates/etc/_nagios.cfg.tpl | 3 + nagios/templates/ingress-nagios.yaml | 60 ++++ nagios/templates/job-image-repo-sync.yaml | 68 +++++ nagios/templates/service-ingress-nagios.yaml | 32 +++ nagios/templates/service.yaml | 36 +++ nagios/values.yaml | 282 +++++++++++++++++++ tools/gate/chart-deploys/default.yaml | 11 + 13 files changed, 740 insertions(+) create mode 100644 nagios/Chart.yaml create mode 100644 nagios/requirements.yaml create mode 100644 nagios/templates/_helpers.tpl create mode 100644 nagios/templates/configmap-bin.yaml create mode 100644 nagios/templates/configmap-etc.yaml create mode 100644 nagios/templates/deployment.yaml create mode 100644 nagios/templates/etc/_nagios.cfg.tpl create mode 100644 nagios/templates/ingress-nagios.yaml create mode 100644 nagios/templates/job-image-repo-sync.yaml create mode 100644 nagios/templates/service-ingress-nagios.yaml create mode 100644 nagios/templates/service.yaml create mode 100644 nagios/values.yaml diff --git a/nagios/Chart.yaml b/nagios/Chart.yaml new file mode 100644 index 000000000..194bdda23 --- /dev/null +++ b/nagios/Chart.yaml @@ -0,0 +1,22 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +description: OpenStack-Helm Nagios +name: nagios +version: 0.1.0 +home: https://www.nagios.org +sources: + - https://git.openstack.org/cgit/openstack/openstack-helm-addons +maintainers: + - name: OpenStack-Helm Authors diff --git a/nagios/requirements.yaml b/nagios/requirements.yaml new file mode 100644 index 000000000..53782e69b --- /dev/null +++ b/nagios/requirements.yaml @@ -0,0 +1,18 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dependencies: + - name: helm-toolkit + repository: http://localhost:8879/charts + version: 0.1.0 diff --git a/nagios/templates/_helpers.tpl b/nagios/templates/_helpers.tpl new file mode 100644 index 000000000..c689b0bbe --- /dev/null +++ b/nagios/templates/_helpers.tpl @@ -0,0 +1,41 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +# This function defines commands, hosts, hostgroups, and services for nagios by +# consuming yaml trees to define the fields for these objects + +{{- define "nagios.object_definition" -}} +{{- $type := index . 0 }} +{{- $objects := index . 1 }} +{{- range $object := $objects }} +{{ range $config := $object }} +define {{ $type }} { +{{- range $key, $value := $config}} + {{ $key }} {{ $value }} +{{- end }} +} +{{end -}} +{{- end -}} +{{- end -}} + +{{- define "nagios.to_nagios_conf" -}} +{{- range $key, $value := . -}} +{{ if eq $key "cfg_file" }} +{{ range $file := $value -}} +{{ $key }}={{ $file }} +{{ end }} +{{- else }} +{{ $key }}={{ $value }} +{{- end }} +{{- end -}} +{{- end -}} diff --git a/nagios/templates/configmap-bin.yaml b/nagios/templates/configmap-bin.yaml new file mode 100644 index 000000000..5761d1a8d --- /dev/null +++ b/nagios/templates/configmap-bin.yaml @@ -0,0 +1,27 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.configmap_bin }} +{{- $envAll := . }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: nagios-bin +data: + image-repo-sync.sh: |+ +{{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }} +{{- end }} diff --git a/nagios/templates/configmap-etc.yaml b/nagios/templates/configmap-etc.yaml new file mode 100644 index 000000000..75c9fa1f9 --- /dev/null +++ b/nagios/templates/configmap-etc.yaml @@ -0,0 +1,32 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.configmap_etc }} +{{- $envAll := . }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: nagios-etc +data: + nagios.cfg: |+ +{{ include "nagios.to_nagios_conf" .Values.conf.nagios.config | indent 4 }} + nagios_objects.cfg: |+ +{{- tuple "host" .Values.conf.nagios.hosts | include "nagios.object_definition" | indent 4 }} +{{- tuple "hostgroup" .Values.conf.nagios.host_groups | include "nagios.object_definition" | indent 4 }} +{{- tuple "command" .Values.conf.nagios.commands | include "nagios.object_definition" | indent 4 }} +{{- tuple "service" .Values.conf.nagios.services | include "nagios.object_definition" | indent 4 }} +{{- end }} diff --git a/nagios/templates/deployment.yaml b/nagios/templates/deployment.yaml new file mode 100644 index 000000000..2187121c1 --- /dev/null +++ b/nagios/templates/deployment.yaml @@ -0,0 +1,108 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.deployment }} +{{- $envAll := . }} +{{- if .Values.images.local_registry.active -}} +{{- $_ := set .Values "pod_dependency" dict -}} +{{- $_ := include "helm-toolkit.utils.merge" (tuple .Values.pod_dependency .Values.dependencies.static.nagios .Values.dependencies.dynamic.common.local_image_registry) -}} +{{- else -}} +{{- $_ := set .Values "pod_dependency" .Values.dependencies.static.nagios -}} +{{- end -}} + +{{- $serviceAccountName := "nagios" }} +{{ tuple $envAll $envAll.Values.pod_dependency $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: {{ $serviceAccountName }} +rules: + - apiGroups: + - "" + resources: + - nodes + - nodes/proxy + - services + - endpoints + - pods + verbs: + - get + - list + - watch + - apiGroups: + - "" + resources: + - configmaps + verbs: + - get +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: {{ $serviceAccountName }} +subjects: + - kind: ServiceAccount + name: {{ $serviceAccountName }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: {{ $serviceAccountName }} + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: nagios +spec: + replicas: {{ .Values.pod.replicas.nagios }} +{{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} + template: + metadata: + labels: +{{ tuple $envAll "nagios" "monitoring" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} + spec: + serviceAccountName: {{ $serviceAccountName }} + nodeSelector: + {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} + terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.nagios.timeout | default "30" }} + initContainers: +{{ tuple $envAll .Values.pod_dependency list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} + containers: + - name: nagios +{{ tuple $envAll "nagios" | include "helm-toolkit.snippets.image" | indent 10 }} +{{ tuple $envAll $envAll.Values.pod.resources.nagios | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} + ports: + - name: metrics + containerPort: {{ .Values.network.nagios.port }} + env: + - name: PROMETHEUS_SERVICE + value: {{ tuple "monitoring" "internal" "api" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }} + volumeMounts: + - name: nagios-etc + mountPath: /opt/nagios/etc/nagios.cfg + subPath: nagios.cfg + readOnly: true + - name: nagios-etc + mountPath: /opt/nagios/etc/nagios_objects.cfg + subPath: nagios_objects.cfg + readOnly: true + volumes: + - name: nagios-etc + configMap: + name: nagios-etc + defaultMode: 0444 +{{- end }} diff --git a/nagios/templates/etc/_nagios.cfg.tpl b/nagios/templates/etc/_nagios.cfg.tpl new file mode 100644 index 000000000..c51fb6d4c --- /dev/null +++ b/nagios/templates/etc/_nagios.cfg.tpl @@ -0,0 +1,3 @@ +# Nagios Configuration File + +{{ .Values.conf.nagios.cfg }} diff --git a/nagios/templates/ingress-nagios.yaml b/nagios/templates/ingress-nagios.yaml new file mode 100644 index 000000000..eec048d03 --- /dev/null +++ b/nagios/templates/ingress-nagios.yaml @@ -0,0 +1,60 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.ingress }} +{{- $envAll := . }} +{{- if .Values.network.nagios.ingress.public }} +{{- $backendServiceType := "nagios" }} +{{- $backendPort := "n-metrics" }} +{{- $ingressName := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} +{{- $backendName := tuple $backendServiceType "internal" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} +{{- $hostName := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} +{{- $hostNameNamespaced := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }} +{{- $hostNameFull := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }} +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $ingressName }} + annotations: + kubernetes.io/ingress.class: "nginx" + ingress.kubernetes.io/rewrite-target: / + ingress.kubernetes.io/proxy-body-size: {{ .Values.network.prometheus.ingress.proxy_body_size }} +spec: + rules: +{{ if ne $hostNameNamespaced $hostNameFull }} +{{- range $key1, $vHost := tuple $hostName $hostNameNamespaced $hostNameFull }} + - host: {{ $vHost }} + http: + paths: + - path: / + backend: + serviceName: {{ $backendName }} + servicePort: {{ $backendPort }} +{{- end }} +{{- else }} +{{- range $key1, $vHost := tuple $hostName $hostNameNamespaced }} + - host: {{ $vHost }} + http: + paths: + - path: / + backend: + serviceName: {{ $backendName }} + servicePort: {{ $backendPort }} +{{- end }} +{{- end }} +{{- end }} +{{- end }} diff --git a/nagios/templates/job-image-repo-sync.yaml b/nagios/templates/job-image-repo-sync.yaml new file mode 100644 index 000000000..6973dd086 --- /dev/null +++ b/nagios/templates/job-image-repo-sync.yaml @@ -0,0 +1,68 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.job_image_repo_sync }} +{{- $envAll := . }} +{{- if .Values.images.local_registry.active -}} +{{- $_ := set .Values "pod_dependency" .Values.dependencies.static.image_repo_sync -}} + +{{- $serviceAccountName := "nagios-image-repo-sync" }} +{{ tuple $envAll $envAll.Values.pod_dependency $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: nagios-image-repo-sync +spec: + template: + metadata: + labels: +{{ tuple $envAll "nagios" "image-repo-sync" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} + spec: + serviceAccountName: {{ $serviceAccountName }} + restartPolicy: OnFailure + nodeSelector: + {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} + initContainers: +{{ tuple $envAll .Values.pod_dependency list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} + containers: + - name: image-repo-sync +{{ tuple $envAll "image_repo_sync" | include "helm-toolkit.snippets.image" | indent 10 }} +{{ tuple $envAll $envAll.Values.pod.resources.jobs.image_repo_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} + env: + - name: LOCAL_REPO + value: "{{ tuple "local_image_registry" "node" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}:{{ tuple "local_image_registry" "node" "registry" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}" + - name: IMAGE_SYNC_LIST + value: "{{ include "helm-toolkit.utils.image_sync_list" . }}" + command: + - /tmp/image-repo-sync.sh + volumeMounts: + - name: nagios-bin + mountPath: /tmp/image-repo-sync.sh + subPath: image-repo-sync.sh + readOnly: true + - name: docker-socket + mountPath: /var/run/docker.sock + volumes: + - name: nagios-bin + configMap: + name: nagios-bin + defaultMode: 0555 + - name: docker-socket + hostPath: + path: /var/run/docker.sock +{{- end }} +{{- end }} diff --git a/nagios/templates/service-ingress-nagios.yaml b/nagios/templates/service-ingress-nagios.yaml new file mode 100644 index 000000000..1a4d06ae8 --- /dev/null +++ b/nagios/templates/service-ingress-nagios.yaml @@ -0,0 +1,32 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.service_ingress }} +{{- if .Values.network.nagios.ingress.public }} +{{- $envAll := . }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ tuple "nagios" "public" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} +spec: + ports: + - name: http + port: 80 + selector: + app: ingress-api +{{- end }} +{{- end }} diff --git a/nagios/templates/service.yaml b/nagios/templates/service.yaml new file mode 100644 index 000000000..20c586b3f --- /dev/null +++ b/nagios/templates/service.yaml @@ -0,0 +1,36 @@ +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +{{- if .Values.manifests.service }} +{{- $envAll := . }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ tuple "nagios" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} +spec: + ports: + - name: nagios-metrics + port: {{ .Values.network.nagios.port }} + {{ if .Values.network.nagios.node_port.enabled }} + nodePort: {{ .Values.network.nagios.node_port.port }} + {{ end }} + selector: +{{ tuple $envAll "nagios" "monitoring" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} + {{ if .Values.network.nagios.node_port.enabled }} + type: NodePort + {{ end }} +{{- end }} diff --git a/nagios/values.yaml b/nagios/values.yaml new file mode 100644 index 000000000..b49d0e01d --- /dev/null +++ b/nagios/values.yaml @@ -0,0 +1,282 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Default values for nagios. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +images: + tags: + nagios: docker.io/srwilkers/prometheus-nagios:v0.1.0 + dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.2.1 + image_repo_sync: docker.io/docker:17.07.0 + pull_policy: IfNotPresent + local_registry: + active: false + exclude: + - dep_check + - image_repo_sync + +labels: + node_selector_key: openstack-control-plane + node_selector_value: enabled + +dependencies: + dynamic: + common: + jobs: + - nagios-image-repo-sync + services: + - service: local_image_registry + endpoint: node + static: + image_repo_sync: + services: + - service: local_image_registry + endpoint: internal + +endpoints: + cluster_domain_suffix: cluster.local + local_image_registry: + name: docker-registry + namespace: docker-registry + hosts: + default: localhost + internal: docker-registry + node: localhost + host_fqdn_override: + default: null + port: + registry: + node: 5000 + monitoring: + name: prometheus + hosts: + default: prom-metrics + public: prometheus + host_fqdn_override: + default: null + path: + default: null + scheme: + default: http + port: + api: + default: 9090 + public: 80 + nagios: + name: nagios + namespace: null + hosts: + default: nagios-metrics + public: nagios + host_fqdn_override: + default: null + path: + default: null + scheme: + default: http + port: + nagios: + default: 25 + +network: + nagios: + ingress: + public: true + proxy_body_size: 1024M + node_port: + enabled: false + port: 30925 + port: 25 + +pod: + lifecycle: + upgrades: + revision_history: 3 + pod_replacement_strategy: RollingUpdate + rolling_update: + max_unavailable: 1 + max_surge: 3 + termination_grace_period: + nagios: + timeout: 30 + replicas: + nagios: 3 + resources: + enabled: false + nagios: + limits: + memory: "1024Mi" + cpu: "2000m" + requests: + memory: "128Mi" + cpu: "100m" + jobs: + image_repo_sync: + limits: + memory: "1024Mi" + cpu: "2000m" + requests: + memory: "128Mi" + cpu: "100m" + +manifests: + configmap_bin: true + configmap_etc: true + deployment: true + job_image_repo_sync: true + service: true + +conf: + nagios: + hosts: + - prometheus: + use: linux-server + host_name: prometheus + alias: "Prometheus Monitoring" + address: $PROMETHEUS_SERVICE + hostgroups: monitoring + host_groups: + - monitoring: + hostgroup_name: monitoring + alias: "Monitoring Instances" + members: prometheus + commands: + - check_prometheus: + command_name: check_prometheus + command_line: "$USER1$/check_prometheus_metric.sh -H $HOSTADDRESS$ -q '$ARG1$' -w $ARG2$ -c $ARG3$ -n $ARG4$ -m $ARG5$" + - check_prometheus_nan_ok: + command_name: check_prometheus_nan_ok + command_line: "$USER1$/check_prometheus_metric.sh -H $HOSTADDRESS$ -q '$ARG1$' -w $ARG2$ -c $ARG3$ -n $ARG4$ -m $ARG5$ -O" + - check_prometheus_extra_info: + command_name: check_prometheus_extra_info + command_line: "$USER1$/check_prometheus_metric.sh -H $HOSTADDRESS$ -q '$ARG1$' -w $ARG2$ -c $ARG3$ -n $ARG4$ -m $ARG5$ -i -t vector" + services: + - check_prometheus_replicas: + use: generic-service + host_name: prometheus + service_description: "Check Prometheus replicas" + check_command: check_prometheus_extra_info!kube_statefulset_status_replicas{namespace="openstack",statefulset="prometheus"}!3!2!prometheus_replicas!lt + check_interval: 1 + - check_alertmanager_replicas: + use: generic-service + host_name: prometheus + service_description: "Check Alertmanager replicas" + check_command: check_prometheus_extra_info!kube_statefulset_status_replicas{namespace="openstack",statefulset="alertmanager"}!3!2!alertmanager_replicas!lt + check_interval: 1 + config: + log_file: /opt/nagios/var/nagios.log + cfg_file: + - /opt/nagios/etc/nagios_objects.cfg + - /opt/nagios/etc/objects/commands.cfg + - /opt/nagios/etc/objects/contacts.cfg + - /opt/nagios/etc/objects/timeperiods.cfg + - /opt/nagios/etc/objects/templates.cfg + object_cache_file: /opt/nagios/var/objects.cache + precached_object_file: /opt/nagios/var/objects.precache + resource_file: /opt/nagios/etc/resource.cfg + status_file: /opt/nagios/var/status.dat + status_update_interval: 10 + nagios_user: nagios + nagios_group: nagios + check_external_commands: 1 + command_file: /opt/nagios/var/rw/nagios.cmd + lock_file: /opt/nagios/var/nagios.lock + temp_file: /opt/nagios/var/nagios.tmp + temp_path: /tmp + event_broker_options: -1 + log_rotation_method: d + log_archive_path: /opt/nagios/var/archives + use_syslog: 1 + log_service_retries: 1 + log_host_retries: 1 + log_event_handlers: 1 + log_initial_states: 0 + log_current_states: 1 + log_external_commands: 1 + log_passive_checks: 1 + service_inter_check_delay_method: s + max_service_check_spread: 30 + service_interleave_factor: s + host_inter_check_delay_method: s + max_host_check_spread: 30 + max_concurrent_checks: 0 + check_result_reaper_frequency: 10 + max_check_result_reaper_time: 30 + check_result_path: /opt/nagios/var/spool/checkresults + max_check_result_file_age: 3600 + cached_host_check_horizon: 15 + cached_service_check_horizon: 15 + enable_predictive_host_dependency_checks: 1 + enable_predictive_service_dependency_checks: 1 + soft_state_dependencies: 0 + auto_reschedule_checks: 0 + auto_rescheduling_interval: 30 + auto_rescheduling_window: 180 + service_check_timeout: 60 + host_check_timeout: 30 + event_handler_timeout: 30 + notification_timeout: 30 + ocsp_timeout: 5 + perfdata_timeout: 5 + retain_state_information: 1 + state_retention_file: /opt/nagios/var/retention.dat + retention_update_interval: 60 + use_retained_program_state: 1 + use_retained_scheduling_info: 1 + retained_host_attribute_mask: 0 + retained_service_attribute_mask: 0 + retained_process_host_attribute_mask: 0 + retained_process_service_attribute_mask: 0 + retained_contact_host_attribute_mask: 0 + retained_contact_service_attribute_mask: 0 + interval_length: 60 + check_for_updates: 1 + bare_update_check: 0 + use_aggressive_host_checking: 0 + execute_service_checks: 1 + accept_passive_service_checks: 1 + execute_host_checks: 1 + accept_passive_host_checks: 1 + enable_notifications: 1 + enable_event_handlers: 1 + process_performance_data: 0 + obsess_over_services: 0 + obsess_over_hosts: 0 + translate_passive_host_checks: 0 + passive_host_checks_are_soft: 0 + check_for_orphaned_services: 1 + check_for_orphaned_hosts: 1 + check_service_freshness: 1 + service_freshness_check_interval: 60 + check_host_freshness: 0 + host_freshness_check_interval: 60 + additional_freshness_latency: 15 + enable_flap_detection: 1 + low_service_flap_threshold: 5.0 + high_service_flap_threshold: 20.0 + low_host_flap_threshold: 5.0 + high_host_flap_threshold: 20.0 + date_format: us + use_regexp_matching: 0 + use_true_regexp_matching: 0 + daemon_dumps_core: 0 + use_large_installation_tweaks: 0 + enable_environment_macros: 0 + debug_level: 0 + debug_verbosity: 1 + debug_file: /opt/nagios/var/nagios.debug + max_debug_file_size: 1000000 + allow_empty_hostgroup_assignment: 0 diff --git a/tools/gate/chart-deploys/default.yaml b/tools/gate/chart-deploys/default.yaml index 75edaa183..3d6215da2 100644 --- a/tools/gate/chart-deploys/default.yaml +++ b/tools/gate/chart-deploys/default.yaml @@ -24,6 +24,7 @@ chart_groups: timeout: 600 charts: - prometheus + - nagios - prometheus_node_exporter - prometheus_kube_state_metrics - prometheus_alertmanager @@ -136,6 +137,16 @@ charts: ingress: public: false + nagios: + chart_name: nagios + release: nagios + namespace: openstack + values: + network: + nagios: + ingress: + public: false + prometheus_openstack_exporter: chart_name: prometheus-openstack-exporter release: prometheus-openstack-exporter