5.240 Notification Conditions

This section describes behavior of the Notification Conditions object in Moab Web Services. It contains the URLs, request bodies, and responses delivered to and from MWS.

The Notification Conditions API is new with API version 3, and is not available with older API versions. The supported methods table below requires each resource to be accessed with a URL parameter of api-version=3.

For more information, see Requesting Specific API Versions.

The Fields: Notification Conditions reference contains the type and description of all fields in the Notification Conditions object.

Supported methods

Resource GET PUT POST DELETE
/rest/notification-conditions Get All Notification Conditions Update Notification Condition -- --
/rest/notification-conditions/<id> Get Single Notification Condition -- -- --

This topic contains these sections:

5.240.1 Getting Notification Conditions

The HTTP GET method is used to retrieve Notification Condition information.

Quick reference

GET http://localhost:8080/mws/rest/notification-conditions?api-version=3
GET http://localhost:8080/mws/rest/notification-conditions/<id>?api-version=3

5.240.1.A Get All Notification Conditions

URLs and parameters

GET http://localhost:8080/mws/rest/notification-conditions?api-version=3[&query={"escalationLevel":"ADMIN"}][&sort={"observedDate":-1}]
Parameter Required Type Description Example
query No JSON

Query for specific results.

It is possible to query notifications by one or more fields based on MongoDB query syntax.

query={"escalationLevel":"ADMIN"}
sort No JSON Sort the results. Use 1 for ascending and -1 for descending. sort={"observedDate":-1}

See Global URL Parameters for available URL parameters.

Sample response

GET http://localhost:8080/mws/rest/notification-conditions?api-version=3&query={"escalationLevel":"ADMIN"}&sort={"observedDate":-1}
------------------------------------
            
 {
    "totalCount": 2,
    "resultCount": 2,
    "results": [
        {
            "createdDate": "2013-09-10 23:13:33 UTC",
            "details": {
                "pluginType": "NodeUtilizationReport",
                "pluginId": "node-report"
            },
            "escalationLevel": "ADMIN",
            "expirationDate": null,
            "expirationDuration": null,
            "message": "The node 'testnode' has not been updated since the last poll, which is likely due to a misconfiguration.",
            "objectId": "testnode",
            "objectType": "Node",
            "observedDate": "2013-09-10 23:13:33 UTC",
            "origin": "MWS/plugins/NodeUtilizationReport/node-report",
            "tenant": {
                 "id":"1234567890abcdef12345678",
                 "name":"Research"
            },
            "id": "522fa79de4b0cafeaec6f83e"
        },
        {
            "createdDate": "2013-09-11 17:19:35 UTC",
            "details": {
                "pluginType": "VCenter",
                "pluginId": "vcenter42"
            },
            "escalationLevel": "ADMIN",
            "expirationDate": null,
            "expirationDuration": null,
            "message": "The node 'node1' does not have vcenter tools installed, therefore the state is unknown and migrations may not work correctly",
            "objectId": null,
            "objectType": "System",
            "observedDate": "2013-09-11 17:19:35 UTC",
            "origin": "MWS/plugins/VCenter/vcenter42",
            "tenant": {
                 "id":"1234567890abcdef12345678",
                 "name":"Research"
            },
            "id": "5230a627e4b0d51bef490e86"
        }
    ]
}

A notification's tenant is automatically inherited from the objectId and objectType fields. If no object is associated with the notification condition, the notification is visible to all tenants.

5.240.1.B Get Single Notification Condition

URLs and parameters

GET http://localhost:8080/mws/rest/notification-conditions/<id>?api-version=3
Parameter Required Type Description
id Yes String The unique identifier of the object.

See Global URL Parameters for available URL parameters.

Sample response

GET http://localhost:8080/mws/rest/notification-conditions/521a1f18e4b0e3f9031f47f5?api-version=3
------------------------------------

{
    "createdDate": "2013-09-10 23:13:33 UTC",
    "details": {
        "pluginType": "NodeUtilizationReport",
        "pluginId": "node-report"
    },
    "escalationLevel": "ADMIN",
    "expirationDate": null,
    "expirationDuration": null,
    "message": "The node 'testnode' has not been updated since the last poll, which is likely due to a misconfiguration.",
    "objectId": "testnode",
    "objectType": "Node",
    "observedDate": "2013-09-10 23:13:33 UTC",
    "origin": "MWS/plugins/NodeUtilizationReport/node-report",
    "tenant": {
        "id":"1234567890abcdef12345678",
        "name":"Research"
    },
    "id": "522fa79de4b0cafeaec6f83e"
}

A notification's tenant is automatically inherited from the objectId and objectType fields. If no object is associated with the notification condition, the notification is visible to all tenants.

5.240.2 Updating Notification Conditions

The HTTP PUT method is used to update Notification Condition information. The PUT operation is idempotent, meaning that is used for both creating new notification conditions and updating existing ones. If the escalationLevel, origin, message, objectType, and objectId fields match an existing notification condition, it will be updated. Otherwise, a new condition will be created.

Quick reference

PUT http://localhost:8080/mws/rest/notification-conditions?api-version=3

5.240.2.A Update Notification Condition

URLs and parameters

PUT http://localhost:8080/mws/rest/notification-conditions?api-version=3

See Global URL Parameters for available URL parameters.

Request body

The request body below shows some fields that are available when updating a notification condition, along with some sample values.

Sample JSON request body to update a notification condition
------------------------------------

{
    "details": {
        "pluginType": "NodeTester",
        "pluginId": "my-tester1"
    },
    "escalationLevel": "ADMIN",
    "expirationDuration": 30,
    "message": "Node 'node2' is powered off, please check your hardware.",
    "objectId": "node2",
    "objectType": "Node",
    "origin": "NodeTester/my-tester1/Test.groovy:141"
}

Sample response

JSON response
------------------------------------

{
    "createdDate": "2013-09-10 23:13:33 UTC",
    "details": {
        "pluginType": "NodeTester",
        "pluginId": "my-tester1"
    },
    "escalationLevel": "ADMIN",
    "expirationDate": "2013-09-10 23:14:03 UTC",
    "expirationDuration": 30,
    "observedDate": "2013-09-10 23:13:33 UTC",
    "message": "Node 'node2' is powered off, please check your hardware.",
    "objectId": "node2",
    "objectType": "Node",
    "origin": "NodeTester/my-tester1/Test.groovy:141",
    "tenant": {
        "id":"1234567890abcdef12345678",
        "name":"Research"
    },
    "id": "5230a627e4b0d51bef490e86"
}

Related Topics 

© 2016 Adaptive Computing