{"type":"api","title":"Create a new custom KPI","meta":{"id":"/apps/pubhub/media/crosswork-network-controller-7-1/f445c17e25a1120e8fbde4bd413083d0fd88b2b3/280afeb1-5ea4-33e3-8618-f92d3ecedf8f","info":{"contact":{"email":"support@cisco.com","name":"Crosswork Team, Cisco"},"description":"Health Insights(HI) is a software system that provides smart KPI monitoring and remediation for service provider networks. This document contains details of the HI RESTful APIs that can be used to manage KPIs, enable/disable KPIs on groups or devices, query KPIs and device alerts, remediate alerting KPIs etc.","license":{"name":"Cisco Software License Agreement","url":"https://www.cisco.com/public/sw-license-agreement.html"},"title":"Crosswork Health Insights API","version":"7.1.0"},"security":[{"bearerAuth":[]}],"x-parser-conf":{"overview":{"markdownPath":"reference/CAHI/health_insights_overview.md"}},"openapi":"3.0.1","servers":[{"url":"https://{server_ip}:30603/crosswork/hi/v1","description":"Generated server url"}],"securitySchemes":{"bearerAuth":{"description":"token","in":"header","name":"Authorization","type":"apiKey"}}},"spec":{"operationId":"KpiWrite","requestBody":{"content":{"application/json":{"schema":{"description":"Description for kpis_post","properties":{"kpiPost":{"description":"Contains A set of KPI definitions","properties":{"kpis":{"description":"kpis","properties":{"kpi":{"description":"kpi","items":{"example":{"category":"User Created","dashboards":{"dashboard":[{"body":{"dashboard":{"annotations":{"enable":false,"list":null},"editable":true,"refresh":"","rows":null,"style":"","tags":null,"templating":{"list":null},"time":{"from":"","now":false,"to":""},"timezone":"","title":"Wizard_Test_Cpu_Utilizatione336023b_5efada29e05d","version":0}}}]},"details":"Monitor CPU usage across RP and Linecards on Routers. Alert will be generated when CPU utilization exceeds thresholds","kpi_id":"wizard_test_cpu_utilization","kpi_name":"Wizard Test Cpu Utilization","scripts":{"script":[{"script":"script_content","script_id":"Wizard_Test_Cpu_Utilizatione336023b_5efada29e05d_template.json","template":"template_name"}]},"sensor_groups":{"sensor_group":[{"cadence":{"default":5,"increment":1,"max":30,"min":1},"sensor_paths":{"sensor_path":[{"path_id":"Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization/total-cpu-five-minute"}]}}]},"state":"complete","summary":"Monitor CPU usage across RP and Linecards on Routers"},"properties":{"category":{"description":"KPI category. A maximum length of 64 characters.","type":"string"},"dashboards":{"description":"dashboards","properties":{"dashboard":{"description":"dashboard","items":{"description":"Description for define_dashboard","properties":{"body":{"description":"Grafana dashboard definition in JSON format.","properties":{},"type":"array"}},"type":"object","$$ref":"#/components/schemas/define_dashboard"},"type":"array"}},"type":"object"},"details":{"description":"A detailed description of the KPI. A maximum length of 1024 characters.","type":"string"},"kpi_id":{"description":"KPI identifier. A maximum length of 64 characters. Upper or lowercase characters, underscores and numbers. Must not contain \"cisco\" and \"pulse\" prefixes.","type":"string"},"kpi_name":{"description":"KPI display name. A maximum length of 64 characters.","type":"string"},"scripts":{"description":"scripts","properties":{"script":{"description":"script","items":{"description":"Description for define_script","properties":{"script":{"description":"SubServiceClass JSON script.","type":"array"},"script_id":{"description":"Script identifier. A maximum length of 64 characters. Upper or lowercase characters, underscores and numbers. Must not contain \"cisco\" and \"pulse\" prefixes. Must contain suffix \"template\" for template based script and must not contain suffix \"template\" for non-template based script.","type":"array"}},"type":"object","$$ref":"#/components/schemas/define_script"},"type":"array"}},"type":"object"},"sensor_groups":{"description":"sensor_groups","properties":{"sensor_group":{"description":"Support only one sensor group.","items":{"description":"Description for define_sensor_group","properties":{"cadence":{"description":"cadence","example":{"default":5,"increment":1,"max":30,"min":1},"properties":{"default":{"$ref":"#/components/schemas/cadence","description":"default","type":"array"},"increment":{"description":"Increment between cadences to use. If 0, can be ignored.","type":"array"},"max":{"description":"Maximum cadence for telemetry. Expect to always be defined.","type":"array"},"min":{"description":"Minimum cadence, expect to always be defined.","type":"array"}},"required":["default","max","min"],"type":"array","$$ref":"#/components/schemas/cadence"},"sensor_paths":{"description":"sensor_paths","properties":{"sensor_path":{"description":"sensor_path","items":{"properties":{"path_id":{"description":"Path identifier.","type":"string"}},"type":"object"},"type":"array"}},"type":"array"}},"type":"object","$$ref":"#/components/schemas/define_sensor_group"},"type":"array"}},"type":"object"},"state":{"description":"KPI state. Values of 'pending' and 'complete'. To set to state 'complete', all fields must be specified. Only in state 'complete' that the KPI can be associated to a device.","type":"string"},"summary":{"description":"A brief one-liner description of the KPI. A maximum length of 256 characters.","type":"string"}},"type":"object"},"type":"array"}},"type":"object"}},"type":"array"}},"type":"object","$$ref":"#/components/schemas/kpis_post"}}},"description":"A set of KPIs definition.","required":true},"responses":{"201":{"content":{"application/json":{"schema":{"description":"Description for kpis_patch","properties":{"kpiPatch":{"description":"Contains set of user defined KPIs to be partially patched","properties":{"kpi":{"description":"kpi","items":{"example":{"dashboards":{"dashboard":[{"body":{"dashboard":{"annotations":{"enable":true,"list":null},"editable":true,"refresh":"","rows":null,"style":"","tags":null,"templating":{"list":null},"time":{"from":"","now":false,"to":""},"timezone":"","title":"Test_Cpu_Utilization","version":0}}}]},"details":"Patch Monitor CPU usage across RP and Linecards on Routers. Alert will be generated when CPU utilization exceeds thresholds","kpi_id":"wizard_test_cpu_utilization","kpi_name":"CPU threshold Patch","sensor_groups":{"sensor_group":[{"cadence":{"default":5,"increment":1,"max":30,"min":1},"sensor_paths":{"sensor_path":[{"path_id":"Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization/total-cpu-one-minute"},{"path_id":"Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization/total-cpu-five-minute"},{"path_id":"Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization/total-cpu-fifteen-minute"},{"path_id":"Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization/process-cpu/process-cpu-one-minute"},{"path_id":"Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization/process-cpu/process-cpu-five-minute"},{"path_id":"Cisco-IOS-XR-wdsysmon-fd-oper:system-monitoring/cpu-utilization/process-cpu/process-cpu-fifteen-minute"}]}}]},"summary":"Monitor CPU usage across RP and Linecards on Routers test patch"},"properties":{"category":{"description":"KPI category. A maximum length of 64 characters.","type":"string"},"dashboards":{"description":"dashboards","properties":{"dashboard":{"description":"dashboard","items":{"description":"Description for define_dashboard","properties":{"body":{"description":"Grafana dashboard definition in JSON format.","properties":{},"type":"array"}},"type":"object","$$ref":"#/components/schemas/define_dashboard"},"type":"array"}},"type":"object"},"details":{"description":"A detailed description of the KPI. A maximum length of 1024 characters.","type":"string"},"kpi_id":{"description":"KPI identifier. A maximum length of 64 characters. Upper or lowercase characters, underscores and numbers. Must not contain \"cisco\" and \"pulse\" prefixes.","type":"string"},"kpi_name":{"description":"KPI display name. A maximum length of 64 characters.","type":"string"},"scripts":{"description":"scripts","properties":{"script":{"description":"script","items":{"description":"Description for define_script","properties":{"script":{"description":"SubServiceClass JSON script.","type":"array"},"script_id":{"description":"Script identifier. A maximum length of 64 characters. Upper or lowercase characters, underscores and numbers. Must not contain \"cisco\" and \"pulse\" prefixes. Must contain suffix \"template\" for template based script and must not contain suffix \"template\" for non-template based script.","type":"array"}},"type":"object","$$ref":"#/components/schemas/define_script"},"type":"array"}},"type":"object"},"sensor_groups":{"description":"sensor_groups","properties":{"sensor_group":{"description":"Support only one sensor group.","items":{"description":"Description for define_sensor_group","properties":{"cadence":{"description":"cadence","example":{"default":5,"increment":1,"max":30,"min":1},"properties":{"default":{"$ref":"#/components/schemas/cadence","description":"default","type":"array"},"increment":{"description":"Increment between cadences to use. If 0, can be ignored.","type":"array"},"max":{"description":"Maximum cadence for telemetry. Expect to always be defined.","type":"array"},"min":{"description":"Minimum cadence, expect to always be defined.","type":"array"}},"required":["default","max","min"],"type":"array","$$ref":"#/components/schemas/cadence"},"sensor_paths":{"description":"sensor_paths","properties":{"sensor_path":{"description":"sensor_path","items":{"properties":{"path_id":{"description":"Path identifier.","type":"string"}},"type":"object"},"type":"array"}},"type":"array"}},"type":"object","$$ref":"#/components/schemas/define_sensor_group"},"type":"array"}},"type":"object"},"state":{"description":"KPI state. Values of 'pending' and 'complete'. To set to state 'complete', all fields must be specified. Only in state 'complete' that the KPI can be associated to a device.","type":"string"},"summary":{"description":"A brief one-liner description of the KPI. A maximum length of 256 characters.","type":"string"}},"type":"object"},"type":"array"}},"type":"array"}},"type":"object","$$ref":"#/components/schemas/kpis_patch"}}},"description":"Created: Success, no response message-body."},"400":{"content":{},"description":"Bad Request"},"409":{"content":{},"description":"Conflict."},"500":{"content":{"application/json":{"schema":{"description":"Description for error","example":"Internal Server Error","type":"string","$$ref":"#/components/schemas/error"}}},"description":"Internal Server Error"}},"summary":"Create a new custom KPI.","tags":["KPI Management"],"x-codegen-request-body-name":"body","__originalOperationId":"KpiWrite","security":[{"bearerAuth":[]}],"method":"post","path":"/kpimgmt/write"}}