mysqld_exporter
mysqld_exporter copied to clipboard
[mysqld-mixin] How do we use it as a library?
Is there a way to properly use the mysqld-mixin/mixin.libsonnet
to import rules and alerts?
For example with prometheus/kube-prometheus
, I was trying to do:
local thanosMixin = import 'thanos-mixin/mixin.libsonnet';
local corednsMixin = import 'coredns-mixin/mixin.libsonnet';
local certManagerMixin = import 'cert-manager-mixin/mixin.libsonnet';
// trying to use mysqld-mixin the same way as others
local mysqldMixin = import 'mysqld-mixin/mixin.libsonnet';
local kp =
(import 'kube-prometheus/kube-prometheus.libsonnet') +
(import 'thanos-mixin/config.libsonnet') +
{
_config+:: {
namespace: 'monitoring',
},
prometheusRules+::
thanosMixin.prometheusRules +
certManagerMixin.prometheusRules +
// trying to use mysqld-mixin the same way as others
mysqldMixin.prometheusRules +
{
// groups+: [],
},
prometheusAlerts+::
thanosMixin.prometheusAlerts +
corednsMixin.prometheusAlerts +
certManagerMixin.prometheusAlerts +
// trying to use mysqld-mixin the same way as others
mysqldMixin.prometheusAlerts +
{
// cat existingrule.yaml | gojsontoyaml -yamltojson > existingrule.json
// groups+: (import 'existingrule.json').groups,
},
}
But I end up with the following error:
+ jsonnet -J vendor -m manifests kube-prometheus.jsonnet
+ xargs '-I{}' sh -c 'cat {} | gojsontoyaml > {}.yaml' -- '{}'
RUNTIME ERROR: only functions can be called, got null
vendor/mysqld-mixin/mixin.libsonnet:9:14-44 object <anonymous>