in internal/pacemaker/pacemakermetrics.go [76:192]
func CollectPacemakerMetrics(ctx context.Context, params Parameters) (float64, map[string]string) {
if params.OSVendorID == "" {
var err error
osData, err := osinfo.ReadData(ctx, osinfo.FileReadCloser(params.ConfigFileReader), osinfo.OSName, osinfo.OSReleaseFilePath)
if err != nil {
log.CtxLogger(ctx).Debugw(fmt.Sprintf("Could not read OS release info from %s", osinfo.OSReleaseFilePath), "error", err)
}
params.OSVendorID = osData.OSVendor
}
// Prune the configurable labels depending on what is defined in the workload config.
pruneLabels := map[string]bool{
"pcmk_delay_base": true,
"pcmk_delay_max": true,
"pcmk_monitor_retries": true,
"pcmk_reboot_timeout": true,
"location_preference_set": true,
"migration_threshold": true,
"resource_stickiness": true,
"saphana_start_timeout": true,
"saphana_stop_timeout": true,
"saphana_promote_timeout": true,
"saphana_demote_timeout": true,
"saphana_primary_monitor_interval": true,
"saphana_primary_monitor_timeout": true,
"saphana_secondary_monitor_interval": true,
"saphana_secondary_monitor_timeout": true,
"fence_agent": true,
"fence_agent_compute_api_access": true,
"fence_agent_logging_api_access": true,
"maintenance_mode_active": true,
"saphanatopology_monitor_interval": true,
"saphanatopology_monitor_timeout": true,
"saphanatopology_start_timeout": true,
"saphanatopology_stop_timeout": true,
"ascs_instance": true,
"ers_instance": true,
"enqueue_server": true,
"ascs_automatic_recover": true,
"ascs_failure_timeout": true,
"ascs_migration_threshold": true,
"ascs_resource_stickiness": true,
"ascs_monitor_interval": true,
"ascs_monitor_timeout": true,
"ensa2_capable": true,
"ers_automatic_recover": true,
"is_ers": true,
"ers_monitor_interval": true,
"ers_monitor_timeout": true,
"op_timeout": true,
"stonith_enabled": true,
"stonith_timeout": true,
"saphana_automated_register": true,
"saphana_duplicate_primary_timeout": true,
"saphana_prefer_site_takeover": true,
"saphana_notify": true,
"saphana_clone_max": true,
"saphana_clone_node_max": true,
"saphana_interleave": true,
"saphanatopology_clone_node_max": true,
"saphanatopology_interleave": true,
"healthcheck_monitor_interval": true,
"healthcheck_monitor_timeout": true,
"ilb_monitor_interval": true,
"ilb_monitor_timeout": true,
"ascs_healthcheck_monitor_interval": true,
"ascs_healthcheck_monitor_timeout": true,
"ascs_ilb_monitor_interval": true,
"ascs_ilb_monitor_timeout": true,
"ers_healthcheck_monitor_interval": true,
"ers_healthcheck_monitor_timeout": true,
"ers_ilb_monitor_interval": true,
"ers_ilb_monitor_timeout": true,
"has_alias_ip": true,
"cluster_healthy": true,
}
pacemaker := params.WorkloadConfig.GetValidationPacemaker()
pconfig := params.WorkloadConfig.GetValidationPacemaker().GetConfigMetrics()
for _, m := range pconfig.GetPrimitiveMetrics() {
delete(pruneLabels, m.GetMetricInfo().GetLabel())
}
for _, m := range pconfig.GetRscLocationMetrics() {
delete(pruneLabels, m.GetMetricInfo().GetLabel())
}
for _, m := range pconfig.GetRscOptionMetrics() {
delete(pruneLabels, m.GetMetricInfo().GetLabel())
}
for _, m := range pconfig.GetHanaOperationMetrics() {
delete(pruneLabels, m.GetMetricInfo().GetLabel())
}
for _, m := range pconfig.GetFenceAgentMetrics() {
delete(pruneLabels, m.GetMetricInfo().GetLabel())
}
for _, m := range pacemaker.GetCibBootstrapOptionMetrics() {
delete(pruneLabels, m.GetMetricInfo().GetLabel())
}
for _, m := range pconfig.GetAscsMetrics() {
delete(pruneLabels, m.GetMetricInfo().GetLabel())
}
for _, m := range pconfig.GetOpOptionMetrics() {
delete(pruneLabels, m.GetMetricInfo().GetLabel())
}
pacemakerVal, labels := collectPacemakerValAndLabels(ctx, params)
for label := range pruneLabels {
delete(labels, label)
}
// Add OS command metrics to the labels.
for _, m := range pacemaker.GetOsCommandMetrics() {
k, v := configurablemetrics.CollectOSCommandMetric(ctx, m, params.Execute, params.OSVendorID)
if k != "" {
labels[k] = v
}
}
return pacemakerVal, labels
}