rpi.carlosedp.cluster-monit.../modules/ups_exporter.jsonnet

37 lines
1.1 KiB
Plaintext
Raw Normal View History

2020-05-26 01:23:56 +02:00
local utils = import '../utils.libsonnet';
2019-08-08 22:09:53 +02:00
local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
2019-02-27 13:25:44 +01:00
{
_config+:: {
namespace: 'monitoring',
ups: {
ips: ['192.168.1.62'],
},
// Add custom dashboards
grafanaDashboards+:: {
'apc-ups-dashboard.json': (import 'grafana-dashboards/apc-ups-dashboard.json'),
},
},
2019-03-13 22:44:01 +01:00
upsExporter+:: {
serviceMonitor:
2020-03-18 22:01:01 +01:00
utils.newServiceMonitor('ups-exporter', $._config.namespace, { 'k8s-app': 'ups-exporter' }, $._config.namespace, 'metrics', 'http'),
2019-02-27 13:25:44 +01:00
service:
local service = k.core.v1.service;
local servicePort = k.core.v1.service.mixin.spec.portsType;
local upsExporterPort = servicePort.newNamed('metrics', 9099, 9099);
service.new('ups-exporter', null, upsExporterPort) +
service.mixin.metadata.withNamespace($._config.namespace) +
service.mixin.metadata.withLabels({ 'k8s-app': 'ups-exporter' }) +
service.mixin.spec.withClusterIp('None'),
endpoints:
2019-09-27 00:02:33 +02:00
utils.newEndpoint('ups-exporter', $._config.namespace, $._config.ups.ips, 'metrics', 9099),
2019-02-27 13:25:44 +01:00
},
2019-03-13 22:44:01 +01:00
}