Coder Social home page Coder Social logo

povilasv / coredns-mixin Goto Github PK

View Code? Open in Web Editor NEW
22.0 4.0 17.0 41 KB

A set of Prometheus alerts & grafana dashboards for CoreDNS.

License: Apache License 2.0

Makefile 5.74% Jsonnet 94.26%
kubernetes coredns monitoring-mixins mixin prometheus

coredns-mixin's Introduction

Prometheus Monitoring Mixin for CoreDNS

CircleCI

A set of Grafana dashboards & Prometheus alerts for CoreDNS.

How to use

This mixin is designed to be vendored into the repo with your infrastructure config. To do this, use jsonnet-bundler:

Generate config files

You can manually generate the alerts, dashboards and rules files, but first you must install some tools:

$ go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
$ brew install jsonnet

Then, grab the mixin and its dependencies:

$ git clone https://github.com/povilasv/coredns-mixin
$ cd coredns-mixin
$ jb install

Finally, build the mixin:

$ make prometheus_alerts.yaml
$ make dashboards_out

The prometheus_alerts.yaml file then need to passed to your Prometheus server, and the files in dashboards_out need to be imported into you Grafana server. The exact details will depending on how you deploy your monitoring stack.

Background

  • For more information about monitoring mixins, see this design doc.
  • CoreDNS Prometheus metrics plugin docs

coredns-mixin's People

Contributors

amoghk avatar danehans avatar enkovpetr avatar hoenn avatar paulfantom avatar povilasv avatar rdagnelie avatar tomwilkie avatar v-zhuravlev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

coredns-mixin's Issues

Does not work without providing entire grafana configuration in _config

Hi, I am trying to get this to work with kube-prometheus customization but am unable to do so. To narrow the issue, I started with a fresh workspace and then modified their all-namespaces.jsonnet to include coredns mixin as follows:

local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') +
           (import 'kube-prometheus/kube-prometheus-all-namespaces.libsonnet') +
           (import 'coredns-mixin/mixin.libsonnet') +{
  _config+:: {
    namespace: 'monitoring',

    prometheus+:: {
      namespaces: [],
    },
  },
};

{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }

I get the below error:

  • jsonnet -J vendor -m manifests example1.jsonnet

  • xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
    RUNTIME ERROR: Field does not exist: config
    vendor/grafana/grafana.libsonnet:47:20-44 thunk from <object >
    vendor/grafana/grafana.libsonnet:47:9-45 object
    example1.jsonnet:19:70-80 thunk from <$>
    :1293:24-25 thunk from <function >
    :1293:5-33 function
    example1.jsonnet:19:53-81 $

      During evaluation
    

I tried by adding config for Grafana as follows in the _config section

grafana+:: {
      config+: {
        sections+: {
          server+: {
            root_url: 'https://grafana.10-0-2-15.nip.io/',
          },
        },
        ldap: null,
      },
    },

This results in the below error:

  • jsonnet -J vendor -m manifests example1.jsonnet
  • xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
    RUNTIME ERROR: Field does not exist: ldap
    vendor/grafana/grafana.libsonnet:50:32-54 thunk from <object >
    vendor/grafana/grafana.libsonnet:51:36-49 thunk from <object >
    vendor/ksonnet/ksonnet.beta.4/k8s.libsonnet:9656:82-86
    vendor/ksonnet/ksonnet.beta.4/k8s.libsonnet:9658:41-45 object
    During manifestation

I ended up providing entire grafana configuration. Below is my final _config+::

 _config+:: {
    namespace: 'monitoring',
    grafana+:: {
      config+: {
        sections+: {
          server+: {
            root_url: 'https://grafana.10-0-2-15.nip.io/',
          },
        },
      },
      ldap: null,
      datasources: [{
      }],
      dashboards: {},
      folderDashboards: {},
      rawDashboards: {},
      container: {
        requests: { cpu: '100m', memory: '100Mi' },
        limits: { cpu: '200m', memory: '200Mi' },
      },
      containers: [],
      env: [],
      plugins: [],
      port: 3000,
    },

    prometheus+:: {
      namespaces: [],
    },
  },

Runbook is missing

All alerts has links to a runbook file that does not exists (e.g. https://github.com/povilasv/coredns-mixin/tree/master/runbook.md#alert-name-corednsforwarderrorshigh).

PrometheRule name is not compatble with kube-prometheus

Hi,

I've added your coredns-mixin to kube-prometheus in the JSONNET file, it builds correctly but the PrometheusRule cannot be applied to the Kubernetes cluster as is contains upper case characters in the name. When trying to apply the manifest the following error is raised:

The PrometheusRule "coreDNS" is invalid: metadata.name: Invalid value: "coreDNS": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Changing the start of the manifest as follows resolves the problem:

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  labels:
    prometheus: k8s
  name: coredns
  namespace: monitoring

add-runbook-links.libsonnet breaks runbook_url from other alerts

Hello!
I am trying to use this lib with kube-prometheus and when I import alerts like

local coreDNSAlerts = (import 'coredns-mixin/mixin.libsonnet').prometheusAlerts;
prometheusAlerts+:: jaegerAlerts + coreDNSAlerts

runbook_urls in all other alerts got rewritten

-        runbook_url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-nodefilesystemalmostoutoffiles
+        runbook_url: https://github.com/povilasv/coredns-mixin/tree/master/runbook.md#alert-name-nodefilesystemalmostoutoffiles

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.