Update c8y_ActiveAlarmsStatus via API

Product/components used and version/fix level:

Cumulocity IoT

Detailed explanation of the problem:

I accidentallly deleted some alarms a while back. As a result, the inventory fragment c8y_ActiveAlarmsStatus does not correctly reflect the real number of alarms. When I try to update it via the API, it has no effect - as if the fragment itself is protected. Curl looks like this

curl --location --request PUT ‘…/inventory/managedObjects/XXXXXXXXXXXXXX’
–header ‘Authorization: Basic XXXXXXXXXXXXXXXXXX’
–header ‘Content-Type: application/json’
–header ‘Accept: application/json’
–data ‘{
“c8y_ActiveAlarmsStatus”: {
“critical”: 0,
“minor”: 0,
“major”: 0,
“warning”: 0
}
}’

Response is 200 but the status still shows
“c8y_ActiveAlarmsStatus”: {
“minor”: 1,
“critical”: 3,
“major”: 0,
“warning”: 1
},

If I change the request to

curl --location --request PUT ‘…/inventory/managedObjects/XXXXXXXXXXXXXX’
–header ‘Authorization: Basic XXXXXXXXXXXXXXXXXX’
–header ‘Content-Type: application/json’
–header ‘Accept: application/json’
–data ‘{
“c8y_ActiveAlarmsPeanuts”: {
“critical”: 0,
“minor”: 0,
“major”: 0,
“warning”: 0
}
}’

It works fine. And I can update it with any values a like. Any ideas…?

Error messages / full error message screenshot / log file:

Question related to a free trial, or to a production (customer) instance?

I think it’s an calculated fragment that is overwritten by some logic in the background.

The only way you can change the stats there is using Alarm API and clearing alarms. If you don’t have an alarm anymore try to create a new dummy alarm and clear it. Hopefully this triggers the recalcuation of the c8y_ActiveAlarmStatus fragment in the background and stats are correct afterwards.

Thanks Stefan,
On my test device I have cleared all alarms, but the inventory shows:
“c8y_ActiveAlarmsStatus”: {
“minor”: 3,
“critical”: 3,
“major”: 1,
“warning”: 0
},

If I use the API to set a dummy minor alarm, the new status looks like

"c8y_ActiveAlarmsStatus": {
    "minor": 4,
    "critical": 3,
    "major": 1,
    "warning": 0
},

Then I use the API to clear the dummy alarm and I am back to square one

“c8y_ActiveAlarmsStatus”: {
“minor”: 3,
“critical”: 3,
“major”: 1,
“warning”: 0
},

I need them all to read zero.

I see, so unfortunately it seems only a delta is calculated but no full recalculation is done when clearing a alarm.
It sounds like a bug to me, that if alarms are deleted (before cleared) the activeAlarmsStatus is not re-calculated properly.

Would be able to report a product issue so support can further investigate?

Thanks Stefan. How do I report a product issue?