NEO Events

File Name

neo_events.py

Description

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

  • 'get' – get an existing event

  • 'getall' – get all events

  • 'getforsys' – get all events for a specific list of systems

Usage

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

-o {get- forsys,getall,get} [-t PARAMETERS]

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,getforsys}

Script operations

-t PARAMETERS

URL parameters. Valid formats:

  • attrib1=value1&attrib2=value2

  • attrib=[value1,value2]

Required Arguments

Parameters

'event_id' – event ID of an existing event

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_events.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o get -t "event_id=97e77092f8c247a26cd37f9398ff3d1e_1674" ====================================================================== <<< NEO - Getting event data SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting event data stages: -1- Setting Up data... -2- Sending Getting event data request... ====================================================================== [*] Getting event data results: >> Getting event data request HTTP response status code: 200 >> Getting event data request HTTP response text: { "Category": "Application", "Event Name": "Job Completed", "Severity": "Info", "Parent": "10.209.37.30", "Timestamp": "2016-04-12 00:01:01", "Acknowledged": false, "Source": "Task Execution", "Reason": "Job was completed successfully", "Sub Category": "Jobs", "RelatedJob": "12.26", "ID": "97e77092f8c247a26cd37f9398ff3d1e_1674", "Description": "Provisioning completed" } ======================================================================

'getall'

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_events.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getall ====================================================================== <<< NEO - Getting all events data SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting all events data stages: -1- Setting Up data... -2- Sending Getting all events data request... ====================================================================== [*] Getting all events data results: >> Getting all events data request HTTP response status code: 200 >> Getting all events data request HTTP response text: [ { "Category": "Application", "Event Name": "Job Completed", "Severity": "Info", "Parent": "10.209.37.30", "Timestamp": "2016-04-12 00:01:01", "Acknowledged": false, "Source": "Task Execution", "Reason": "Job was completed successfully", "Sub Category": "Jobs", "RelatedJob": "12.26", "ID": "97e77092f8c247a26cd37f9398ff3d1e_1674", "Description": "Provisioning completed" }, { "Category": "Application", "Event Name": "Job Completed", "Severity": "Info", "Parent": "10.209.37.8", "Timestamp": "2016-04-12 00:01:01", "Acknowledged": false, "Source": "Task Execution", "Reason": "Job was completed successfully", "Sub Category": "Jobs", "RelatedJob": "12.20", "ID": "97e77092f8c247a26cd37f9398ff3d1e_1675", "Description": "Provisioning completed" }, . . . ] ======================================================================


'getforsys'

Required Arguments

Parameters

'system_id' – system IP of existing systems

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_events.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o get- forsys -t "system_id=10.209.37.30" ====================================================================== <<< NEO - Getting events for systems SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting events for systems stages: -1- Setting Up data... -2- Sending Getting events for systems request... ====================================================================== [*] Getting events for systems results: >> Getting events for systems request HTTP response status code: 200 >> Getting events for systems request HTTP response text: [ { "Category": "Application", "Event Name": "Job Completed", "Severity": "Info", "Parent": "10.209.37.30", "Timestamp": "2016-04-12 00:01:01", "Acknowledged": false, "Source": "Task Execution", "Reason": "Job was completed successfully", "Sub Category": "Jobs", "RelatedJob": "12.26", "ID": "97e77092f8c247a26cd37f9398ff3d1e_1674", "Description": "Provisioning completed" }, { "Category": "Application", "Event Name": "Link Removed", "Severity": "Info", "Parent": "10.209.37.30", "Timestamp": "2016-04-13 11:09:28", "Acknowledged": false, "Source": "Ethernet Discovery", "Reason": "Link 10.209.37.30-10.209.37.30.network_port.eth1.8 to 10.209.36.108- 10.209.36.108.network_port.eth2 no longer detected by the Ethernet Discovery provider.", "Sub Category": "General", "RelatedJob": "", "ID": "97e77092f8c247a26cd37f9398ff3d1e_6398", "Description": "Link removed" }, . . . ] ======================================================================


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