From 72033fda0af5c988ef73e4cf52d81e14c5913fd2 Mon Sep 17 00:00:00 2001 From: Allen Ma Date: Thu, 22 Oct 2020 09:22:03 -0400 Subject: [PATCH] changed mixins.yaml to mixins.json; added command to copy mixins.json to hugo --- README.md | 2 +- hack/generate.sh | 15 +++-- mixins.json | 98 +++++++++++++++++++++++++++++++ mixins.yaml | 70 ---------------------- site/content/cortex/_index.md | 2 +- site/content/prometheus/_index.md | 2 +- site/static/mixins.json | 98 +++++++++++++++++++++++++++++++ 7 files changed, 209 insertions(+), 78 deletions(-) create mode 100644 mixins.json delete mode 100644 mixins.yaml create mode 100644 site/static/mixins.json diff --git a/README.md b/README.md index b82c1ff..bd8f550 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Adding new mixin 0. Install [required software](#requirements) -1. Add new mixin to [mixins.yaml](mixins.yaml) file +1. Add new mixin to [mixins.json](mixins.json) file 2. Run `make` ## Requirements diff --git a/hack/generate.sh b/hack/generate.sh index be6a7a9..62a4860 100755 --- a/hack/generate.sh +++ b/hack/generate.sh @@ -9,6 +9,7 @@ TMPDIR="${TOP}/tmp/repos" # Make sure to use project tooling PATH="${TOP}/tmp/bin:${PATH}" + download_mixin() { local mixin="$1" local repo="$2" @@ -79,12 +80,12 @@ find site/content/ ! -name '_index.md' -type f -exec rm -rf {} + mkdir -p "${TMPDIR}" # Generate mixins -CONFIG=$(gojsontoyaml -yamltojson < mixins.yaml) +CONFIG="mixins.json" -for mixin in $(echo "$CONFIG" | jq -r '.mixins[].name'); do - repo="$(echo "$CONFIG" | jq -r ".mixins[] | select(.name == \"$mixin\") | .source")" - subdir="$(echo "$CONFIG" | jq -r ".mixins[] | select(.name == \"$mixin\") | .subdir")" - text="$(echo "$CONFIG" | jq -r ".mixins[] | select(.name == \"$mixin\") | .description")" +for mixin in $(cat "$CONFIG" | jq -r '.mixins[].name'); do + repo="$(cat "$CONFIG" | jq -r ".mixins[] | select(.name == \"$mixin\") | .source")" + subdir="$(cat "$CONFIG" | jq -r ".mixins[] | select(.name == \"$mixin\") | .subdir")" + text="$(cat "$CONFIG" | jq -r ".mixins[] | select(.name == \"$mixin\") | .description")" if [ "$text" == "null" ]; then text=""; fi set +u download_mixin "$mixin" "$repo" "$subdir" @@ -124,3 +125,7 @@ for mixin in $(echo "$CONFIG" | jq -r '.mixins[].name'); do done fi done + +cd "${TOP}" || exit 1 +mkdir -p "site/static" +cp -f "${CONFIG}" "site/static/" diff --git a/mixins.json b/mixins.json new file mode 100644 index 0000000..7a40fad --- /dev/null +++ b/mixins.json @@ -0,0 +1,98 @@ +{ + "mixins": [ + { + "name": "prometheus", + "source": "https://github.com/prometheus/prometheus", + "subdir": "documentation/prometheus-mixin", + "description": "The Prometheus Mixin is a set of configurable, reusable, and extensible alerts and dashboards for Prometheus." + }, + { + "name": "node-exporter", + "source": "https://github.com/prometheus/node_exporter", + "subdir": "docs/node-mixin", + "description": "The Node Mixin is a set of configurable, reusable, and extensible alerts and dashboards based on the metrics exported by the Node Exporter. The mixin creates recording and alerting rules for Prometheus and suitable dashboard descriptions for Grafana." + }, + { + "name": "kubernetes", + "source": "https://github.com/kubernetes-monitoring/kubernetes-mixin", + "subdir": "", + "description": "A set of Grafana dashboards and Prometheus alerts for Kubernetes." + }, + { + "name": "kube-state-metrics", + "source": "https://github.com/kubernetes/kube-state-metrics", + "subdir": "jsonnet/kube-state-metrics-mixin" + }, + { + "name": "etcd", + "source": "https://github.com/etcd-io/etcd", + "subdir": "Documentation/etcd-mixin", + "description": "A set of customisable Prometheus alerts for etcd." + }, + { + "name": "ceph", + "source": "https://github.com/ceph/ceph-mixins", + "subdir": "", + "description": "A set of Prometheus alerts for Ceph.\n\nThe scope of this project is to provide Ceph specific Prometheus rule files using Prometheus Mixins.\n" + }, + { + "name": "gluster", + "source": "https://github.com/gluster/gluster-mixins", + "subdir": "", + "description": "A set of Grafana dashboards and Prometheus alerts for Gluster.\n\nThe scope of this project is to provide Gluster specific Grafana dashboard configs and Prometheus rule files using Prometheus Mixins.\n" + }, + { + "name": "consul", + "source": "https://github.com/grafana/jsonnet-libs", + "subdir": "consul-mixin", + "description": "Grafana dashboards and Prometheus alerts for operating Consul, in the form of a monitoring mixin." + }, + { + "name": "jaeger", + "source": "https://github.com/grafana/jsonnet-libs", + "subdir": "jaeger-mixin" + }, + { + "name": "memcached", + "source": "https://github.com/grafana/jsonnet-libs", + "subdir": "memcached-mixin", + "description": "Grafana dashboard for operating Memcached, in the form of a monitoring mixin." + }, + { + "name": "sealed-secrets", + "source": "https://github.com/bitnami-labs/sealed-secrets", + "subdir": "contrib/prometheus-mixin" + }, + { + "name": "thanos", + "source": "https://github.com/thanos-io/thanos", + "subdir": "mixin" + }, + { + "name": "cortex", + "source": "https://github.com/grafana/cortex-jsonnet", + "subdir": "cortex-mixin" + }, + { + "name": "kube-cockroachdb", + "source": "https://github.com/metalmatze/kube-cockroachdb", + "subdir": "monitoring" + }, + { + "name": "coredns", + "source": "https://github.com/povilasv/coredns-mixin", + "subdir": "", + "description": "CoreDNS mixin provides Grafana dashboard and Prometheus Alerts to monitor CoreDNS. The mixin was introduced in [Kubernetes Node Local DNS Cache blogpost](https://povilasv.me/kubernetes-node-local-dns-cache/) to better help users monitor CoreDNS in Kubernetes. Mixin can also be used to monitor standalone CoreDNS instance without any orchestrators.\n" + }, + { + "name": "prometheus-operator", + "source": "https://github.com/prometheus-operator/prometheus-operator", + "subdir": "jsonnet/mixin" + }, + { + "name": "cert-manager", + "source": "https://gitlab.com/uneeq-oss/cert-manager-mixin.git", + "subdir": "" + } + ] +} diff --git a/mixins.yaml b/mixins.yaml deleted file mode 100644 index 443a6a0..0000000 --- a/mixins.yaml +++ /dev/null @@ -1,70 +0,0 @@ ---- -mixins: -- name: "prometheus" - source: "https://github.com/prometheus/prometheus" - subdir: "documentation/prometheus-mixin" - description: "The Prometheus Mixin is a set of configurable, reusable, and extensible alerts and dashboards for Prometheus." -- name: node-exporter - source: "https://github.com/prometheus/node_exporter" - subdir: "docs/node-mixin" - description: "The Node Mixin is a set of configurable, reusable, and extensible alerts and dashboards based on the metrics exported by the Node Exporter. The mixin creates recording and alerting rules for Prometheus and suitable dashboard descriptions for Grafana." -- name: kubernetes - source: "https://github.com/kubernetes-monitoring/kubernetes-mixin" - subdir: "" - description: "A set of Grafana dashboards and Prometheus alerts for Kubernetes." -- name: kube-state-metrics - source: "https://github.com/kubernetes/kube-state-metrics" - subdir: "jsonnet/kube-state-metrics-mixin" -- name: etcd - source: "https://github.com/etcd-io/etcd" - subdir: "Documentation/etcd-mixin" - description: "A set of customisable Prometheus alerts for etcd." -- name: ceph - source: "https://github.com/ceph/ceph-mixins" - subdir: "" - description: | - A set of Prometheus alerts for Ceph. - - The scope of this project is to provide Ceph specific Prometheus rule files using Prometheus Mixins. -- name: gluster - source: "https://github.com/gluster/gluster-mixins" - subdir: "" - description: | - A set of Grafana dashboards and Prometheus alerts for Gluster. - - The scope of this project is to provide Gluster specific Grafana dashboard configs and Prometheus rule files using Prometheus Mixins. -- name: consul - source: "https://github.com/grafana/jsonnet-libs" - subdir: "consul-mixin" - description: "Grafana dashboards and Prometheus alerts for operating Consul, in the form of a monitoring mixin." -- name: jaeger - source: "https://github.com/grafana/jsonnet-libs" - subdir: "jaeger-mixin" -- name: memcached - source: "https://github.com/grafana/jsonnet-libs" - subdir: "memcached-mixin" - description: "Grafana dashboard for operating Memcached, in the form of a monitoring mixin." -- name: sealed-secrets - source: "https://github.com/bitnami-labs/sealed-secrets" - subdir: "contrib/prometheus-mixin" -- name: thanos - source: "https://github.com/thanos-io/thanos" - subdir: "mixin" -- name: cortex - source: "https://github.com/grafana/cortex-jsonnet" - subdir: "cortex-mixin" -- name: kube-cockroachdb - source: "https://github.com/metalmatze/kube-cockroachdb" - subdir: "monitoring" -- name: coredns - source: "https://github.com/povilasv/coredns-mixin" - subdir: "" - description: | - CoreDNS mixin provides Grafana dashboard and Prometheus Alerts to monitor CoreDNS. The mixin was introduced in [Kubernetes Node Local DNS Cache blogpost](https://povilasv.me/kubernetes-node-local-dns-cache/) to better help users monitor CoreDNS in Kubernetes. Mixin can also be used to monitor standalone CoreDNS instance without any orchestrators. -- name: prometheus-operator - source: "https://github.com/prometheus-operator/prometheus-operator" - subdir: "jsonnet/mixin" -- name: cert-manager - source: "https://gitlab.com/uneeq-oss/cert-manager-mixin.git" - subdir: "" - diff --git a/site/content/cortex/_index.md b/site/content/cortex/_index.md index db682eb..0845568 100644 --- a/site/content/cortex/_index.md +++ b/site/content/cortex/_index.md @@ -1772,8 +1772,8 @@ Following dashboards are generated from mixins and hosted on github: - [cortex-blocks-vs-chunks](https://github.com/monitoring-mixins/website/blob/master/assets/cortex/dashboards/cortex-blocks-vs-chunks.json) - [cortex-chunks](https://github.com/monitoring-mixins/website/blob/master/assets/cortex/dashboards/cortex-chunks.json) -- [cortex-compactor-resources](https://github.com/monitoring-mixins/website/blob/master/assets/cortex/dashboards/cortex-compactor-resources.json) - [cortex-compactor](https://github.com/monitoring-mixins/website/blob/master/assets/cortex/dashboards/cortex-compactor.json) +- [cortex-compactor-resources](https://github.com/monitoring-mixins/website/blob/master/assets/cortex/dashboards/cortex-compactor-resources.json) - [cortex-config](https://github.com/monitoring-mixins/website/blob/master/assets/cortex/dashboards/cortex-config.json) - [cortex-object-store](https://github.com/monitoring-mixins/website/blob/master/assets/cortex/dashboards/cortex-object-store.json) - [cortex-queries](https://github.com/monitoring-mixins/website/blob/master/assets/cortex/dashboards/cortex-queries.json) diff --git a/site/content/prometheus/_index.md b/site/content/prometheus/_index.md index 8a2c7d4..24440aa 100644 --- a/site/content/prometheus/_index.md +++ b/site/content/prometheus/_index.md @@ -324,5 +324,5 @@ labels: Following dashboards are generated from mixins and hosted on github: -- [prometheus-remote-write](https://github.com/monitoring-mixins/website/blob/master/assets/prometheus/dashboards/prometheus-remote-write.json) - [prometheus](https://github.com/monitoring-mixins/website/blob/master/assets/prometheus/dashboards/prometheus.json) +- [prometheus-remote-write](https://github.com/monitoring-mixins/website/blob/master/assets/prometheus/dashboards/prometheus-remote-write.json) diff --git a/site/static/mixins.json b/site/static/mixins.json new file mode 100644 index 0000000..7a40fad --- /dev/null +++ b/site/static/mixins.json @@ -0,0 +1,98 @@ +{ + "mixins": [ + { + "name": "prometheus", + "source": "https://github.com/prometheus/prometheus", + "subdir": "documentation/prometheus-mixin", + "description": "The Prometheus Mixin is a set of configurable, reusable, and extensible alerts and dashboards for Prometheus." + }, + { + "name": "node-exporter", + "source": "https://github.com/prometheus/node_exporter", + "subdir": "docs/node-mixin", + "description": "The Node Mixin is a set of configurable, reusable, and extensible alerts and dashboards based on the metrics exported by the Node Exporter. The mixin creates recording and alerting rules for Prometheus and suitable dashboard descriptions for Grafana." + }, + { + "name": "kubernetes", + "source": "https://github.com/kubernetes-monitoring/kubernetes-mixin", + "subdir": "", + "description": "A set of Grafana dashboards and Prometheus alerts for Kubernetes." + }, + { + "name": "kube-state-metrics", + "source": "https://github.com/kubernetes/kube-state-metrics", + "subdir": "jsonnet/kube-state-metrics-mixin" + }, + { + "name": "etcd", + "source": "https://github.com/etcd-io/etcd", + "subdir": "Documentation/etcd-mixin", + "description": "A set of customisable Prometheus alerts for etcd." + }, + { + "name": "ceph", + "source": "https://github.com/ceph/ceph-mixins", + "subdir": "", + "description": "A set of Prometheus alerts for Ceph.\n\nThe scope of this project is to provide Ceph specific Prometheus rule files using Prometheus Mixins.\n" + }, + { + "name": "gluster", + "source": "https://github.com/gluster/gluster-mixins", + "subdir": "", + "description": "A set of Grafana dashboards and Prometheus alerts for Gluster.\n\nThe scope of this project is to provide Gluster specific Grafana dashboard configs and Prometheus rule files using Prometheus Mixins.\n" + }, + { + "name": "consul", + "source": "https://github.com/grafana/jsonnet-libs", + "subdir": "consul-mixin", + "description": "Grafana dashboards and Prometheus alerts for operating Consul, in the form of a monitoring mixin." + }, + { + "name": "jaeger", + "source": "https://github.com/grafana/jsonnet-libs", + "subdir": "jaeger-mixin" + }, + { + "name": "memcached", + "source": "https://github.com/grafana/jsonnet-libs", + "subdir": "memcached-mixin", + "description": "Grafana dashboard for operating Memcached, in the form of a monitoring mixin." + }, + { + "name": "sealed-secrets", + "source": "https://github.com/bitnami-labs/sealed-secrets", + "subdir": "contrib/prometheus-mixin" + }, + { + "name": "thanos", + "source": "https://github.com/thanos-io/thanos", + "subdir": "mixin" + }, + { + "name": "cortex", + "source": "https://github.com/grafana/cortex-jsonnet", + "subdir": "cortex-mixin" + }, + { + "name": "kube-cockroachdb", + "source": "https://github.com/metalmatze/kube-cockroachdb", + "subdir": "monitoring" + }, + { + "name": "coredns", + "source": "https://github.com/povilasv/coredns-mixin", + "subdir": "", + "description": "CoreDNS mixin provides Grafana dashboard and Prometheus Alerts to monitor CoreDNS. The mixin was introduced in [Kubernetes Node Local DNS Cache blogpost](https://povilasv.me/kubernetes-node-local-dns-cache/) to better help users monitor CoreDNS in Kubernetes. Mixin can also be used to monitor standalone CoreDNS instance without any orchestrators.\n" + }, + { + "name": "prometheus-operator", + "source": "https://github.com/prometheus-operator/prometheus-operator", + "subdir": "jsonnet/mixin" + }, + { + "name": "cert-manager", + "source": "https://gitlab.com/uneeq-oss/cert-manager-mixin.git", + "subdir": "" + } + ] +}