Monitoring Operations
An application may need to monitor the status of resources and the occurrence of events. oneM2M provides a mechanism to subscribe to resources and receive notifications when a resources or is child-resources change. An introduction to this mechanism is given in the article What are Notifications in oneM2M?.
In some cases, however, it is necessary to monitor the actual operations that are performed on the resources. This article explains how to monitor request operations on resources in a oneM2M system.
Why Monitor Operations?
Monitoring operations on resources is useful for various reasons. One use case is to keep track of who has accessed or modified a resource. This is important for auditing purposes, security, and performance monitoring, but also for taking action when a resource is accessed or modified by certain originators.
Another use case is to track changes to digital representations of field device, for example, when endpoint configurations for data notifications or data retention policies are modified. Operation monitoring enables easy detection of these changes, ensuring transparency and control over system updates.
Monitoring Operations in oneM2M
Normal subscriptions, in general, monitor whether a resource has changed, or a child resource has been added or removed. Subscriptions for monitoring operations, on the other hand, monitor the request operations that are performed on a resource. This includes request operations such as CREATE
, RETRIEVE
, UPDATE
, and DELETE
. This means that a CSE will send notifications when an operation is performed successfully on a resource.
Figure 1 shows a part of a oneM2M resource tree with a monitored resource that has a normal subscription and an operation-monitoring subscription as child resources.
A subscription for monitoring operations is created by adding the eventNotificationCriteria/operationMonitor attribute in the <subscription> resource that is created for a monitored resource. In this complex attribute the operation attribute specifies a single operation that should be monitored. In addition, an originator can be specified in the originator attribute.
These attributes acts as filters for the operations and the originators that should be monitored. In the eventNotificationCriteria/operationMonitor, both the operation and the originator attributes are optional, but at least one of them must be specified. If one only wants to monitor all operations on a resource performed by a specific originator, the operation attribute can be omitted, but the originator attribute must be specified.
Adding an originator to the operationMonitor attribute is useful when one wants to monitor operations performed by a specific originator. If no originator is specified, the specified operation type on the resource is monitored.
How it Works
When a subscription for monitoring operations is created, the subscriber will receive notifications when the specified operation is performed on the monitored resource. The notification will contain information about the operation that was performed, information about the resource, and the originator that performed the operation.
The details of the notification content and the resource representation depend on the further settings in the <subscription> resource, e.g. in the notificationContentType*.
Summary
Monitoring operations on resources is useful for auditing and application functionality. oneM2M provides a mechanism to monitor operations on resources by creating a subscription with the eventNotificationCriteria/operationMonitor attribute. This attribute specifies the operations and originators that should be monitored. Notifications are sent to the notification target when the specified operation is performed by an originator on the monitored resource.
by Andreas Kraft, 2025-01-07