Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device.
Atlassian cookies and tracking notice, (opens new window)
Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
/
opEvents Dynamically update Events using API or CLI
Updated Dec 11, 2024

    opEvents Dynamically update Events using API or CLI

    opEvents CLI

    opEvents CLI is now able to dynamically update events using the act=set parameter.

    PARAMETERS

    Value

    PARAMETERS

    Value

    act

    set

    event_id

    event id of the given event

    entry.property-name

    value to be updated for the given event property

    CLI command : /usr/local/omk/bin/opevents-cli.pl act=set event_id="672a9b95ad7949330256138a" entry.details="update event details" entry.level=Minor

     

    opEvents API

    opEvents API is now able to dynamically update events using a PATCH request.

    PATCH

    /omk/opEvents/api/v1/events/event_id

    PATCH

    /omk/opEvents/api/v1/events/event_id

    Payload example: { "details" : "updating event details", "level" : "Minor" }


    This will update the Event with the given data.

     

    Successful Response

    HTTP Status

    Body

    Description

    HTTP Status

    Body

    Description

    200 OK

    JSON object with success message.
    {"success":"Event successfully updated"}

    The success property is set to “Event successfully updated” and only if the request was successful.

    Bad Responses

    HTTP Status

    Payload example

    Body

    Description

    HTTP Status

    Payload example

    Body

    Description

    400 Bad Request

    /omk/opEvents/api/v1/events/672a9b95ad794933025xxxx

    JSON object with error message.
    {"error":"Empty input: Please provide the necessary data in the request body.","errorTitle":"Invalid Input"}

    Invalid event id in API

    400 Bad Request

    empty payload

    JSON object with error message.
    {"error":"Empty input: Please provide the necessary data in the request body.","errorTitle":"Invalid Input"}

    The error message is set to "Empty input: Please provide the necessary data in the request body."

    opEvents CLI and API Validations

    The opEvents CLI and API both follow a set of validation rules to maintain data integrity:

    • Allowed Event Properties: There is a predefined set of properties that events can have. Any input that doesn’t match these predefined properties will not be accepted directly.

    • Custom Properties: To add custom properties, they must be prefixed with "tag_". This convention helps the system distinguish custom properties from standard event properties and may prevent naming conflicts or unwanted data.

    • System-Derived Property-Names: The system automatically generates or recognises specific property names that can’t be altered, whether through a Command-Line Interface (CLI) or an API. These names are fixed and define the structure of allowed event properties.

    • Priority Validation: Another validation added on time acknowledged priority
      Time, Acknowledged and Priority must be a number.
      Priority can only be a number between 0-10 decimal

    List of default property names which can not be modified.

    { '_id' => 1, 'actions' => 1, 'planned_outage' => 1, 'node' => 1, 'nodeinfo' => 1, 'host' => 1, 'action_checked' => 1, 'script' => 1, 'node_uuid' => 1 };


    When new property names are added to opCommon.json under opevents/opevents_list_default_properties, they get merged with the default properties, forming a complete set of properties that the system recognises.

    • However, once this merged set is defined, any attempt to modify these properties directly through CLI or API requests will be invalidated.

    /opevents/opevents_list_default_properties : ["details","level","priority"]

     

    Invalid properties example

    { "node" : "xxxxx", "level" : "Minor" }

    HTTP Status

    Body

    Description

    HTTP Status

    Body

    Description

    400 Bad Request

    JSON object with error message.
    {"error":"Failed to update event, not allowed to change the element: node. List of invalid properties: actions|node|action_checked|node_uuid|_id|nodeinfo|script|planned_outage|host"}

    The error message is set and will show the list of invalid properties.

    Community Home

    opEvents
    • Downloads
      Downloads
    Results will update as you type.
    • API
      • opEvents REST API Reference
      • opEvents Dynamically update Events using API or CLI
    • Archive Logging
    • Configuration
    • FAQ
    • Features
    • How-To Guides
    • Introduction & Setup
    • opEvents Create filters for Current Events
    • opEvents Realtime Events
    • Parser Plugins using the opEvents object
    • Release Notes
    • opEvents Event Panels
      Questions
      Calendars

    You‘re viewing this with anonymous access, so some content might be blocked.
    {"serverDuration": 13, "requestCorrelationId": "63d2444e1ba747188d49b3313cc3b99e"}