Files
2026-08-04 15:45:40 +01:00

243 lines
8.5 KiB
YAML
Executable File

disabled: no
name: 'kubernetes'
discover:
- discoverer: k8s
k8s:
- tags: unknown
role: pod
pod:
local_mode: yes
classify:
- name: "Control-Plane"
selector: unknown
tags: -unknown control_plane
match:
- tags: kube_scheduler
expr: '{{ glob .Image "k8s.gcr.io/kube-scheduler:*" }}'
- tags: kube_controller_manager
expr: '{{ glob .Image "k8s.gcr.io/kube-controller-manager:*" }}'
- name: "Applications"
selector: unknown
tags: -unknown applications
match:
- tags: activemq
expr: '{{ and (eq .Port "8161") (glob .Image "*/activemq*") }}'
- tags: apache
expr: '{{ and (eq .Port "80" "8080") (glob .Image "httpd*" "*/httpd*") }}'
- tags: bind
expr: '{{ and (eq .Port "8653") (glob .Image "*/bind*") }}'
- tags: cockroachdb
expr: '{{ and (eq .Port "8080") (glob .Image "*/cockroach*") }}'
- tags: consul
expr: '{{ and (eq .Port "8500") (glob .Image "consul*" "*/consul*") }}'
- tags: coredns
expr: '{{ and (eq .Port "9153") (glob .Image "*/coredns*") }}'
- tags: elasticsearch
expr: '{{ and (eq .Port "9200") (glob .Image "elasticsearch:*" "*/elasticsearch:*") }}'
- tags: fluentd
expr: '{{ and (eq .Port "24220") (glob .Image "fluentd*" "*/fluentd*") }}'
- tags: freeradius
expr: '{{ and (eq .Port "18121") (glob .Image "*/freeradius*") }}'
- tags: hdfs
expr: '{{ and (eq .Port "50070") (glob .Image "*/hdfs*") }}'
- tags: lighttpd
expr: '{{ and (eq .Port "80" "8080") (glob .Image "*/lighttpd*") }}'
- tags: logstash
expr: '{{ and (eq .Port "9600") (glob .Image "logstash*" "*/logstash*") }}'
- tags: mysql
expr: '{{ and (eq .Port "3306") (glob .Image "mysql*" "*/mysql*" "mariadb*" "*/mariadb*") }}'
- tags: nginx
expr: '{{ and (eq .Port "80" "8080") (glob .Image "nginx*" "*/nginx*") }}'
- tags: openvpn
expr: '{{ and (eq .Port "7505") (glob .Image "*/openvpn") }}'
- tags: phpfpm
expr: '{{ and (eq .Port "80" "8080") (glob .Image "*/phpfpm*" "*/php-fpm*") }}'
- tags: rabbitmq
expr: '{{ and (eq .Port "15672") (glob .Image "rabbitmq*" "*/rabbitmq*") }}'
- tags: solr
expr: '{{ and (eq .Port "8983") (glob .Image "solr*" "*/solr*") }}'
- tags: tengine
expr: '{{ and (eq .Port "80" "8080") (glob .Image "*/tengine*") }}'
- tags: unbound
expr: '{{ and (eq .Port "8953") (glob .Image "*/unbound*") }}'
- tags: vernemq
expr: '{{ and (eq .Port "8888") (glob .Image "*/vernemq*") }}'
- tags: zookeeper
expr: '{{ and (eq .Port "2181") (glob .Image "zookeeper*" "*/zookeeper*") }}'
- tags: consul_envoy
expr: |
{{ $imageOK := glob .Image "*/consul-dataplane*" -}}
{{ $scrapeOK := eq (get .Annotations "prometheus.io/scrape") "true" -}}
{{ $promPort := get .Annotations "prometheus.io/port" -}}
{{ $portOK1 := and (eq .Port $promPort) (not (empty .Port)) -}}
{{ $portOK2 := and (empty .Port) (not (empty $promPort)) -}}
{{ and $imageOK $scrapeOK (or $portOK1 $portOK2) }}
- name: "Prometheus Generic Applications"
selector: unknown
tags: -unknown prometheus_generic
match:
- tags: prometheus_generic
expr: |
{{ $scrapeOK := eq (get .Annotations "prometheus.io/scrape") "true" -}}
{{ $portOK := eq (default .Port (get .Annotations "prometheus.io/port")) .Port -}}
{{ $imageOK := not (glob .Image "netdata/netdata*" "*pulsar*" "*telegraf*") -}}
{{ and $scrapeOK $portOK $imageOK }}
compose:
- name: "Control-Plane"
selector: '!unknown control_plane'
config:
- selector: kube_scheduler
template: |
- module: prometheus
name: prometheus-{{.TUID}}
url: http://{{.PodIP}}:{{default "10251" .Port}}/metrics
app: '{{.ContName}}'
update_every: 10
max_time_series: 1000
- selector: kube_controller_manager
template: |
- module: prometheus
name: prometheus-{{.TUID}}
url: http://{{.PodIP}}:{{default "10252" .Port}}/metrics
app: '{{.ContName}}'
update_every: 10
max_time_series: 2000
- name: "Prometheus Generic Applications"
selector: '!unknown prometheus_generic'
config:
- selector: prometheus_generic
template: |
{{ $path := default "/metrics" (get .Annotations "prometheus.io/path") -}}
- module: prometheus
name: prometheus-{{.TUID}}
url: http://{{.Address}}{{$path}}
app: '{{.ContName}}'
update_every: 10
max_time_series: 4000
- name: "Applications"
selector: '!unknown applications'
tags: file
config:
- selector: activemq
template: |
- module: activemq
name: activemq-{{.TUID}}
url: http://{{.Address}}
- selector: apache
template: |
- module: apache
name: apache-{{.TUID}}
url: http://{{.Address}}/server-status?auto
- selector: bind
template: |
- module: bind
name: bind-{{.TUID}}
url: http://{{.Address}}/json/v1
- selector: cockroachdb
template: |
- module: cockroachdb
name: cockroachdb-{{.TUID}}
url: http://{{.Address}}/_status/vars
- selector: consul
template: |
- module: consul
name: consul-{{.TUID}}
url: http://{{.Address}}
- selector: coredns
template: |
- module: coredns
name: coredns-{{.TUID}}
url: http://{{.Address}}/metrics
- selector: elasticsearch
template: |
- module: elasticsearch
name: elasticsearch-{{.TUID}}
url: http://{{.Address}}
- selector: consul_envoy
template: |
{{ $path := default "/metrics" (get .Annotations "prometheus.io/path") -}}
{{ $promPort := get .Annotations "prometheus.io/port" -}}
{{ $port := ternary .Port $promPort (not (empty .Port)) -}}
- module: envoy
name: {{.TUID}}
url: http://{{ .PodIP }}:{{ $port }}{{ $path }}
- selector: fluentd
template: |
- module: fluentd
name: fluentd-{{.TUID}}
url: http://{{.Address}}
- selector: freeradius
template: |
- module: freeradius
name: freeradius-{{.TUID}}
address: {{.PodIP}}
port: {{.Port}}
- selector: hdfs
template: |
- module: hdfs
name: hdfs-{{.TUID}}
url: http://{{.Address}}/jmx
- selector: lighttpd
template: |
- module: lighttpd
name: lighttpd-{{.TUID}}
url: http://{{.Address}}/server-status?auto
- selector: logstash
template: |
- module: logstash
name: logstash-{{.TUID}}
url: http://{{.Address}}
- selector: mysql
template: |
- module: mysql
name: mysql-{{.TUID}}
dsn: 'netdata@tcp({{.Address}})/'
- selector: nginx
template: |
- module: nginx
name: nginx-{{.TUID}}
url: http://{{.Address}}/stub_status
- selector: openvpn
template: |
- module: openvpn
name: openvpn-{{.TUID}}
address: {{.Address}}
- selector: phpfpm
template: |
- module: phpfpm
name: phpfpm-{{.TUID}}
url: http://{{.Address}}/status?full&json
- selector: rabbitmq
template: |
- module: rabbitmq
name: rabbitmq-{{.TUID}}
url: http://{{.Address}}
- selector: solr
template: |
- module: solr
name: solr-{{.TUID}}
url: http://{{.Address}}
- selector: tengine
template: |
- module: tengine
name: tengine-{{.TUID}}
url: http://{{.Address}}/us
- selector: unbound
template: |
- module: unbound
name: unbound-{{.TUID}}
address: {{.Address}}
use_tls: false
- selector: vernemq
template: |
- module: vernemq
name: vernemq-{{.TUID}}
url: http://{{.Address}}/metrics
- selector: zookeeper
template: |
- module: zookeeper
name: zookeeper-{{.TUID}}
address: {{.Address}}