Webhook JSON data
The sample code in the following example is used to create a webhook server that truncates the information, which is posted by the mmhealth command. The structure of the posted JSON data helps you to parse the data to get the information, which is needed to take further actions.
The posted data is in JSON format and contains information on the reporting node name that sends health events with event-specific details. For more information, see Events section.
The JSON data for the POST event is defined as:
version: string reportingController: string reportingInstance: string events:
array
Each entry in the events array is defined as:
cause: string
code: string
component: string
container_restart: boolean
container_unready: boolean
description: string
entity_name: string
entity_type: string
event: string
event_type: string
ftdc_scope: string
identifier: string
internalComponent: string
is_resolvable: boolean
message: string
node: string
priority: integer
remedy: string
requireUnique: boolean
scope: string
severity: string
state: string
time: DateTime
TZONE: string
user_action: string
The following example shows what the JSON data might contain when the mmhealth command posts to the configured webhook.
{
"version": "1",
"reportingController": "spectrum-scale",
"reportingInstance": "frodo-master.fyre.ibm.com",
"events": [
{
"cause": "A threshold rule was added.",
"code": "999897",
"component": "threshold",
"container_restart": false,
"container_unready": false,
"description": "A threshold rule was added.",
"entity_name": "None",
"entity_type": "THRESHOLD_RULE",
"event": "thresholds_new_rule",
"event_type": "INFO_ADD_ENTITY",
"ftdc_scope": "",
"identifier": "MemFree_Rule",
"internalComponent": "",
"is_resolvable": false,
"message": "Rule MemFree_Rule was added.",
"node": "4",
"priority": 99,
"remedy": null,
"requireUnique": true,
"scope": "NODE",
"severity": "INFO",
"state": "UNKNOWN",
"time": "2022-02-03T10:29:48-08:00",
"TZONE": "PST",
"user_action": "N/A"
}
]
}