PTP: Correct wording of collectd alarm when ptp4l instance is stopped

The collectd alarm text that is triggered when a ptp4l instance is
stopped indicates that the fault is due to the timestamping mode,
which is incorrect and potentially confusing for customers.

This text is updated to reflect the actual cause of the alarm.

TEST PLAN:
PASS: Create ptp4l instances and apply
      systemctl stop ptp4l@ptp-inst1
      check alarm to see as corrected text.
      systemctl stop ptp4l@ptp-inst2
      check alarm to see as corrected text.
      start both ptp4l, no alarms.
PASS: Run in hardware timestamping mode in VM
      check alarm

Story: 2011370
Task: 52051

Signed-off-by: Tara Nath Subedi <tara.subedi@windriver.com>
Change-Id: If36ad594846235521e9f00c9aeb3a20c5674a2ee
This commit is contained in:
Tara Subedi 2025-04-24 14:44:50 -04:00
parent 5b258533ed
commit 360092e63c

View File

@ -861,8 +861,13 @@ def raise_alarm(alarm_cause,
return True
elif alarm_cause == ALARM_CAUSE__PROCESS:
reason = 'Provisioned ' + PTP + ' \'' + obj.mode
reason += '\' time stamping mode seems to be unsupported by this host'
reason += f"PTP service {data} enabled but not running"
alarm.repair += (
f"enable service with: systemctl start {data}. "
"If it still persists: Check host hardware reference manual "
f"to verify the provisioned {PTP} '{obj.mode}' time stamping "
"mode is supported by this host."
)
elif alarm_cause in [ALARM_CAUSE__1PPS_SIGNAL_LOSS,
ALARM_CAUSE__GNSS_SIGNAL_LOSS]:
@ -932,10 +937,8 @@ def create_interface_alarm_objects(interface, instance=None, instance_type=PTP_I
o = PTP_alarm_object(instance)
o.alarm = ALARM_CAUSE__PROCESS
o.severity = fm_constants.FM_ALARM_SEVERITY_MAJOR
o.reason = obj.hostname + ' does not support the provisioned '
o.reason += PTP + ' mode '
o.repair = 'Check host hardware reference manual '
o.repair += 'to verify that the selected PTP mode is supported'
o.reason = obj.hostname + ' '
o.repair = obj.hostname + ' '
o.eid = obj.base_eid + '.instance=' + instance + '.ptp'
o.cause = fm_constants.ALARM_PROBABLE_CAUSE_UNKNOWN # 'unknown'
ALARM_OBJ_LIST.append(o)
@ -2309,7 +2312,7 @@ def read_func():
if ctrl.process_alarm_object.raised is False:
collectd.error("%s PTP service %s enabled but not running" %
(PLUGIN, ptp_service))
if raise_alarm(ALARM_CAUSE__PROCESS, instance_name) is True:
if raise_alarm(ALARM_CAUSE__PROCESS, instance_name, data=ptp_service) is True:
ctrl.process_alarm_object.raised = True
# clear all other alarms if the 'process' alarm is raised