NEO Events Policy

File Name

neo_events_policy.py

Description

This SDK manipulates NEO events policy data using NEO's REST API. The script includes the following main operations:

  • 'get' – get an existing event policy

  • 'getall' – get all events policies

  • 'update' – update an existing event policy

Usage

neo_events_policy.py [-h] -s SERVER -u USERNAME -p PASSWORD [-r {http,https}] --port {80,443,3080,3443}

-o {getall,update,get} [-t PARAMETERS] [-f FILE]

Arguments

-h

Displays the help menu

-s SERVER

NEO server IP

-u USERNAME

NEO username

-p PASSWORD

NEO password

--port

The port used to communicate with NEO.

If NEO is run on a physical machine:

  • Port 80 is used for HTTP

  • Port 443 is used for HTTPS

If NEO run on a docker container:

  • Port 3080 is used for HTTP

  • Port 3443 is used for HTTPS

-r {http,https}

Connection protocol to NEO

-o {get,getall,update}

Script operations

-t PARAMETERS

URL parameters. Valid formats:

  • attrib1=value1&attrib2=value2

  • attrib=[value1,value2]

-f FILE

A file in json format containing the payload of the request.

'get'

Required Arguments

Parameters

'events_policy' – event policy ID of an existing policy

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_events_policy.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o get -t "event_policy_id=event_policy_port_out_errors" ====================================================================== <<< NEO - Getting events policies data SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting events policies data stages: -1- Setting Up data... -2- Sending Getting events policies data request... ====================================================================== [*] Getting events policies data results: >> Getting events policies data request HTTP response status code: 200 >> Getting events policies data request HTTP response text: { "Category": "Device", "SubCategory": "Networking", "ActiveConditions": 3, "InstanceID": "event_policy_port_out_errors", "EventType": "Port Out Errors", "Conditions": [ { "Task": null, "Severity": "Warning", "InstanceID": "event_condition_out_errors_between_5_10", "Overrides": null, "Value": "5-10", "Filter": null, "Operator": "between", "Trigger": "Out Errors", "Mail": null, "OverriddenBy": null, "Attribute": "Out Errors", "ValueType": "str", "Editable": true, "Active": true, "Message": "OutErrors counter rate threshold exceeded.", "MellanoxCare": false }, . . . ] } ======================================================================


'getall'

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_events_policy.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getall ====================================================================== <<< NEO - Getting all events policies data SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting all events policies data stages: -1- Setting Up data... -2- Sending Getting all events policies data request... ====================================================================== [*] Getting all events policies data results: >> Getting all events policies data request HTTP response status code: 200 >> Getting all events policies data request HTTP response text: [ { "Category": "Device", "SubCategory": "Networking", "ActiveConditions": 3, "InstanceID": "event_policy_port_out_errors", "EventType": "Port Out Errors", "Conditions": [ { "Task": null, "Severity": "Warning", "InstanceID": "event_condition_out_errors_between_5_10", "Overrides": null, "Value": "5-10", "Filter": null, "Operator": "between", "Trigger": "Out Errors", "Mail": null, "OverriddenBy": null, "Attribute": "Out Errors", "ValueType": "str", "Editable": true, "Active": true, "Message": "OutErrors counter rate threshold exceeded.", "MellanoxCare": false }, ] . . . }, ======================================================================


'update'

Required Arguments

File Name

For the 'update' operation, you need to supply a file containing the payload of the request.

For example:

{

"Conditions": [{

"InstanceID": "event_condition_cpu_util_high",

                     "Severity": "Warning",

"Message": "The NVIDIA Onyx management appliance CPU is very busy",

                    "Active": true

}]

}

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_events_policy.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o update -t "event_policy_id=event_policy_high_cpu_utilization" -f event_policy_example ====================================================================== <<< NEO - Updating event policy SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Updating event policy stages: -1- Setting Up data... -2- Sending Updating event policy request... ====================================================================== [*] Updating event policy results: >> Updating event policy request HTTP response status code: 200 ======================================================================


© Copyright 2023, NVIDIA. Last updated on Nov 16, 2023.