netdata/netdata

View on GitHub
src/go/collectors/go.d.plugin/config/go.d/sd/net_listeners.conf

Summary

Maintainability
Test Coverage
disabled: no

name: 'network listeners'

discover:
  - discoverer: net_listeners
    net_listeners:
      tags: "unknown"

classify:
  - name: "Applications"
    selector: "unknown"
    tags: "-unknown app"
    match:
      - tags: "activemq"
        expr: '{{ and (eq .Port "8161") (eq .Comm "activemq") }}'
      - tags: "apache"
        expr: '{{ and (eq .Port "80" "8080") (eq .Comm "apache" "apache2" "httpd") }}'
      - tags: "bind"
        expr: '{{ and (eq .Port "8653") (eq .Comm "bind" "named") }}'
      - tags: "cassandra"
        expr: '{{ and (eq .Port "7072") (glob .Cmdline "*cassandra*") }}'
      - tags: "chrony"
        expr: '{{ and (eq .Port "323") (eq .Comm "chronyd") }}'
      - tags: "cockroachdb"
        expr: '{{ and (eq .Port "8080") (eq .Comm "cockroach") }}'
      - tags: "consul"
        expr: '{{ and (eq .Port "8500") (eq .Comm "consul") }}'
      - tags: "coredns"
        expr: '{{ and (eq .Port "9153") (eq .Comm "coredns") }}'
      - tags: "couchbase"
        expr: '{{ or (eq .Port "8091") (glob .Cmdline "*couchbase*") }}'
      - tags: "couchdb"
        expr: '{{ or (eq .Port "5984") (glob .Cmdline "*couchdb*") }}'
      - tags: "dnsdist"
        expr: '{{ and (eq .Port "8083") (eq .Comm "dnsdist") }}'
      - tags: "dnsmasq"
        expr: '{{ and (eq .Protocol "UDP") (eq .Port "53") (eq .Comm "dnsmasq") }}'
      - tags: "docker_engine"
        expr: '{{ and (eq .Port "9323") (eq .Comm "dockerd") }}'
      - tags: "elasticsearch"
        expr: '{{ or (eq .Port "9200") (glob .Cmdline "*elasticsearch*" "*opensearch*") }}'
      - tags: "envoy"
        expr: '{{ and (eq .Port "9901") (eq .Comm "envoy") }}'
      - tags: "fluentd"
        expr: '{{ and (eq .Port "24220") (glob .Cmdline "*fluentd*") }}'
      - tags: "freeradius"
        expr: '{{ and (eq .Port "18121") (eq .Comm "freeradius") }}'
      - tags: "geth"
        expr: '{{ and (eq .Port "6060") (eq .Comm "geth") }}'
      - tags: "haproxy"
        expr: '{{ and (eq .Port "8404") (eq .Comm "haproxy") }}'
      - tags: "hddtemp"
        expr: '{{ and (eq .Port "7634") (eq .Comm "hddtemp") }}'
      - tags: "hdfs_namenode"
        expr: '{{ and (eq .Port "9870") (eq .Comm "hadoop") }}'
      - tags: "hdfs_datanode"
        expr: '{{ and (eq .Port "9864") (eq .Comm "hadoop") }}'
      - tags: "kubelet"
        expr: '{{ and (eq .Port "10250" "10255") (eq .Comm "kubelet") }}'
      - tags: "kubeproxy"
        expr: '{{ and (eq .Port "10249") (eq .Comm "kube-proxy") }}'
      - tags: "lighttpd"
        expr: '{{ and (eq .Port "80" "8080") (eq .Comm "lighttpd") }}'
      - tags: "logstash"
        expr: '{{ and (eq .Port "9600") (glob .Cmdline "*logstash*") }}'
      - tags: "mongodb"
        expr: '{{ or (eq .Port "27017") (eq .Comm "mongod") }}'
      - tags: "mysql"
        expr: '{{ or (eq .Port "3306") (eq .Comm "mysqld" "mariadbd") }}'
      - tags: "nginx"
        expr: '{{ and (eq .Port "80" "8080") (eq .Comm "nginx") }}'
      - tags: "ntpd"
        expr: '{{ or (eq .Port "123") (eq .Comm "ntpd") }}'
      - tags: "openvpn"
        expr: '{{ and (eq .Port "7505") (eq .Comm "openvpn") }}'
      - tags: "pgbouncer"
        expr: '{{ or (eq .Port "6432") (eq .Comm "pgbouncer") }}'
      - tags: "pihole"
        expr: '{{ and (eq .Port "53") (eq .Comm "pihole-FTL") }}'
      - tags: "pika"
        expr: '{{ and (eq .Port "9221") (eq .Comm "pika") }}'
      - tags: "postgres"
        expr: '{{ or (eq .Port "5432") (eq .Comm "postgres") }}'
      - tags: "powerdns"
        expr: '{{ and (eq .Port "8081") (eq .Comm "pdns_server") }}'
      - tags: "powerdns_recursor"
        expr: '{{ and (eq .Port "8081") (eq .Comm "pdns_recursor") }}'
      - tags: "proxysql"
        expr: '{{ or (eq .Port "6032") (eq .Comm "proxysql") }}'
      - tags: "rabbitmq"
        expr: '{{ or (eq .Port "15672") (glob .Cmdline "*rabbitmq*") }}'
      - tags: "redis"
        expr: '{{ or (eq .Port "6379") (eq .Comm "redis-server") }}'
      - tags: "rspamd"
        expr: '{{ and (eq .Port "11334") (eq .Comm "rspamd") }}'
      - tags: "supervisord"
        expr: '{{ and (eq .Port "9001") (eq .Comm "supervisord") }}'
      - tags: "traefik"
        expr: '{{ and (eq .Port "80" "8080") (eq .Comm "traefik") }}'
      - tags: "unbound"
        expr: '{{ and (eq .Port "8953") (eq .Comm "unbound") }}'
      - tags: "upsd"
        expr: '{{ or (eq .Port "3493") (eq .Comm "upsd") }}'
      - tags: "vernemq"
        expr: '{{ and (eq .Port "8888") (glob .Cmdline "*vernemq*") }}'
      - tags: "zookeeper"
        expr: '{{ or (eq .Port "2181" "2182") (glob .Cmdline "*zookeeper*") }}'
  - name: "Prometheus exporters"
    selector: "unknown"
    tags: "-unknown exporter"
    match:
      - tags: "exporter"
        expr: '{{ and (not (empty (promPort .Port))) (not (eq .Comm "docker-proxy")) }}'
compose:
  - name: "Applications"
    selector: "app"
    config:
      - selector: "activemq"
        template: |
          module: activemq
          name: local
          url: http://{{.Address}}
          webadmin: admin
      - selector: "apache"
        template: |
          module: apache
          name: local
          url: http://{{.Address}}/server-status?auto
      - selector: "bind"
        template: |
          module: bind
          name: local
          url: http://{{.Address}}/json/v1
      - selector: "cassandra"
        template: |
          module: cassandra
          name: local
          url: http://{{.Address}}/metrics
      - selector: "chrony"
        template: |
          module: chrony
          name: local
          address: {{.Address}}
      - selector: "cockroachdb"
        template: |
          module: cockroachdb
          name: local
          url: http://{{.Address}}/_status/vars
      - selector: "consul"
        template: |
          module: consul
          name: local
          url: http://{{.Address}}
      - selector: "coredns"
        template: |
          module: coredns
          name: local
          url: http://{{.Address}}/metrics
      - selector: "couchbase"
        template: |
          module: couchbase
          name: local
          url: http://{{.Address}}
      - selector: "couchdb"
        template: |
          module: couchdb
          name: local
          url: http://{{.Address}}
          node: '_local'
      - selector: "dnsdist"
        template: |
          module: dnsdist
          name: local
          url: http://{{.Address}}
          headers:
            X-API-Key: 'dnsdist-api-key'
      - selector: "dnsmasq"
        template: |
          module: dnsmasq
          name: local
          protocol: udp
          address: {{.Address}}
      - selector: "docker_engine"
        template: |
          module: docker_engine
          name: local
          url: http://{{.Address}}/metrics
      - selector: "elasticsearch"
        template: |
          module: elasticsearch
          name: local
          {{ if glob .Cmdline "*elastic*" -}}
          url: http://{{.Address}}
          {{ else -}}
          url: https://{{.Address}}
          tls_skip_verify: yes
          username: admin
          password: admin
          {{ end -}}
      - selector: "envoy"
        template: |
          module: envoy
          name: local
          url: http://{{.Address}}/stats/prometheus
      - selector: "envoy"
        template: |
          module: envoy
          name: local
          url: http://{{.Address}}/stats/prometheus
      - selector: "fluentd"
        template: |
          module: fluentd
          name: local
          url: http://{{.Address}}
      - selector: "freeradius"
        template: |
          module: freeradius
          name: local
          address: {{.IPAddress}}
          port: {{.Port}}
          secret: adminsecret
      - selector: "geth"
        template: |
          module: geth
          name: local
          url: http://{{.Address}}/debug/metrics/prometheus
      - selector: "haproxy"
        template: |
          module: haproxy
          name: local
          url: http://{{.Address}}/metrics
      - selector: "hddtemp"
        template: |
          module: hddtemp
          name: local
          address: {{.Address}}
      - selector: "hdfs_namenode"
        template: |
          module: hdfs
          name: namenode_local
          url: http://{{.Address}}/jmx
      - selector: "hdfs_datanode"
        template: |
          module: hdfs
          name: datanode_local
          url: http://{{.Address}}/jmx
      - selector: "kubelet"
        template: |
          module: k8s_kubelet
          name: local
          {{- if eq .Port "10255" }}
          url: http://{{.Address}}/metrics
          {{- else }}
          url: https://{{.Address}}/metrics
          tls_skip_verify: yes
          {{- end }}
      - selector: "kubeproxy"
        template: |
          module: k8s_kubeproxy
          name: local
          url: http://{{.Address}}/metrics
      - selector: "lighttpd"
        template: |
          module: lighttpd
          name: local
          url: http://{{.Address}}/server-status?auto
      - selector: "logstash"
        template: |
          module: logstash
          name: local
          url: http://{{.Address}}
      - selector: "mongodb"
        template: |
          module: mongodb
          name: local
          uri: mongodb://{{.Address}}
      - selector: "mysql"
        template: |
          - module: mysql
            name: local
            dsn: netdata@unix(/var/run/mysqld/mysqld.sock)/
          - module: mysql
            name: local
            dsn: netdata@tcp({{.Address}})/
      - selector: "nginx"
        template: |
          - module: nginx
            name: local
            url: http://{{.Address}}/stub_status
          - module: nginx
            name: local
            url: http://{{.Address}}/basic_status
          - module: nginx
            name: local
            url: http://{{.Address}}/nginx_status
          - module: nginx
            name: local
            url: http://{{.Address}}/status
      - selector: "ntpd"
        template: |
          module: ntpd
          name: local
          address: {{.Address}}
          collect_peers: no
      - selector: "openvpn"
        template: |
          module: openvpn
          name: local
          address: {{.Address}}
      - selector: "pgbouncer"
        template: |
          module: pgbouncer
          name: local
          dsn: postgres://netdata:postgres@{{.Address}}/pgbouncer
      - selector: "pihole"
        template: |
          module: pihole
          name: local
          url: http://{{.Address}}
      - selector: "pika"
        template: |
          module: pika
          name: local
          address: redis://@{{.IPAddress}}:{{.Port}}
      - selector: "rspamd"
        template: |
          module: rspamd
          name: local
          url: http://{{.Address}}
      - selector: "postgres"
        template: |
          - module: postgres
            name: local
            dsn: 'host=/var/run/postgresql dbname=postgres user=postgres'
          - module: postgres
            name: local
            dsn: 'host=/var/run/postgresql dbname=postgres user=netdata'
          - module: postgres
            name: local
            dsn: postgresql://netdata@{{.Address}}/postgres
      - selector: "powerdns"
        template: |
          module: powerdns
          name: local
          url: http://{{.Address}}
          headers:
            X-API-KEY: secret
      - selector: "powerdns_recursor"
        template: |
          module: powerdns_recursor
          name: local
          url: http://{{.Address}}
          headers:
            X-API-KEY: secret
      - selector: "proxysql"
        template: |
          module: proxysql
          name: local
          dsn: stats:stats@tcp({{.Address}})/
      - selector: "rabbitmq"
        template: |
          module: rabbitmq
          name: local
          url: http://{{.Address}}
          username: guest
          password: guest
          collect_queues_metrics: no
      - selector: "redis"
        template: |
          module: redis
          name: local
          address: redis://@{{.Address}}
      - selector: "supervisord"
        template: |
          module: supervisord
          name: local
          url: http://{{.Address}}/RPC2
      - selector: "traefik"
        template: |
          module: traefik
          name: local
          url: http://{{.Address}}/metrics
      - selector: "traefik"
        template: |
          module: traefik
          name: local
          url: http://{{.Address}}/metrics
      - selector: "unbound"
        template: |
          module: unbound
          name: local
          address: {{.Address}}
      - selector: "upsd"
        template: |
          module: upsd
          name: local
          address: {{.Address}}
      - selector: "vernemq"
        template: |
          module: vernemq
          name: local
          url: http://{{.Address}}/metrics
      - selector: "zookeeper"
        template: |
          module: zookeeper
          name: local
          address: {{.Address}}

  - name: "Prometheus exporters generic"
    selector: "exporter"
    config:
      - selector: "exporter"
        template: |
          {{ $name := promPort .Port -}}
          module: prometheus
          name: {{$name}}_local
          url: http://{{.Address}}/metrics
          {{ if eq $name "caddy" -}}
          expected_prefix: 'caddy_'
          {{ else if eq $name "openethereum" -}}
          expected_prefix: 'blockchaincache_'
          {{ else if eq $name "crowdsec" -}}
          expected_prefix: 'cs_'
          {{ else if eq $name "netbox" -}}
          expected_prefix: 'django_'
          {{ else if eq $name "traefik" -}}
          expected_prefix: 'traefik_'
          {{ else if eq $name "pushgateway" -}}
          expected_prefix: 'pushgateway_'
          selector:
            allow:
              - pushgateway_*
          {{ else if eq $name "wireguard_exporter" -}}
          expected_prefix: 'wireguard_exporter'
          {{ else if eq $name "clickhouse" -}}
          max_time_series: 3000
          {{ end -}}