The Cumulocity IoT RSS Microservice

Overview

Cumulocity IoT provides an API that makes it easy to integrate its data with other systems. But this requires programming. Customers want to show the latest data like measurements, events, and alarms in custom Web user interfaces or a portal In these cases a very easy, a plug & play, implementation is required.

RSS, or Really Simple Syndication, is a web feed that allows users and applications to access updates to websites in a standardized, computer-readable format, thereby helps to avoid the conventional methods of browsing or searching for information on websites. Technically, it is a protocol that allows an RSS reader to talk to websites and get updates from them.

In this article, we introduce a microservice that is available as Open-Source that provides an RSS feed for some of the data of Cumulocity IoT. This makes it not only easy to deploy but also easy to integrate, aggregate and display in Web user interface.

Details

The microservice is available on GitHub:

The microservice has no dependencies and follows standard deployment on any Cumulocity IoT tenant. It is a multi-tenant microservice thus it is sufficient to deploy it once on an enterprise or management tenant and share the same instance across multiple standard tenants. The microservice can also be deployed directly on a standard tenant. It provides endpoints for alarms and events. For more details related to usage please refer to the README file. Few sample RSS feed responses are as follows

Sample alarm feed: {{C8YTenantURL}}/service/cumulocity-rss-ms/alarms/rss.xml?source=4368222&severity=MAJOR


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rss version="2.0">
    <channel>
        <title>Cumulocity latest alarm detail</title>
        <link>https://cumulocity.com/</link>
        <description>RSS feed to provide details of the latest Cumulocity alarms</description>
        <language>en</language>
        <copyright>Copyright hold by GCC, Software AG Germany</copyright>
        <pubdate>Sun, 12 Feb 2023 08:00:15 +0000</pubdate>
        <alarm>
            <id>1410208</id>
            <sourceId>1409263</sourceId>
            <sourceName>cumulocity-rss-ms</sourceName>
            <severity>MAJOR</severity>
            <text>Error: ImagePullBackOff</text>
            <type>c8y_Application__Failed</type>
            <status>ACTIVE</status>
            <time>2023-02-12T07:28:34.000Z</time>
            <creationTime>2023-02-12T07:25:09.371Z</creationTime>
        </alarm>
        <alarm>
            <id>1399200</id>
            <sourceId>39273</sourceId>
            <sourceName>Sonoff_Temp_Hmd_Sensor</sourceName>
            <severity>MAJOR</severity>
            <text>Temperature is very high. Please take preventiv action.</text>
            <type>temperature_high</type>
            <status>ACTIVE</status>
            <time>2022-12-22T15:34:08.669Z</time>
            <creationTime>2022-12-22T15:34:08.784Z</creationTime>
        </alarm>
        <alarm>
            <id>9260</id>
            <sourceId>134</sourceId>
            <sourceName>datahub</sourceName>
            <severity>MAJOR</severity>
            <text>Liveness probe failed: Get "http://10.244.30.46:80/isalive": context deadline exceeded (Client.Timeout exceeded while awaiting headers)</text>
            <type>c8y_Application__Unhealthy</type>
            <status>ACTIVE</status>
            <time>2022-11-22T13:54:40.000Z</time>
            <creationTime>2022-08-17T10:28:44.495Z</creationTime>
        </alarm>
        <alarm>
            <id>9216</id>
            <sourceId>134</sourceId>
            <sourceName>datahub</sourceName>
            <severity>MAJOR</severity>
            <text>Node is not ready</text>
            <type>c8y_Application__NodeNotReady</type>
            <status>ACTIVE</status>
            <time>2022-08-17T08:15:34.000Z</time>
            <creationTime>2022-08-17T08:15:35.439Z</creationTime>
        </alarm>
        <alarm>
            <id>6246</id>
            <sourceId>120</sourceId>
            <sourceName>apama-ctrl-1c-4g</sourceName>
            <severity>MAJOR</severity>
            <text>Back-off restarting failed container</text>
            <type>c8y_Application__BackOff</type>
            <status>ACTIVE</status>
            <time>2022-08-17T07:59:03.000Z</time>
            <creationTime>2022-08-17T07:59:58.310Z</creationTime>
        </alarm>
    </channel>
</rss>

Sample event feed: {{C8YTenantURL}}/service/cumulocity-rss-ms/events/rss.xml?feedSize=2

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<rss version="2.0">
    <channel>
        <title>Cumulocity latest event detail</title>
        <link>https://cumulocity.com/</link>
        <description>RSS feed to provide details of the latest Cumulocity events</description>
        <language>en</language>
        <copyright>Copyright hold by GCC, Software AG Germany</copyright>
        <pubdate>Sun, 12 Feb 2023 08:03:46 +0000</pubdate>
        <event>
            <id>1410256</id>
            <sourceId>1409263</sourceId>
            <sourceName>cumulocity-rss-ms</sourceName>
            <text>Deployment was changed</text>
            <type>c8y_Application__DeploymentChange</type>
            <time>2023-02-12T07:29:13.771Z</time>
            <creationTime>2023-02-12T07:29:13.778Z</creationTime>
        </event>
        <event>
            <id>1410255</id>
            <sourceId>1409263</sourceId>
            <sourceName>cumulocity-rss-ms</sourceName>
            <text>Started container cumulocity-rss-ms-scope-t1186848933-pod</text>
            <type>c8y_Application__Started</type>
            <time>2023-02-12T07:29:13.000Z</time>
            <creationTime>2023-02-12T07:29:13.058Z</creationTime>
        </event>
    </channel>
</rss>

Summary

The current support is restricted to alarms and events but can be extended to more (like measurements, operations, etc.) if required. You can contribute to the project by creating a pull request in Git. For any suggestions and support feel free to leave a comment.

4 Likes