30 monitoring vm
# Monitoring VM consumption
Contexte#
When the client uses the VM monitoring functionality to monitor his VMs, endpoints/services/servicemonitors are deployed in the caascad-monitoring-vm namespace in the client cluster.
We can use the up {cc_vm_source! =" "} metric to bill the customer for the functionality.
It is a metric that we will recover in the infra-consumption zone via the federation.
Architecture#
Federation cloud-client -> client#
We do a federation between cloud-client and client cluster to get the metric up{cc_vm_source!=""}.
During this federation, we retrieve the metric whatever its value: up=0 or up=1.
During federation, the metric is renamed to up_cc_vm_source_filter (This is to avoid having the TargetDown alert when an up=0 metric is federated)
Federation infra-consumption -> cloud-client#
We do a federation between infra-consumption and cloud-client to retrieve the up_cc_vm_source_filter metric.
Deployment of the recordingrule on infra-consumption using the metric previously retrieved with the federation (up_cc_vm_source_filter)#
We deploy the recordingrule on infra-consumption:
- expr: (count without(instance, pod, node) (up_cc_vm_source_filter == 1))
record: count:up1:cc_vm_source_filter
The count: up1: cc_vm_source_filter metric is used for billing. We only want to bill if the targets are up.
Example of metric in infra-consumption:
count:up1:cc_vm_source_filter{cc_client="infra-stg", cc_consumption_client="ocb-test06", cc_prom="infra-consumption", cc_prom_source="delta", cc_vm_source="vm-windows", endpoint="metrics", job="caascad-windows-exporter", namespace="caascad-monitoring-vm", prometheus="monitoring-consumption/consumption-prometheus", service="caascad-windows-exporter", updateDate="2021-08-18"}
Supervision#
We want to monitor that the count: up1: cc_vm_source_filter metric is present when the VM monitoring functionality is used by the client and that it has a correct value.
We create several alerts for that:
- an alert to check that we have the
up_cc_vm_source_filtermetric when there is at least one service in thecaascad-monitoring-vmnamespace - an alert to check that if we have at least one
up_cc_vm_source_filter == 1metric, the recording rulecount: up1: cc_vm_source_filteris present (allows you to check that the recording rule has been deployed or not deleted) - an alert to check that the
count: up1: cc_vm_source_filtermetric is equal to 1.