Skip to content

Commit

Permalink
Merge pull request #283 from jrobersonaquent/add-kube-promethus-support
Browse files Browse the repository at this point in the history
Add Jsonnet mixin for deploying alongside kube-prometheus
  • Loading branch information
Ryan Miller committed Nov 21, 2019
2 parents 2c76f53 + 23cea3d commit 5d4889d
Show file tree
Hide file tree
Showing 2 changed files with 737 additions and 0 deletions.
63 changes: 63 additions & 0 deletions deploy/docs/Kube-Prometheus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# kube-prometheus Mixin

If you are already using kube-prometheus, you can use the Prometheus installation from there and send metrics to Sumo
Logic using a mixin to add the correct remote_write configs and add the `cluster` external_label. An example mixin is
located in this repo at `deploy/kubernetes/kube-prometheus-sumo-logic-mixin.libsonnet.example`. This mixin isn't
guaranteed to have the latest remote write configs so double-check `values.yaml` or `prometheus-overrides.yaml` and
update the mixin as necessary. The defaults assume you're deploying Sumo Logic collection via Helm and using few
customizations. When deploying collection, disable the built-in Prometheus Operator either by using `--set prometheus-operator.enabled=false` or editing `values.yml`:

```yaml
prometheus-operator:
enabled: false
```

## Simple Example

```jsonnet
local kp =
(import 'kube-prometheus/kube-prometheus.libsonnet') +
(import 'kube-prometheus-sumo-logic-mixin.libsonnet') + // import the collection mixin
{
_config+:: {
namespace: 'monitoring',
clusterName: 'CLUSTER NAME HERE', // This value gets assigned the the cluster external_label in Prometheus
},
};
{ ['setup/0namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{
['setup/prometheus-operator-' + name]: kp.prometheusOperator[name]
for name in std.filter((function(name) name != 'serviceMonitor'), std.objectFields(kp.prometheusOperator))
} +
// serviceMonitor is separated so that it can be created after the CRDs are ready
{ 'prometheus-operator-serviceMonitor': kp.prometheusOperator.serviceMonitor } +
{ ['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) } +
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }
```

## Non-default remote write url

If you aren't using the defaults, either by changing the namespace collection is deployed in or changing the service
name, you'll have to do edit `$._config.sumologicCollectorSvc` to point to the correct fluentd service.

```jsonnet
local kp =
(import 'kube-prometheus/kube-prometheus.libsonnet') +
(import 'kube-prometheus-sumo-logic-mixin.libsonnet') + // import the collection mixin
{
_config+:: {
namespace: 'monitoring',
clusterName: 'CLUSTER NAME HERE',
// This should be the FQDN of the fluentd collection service.
sumologicCollectorSvc: 'http://collection-sumologic.sumologic.svc.cluster.local:9888/',
},
};
// ...
```
Loading

0 comments on commit 5d4889d

Please sign in to comment.