Skip to content

Commit 10506bc

Browse files
Merge branch 'feature/cpu_and_system_info' into development
2 parents de7c427 + ea47aef commit 10506bc

3 files changed

Lines changed: 129 additions & 0 deletions

File tree

pyedgeconnect/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,7 @@ def __init__(
13781378
perform_appliance_cli_command,
13791379
perform_appliance_multiple_cli_command,
13801380
)
1381+
from .ecos._cpu import get_appliance_cpu
13811382
from .ecos._deployment import get_appliance_deployment
13821383
from .ecos._disk_usage import get_appliance_disk_usage
13831384
from .ecos._dns import get_appliance_dns_config, set_appliance_dns_config
@@ -1422,6 +1423,7 @@ def __init__(
14221423
get_appliance_stats_minute_file,
14231424
get_appliance_stats_minute_range,
14241425
)
1426+
from .ecos._system_info import get_appliance_system_info
14251427
from .ecos._third_party_tunnel import (
14261428
configure_appliance_multiple_3rdparty_tunnels,
14271429
delete_appliance_multiple_3rdparty_tunnels,

pyedgeconnect/ecos/_cpu.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# MIT License
2+
# (C) Copyright 2022 Hewlett Packard Enterprise Development LP.
3+
#
4+
# cpu : CPU Stat APIs
5+
6+
7+
def get_appliance_cpu(
8+
self,
9+
time: int,
10+
) -> dict:
11+
"""Get the appliance cpu utilization for a particular minute.
12+
13+
.. list-table::
14+
:header-rows: 1
15+
16+
* - Swagger Section
17+
- Method
18+
- Endpoint
19+
* - cpu
20+
- GET
21+
- /cpustat
22+
23+
.. note::
24+
25+
Requires ECOS 9.1+
26+
27+
:param time: Epoch time in milliseconds to query for cpu data
28+
:type time: int
29+
:return: Returns dictionary of appliance deployment information \n
30+
* keyword **data** (`list`): CPU utilization array \n
31+
* [`dict`]: CPU utilization object \n
32+
* keyword **<timestamp>** (`list`): Array of utilization
33+
data for this timestamp for each cpu \n
34+
* [`dict`]: CPU utilization detail \n
35+
* keyword **cpu_number** (`str`): CPU number identifier
36+
* keyword **pIRQ** (`float`): CPU percentage Interrupt
37+
Requests
38+
* keyword **pIdle** (`float`): CPU percentage Idle
39+
* keyword **pNice** (`float`): CPU percentage of NICE
40+
* keyword **pSys** (`float`): CPU percentage System
41+
* keyword **pUser** (`float`): CPU percentage User
42+
* keyword **latestTimestamp** (`int`): Epoch ms from latest
43+
timestamp in returned data
44+
:rtype: dict
45+
"""
46+
return self._get(f"/cpustat?time={time}")

pyedgeconnect/ecos/_system_info.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# MIT License
2+
# (C) Copyright 2022 Hewlett Packard Enterprise Development LP.
3+
#
4+
# systemInfo : System Information
5+
6+
7+
def get_appliance_system_info(
8+
self,
9+
) -> dict:
10+
"""Get system information on the appliance.
11+
12+
.. list-table::
13+
:header-rows: 1
14+
15+
* - Swagger Section
16+
- Method
17+
- Endpoint
18+
* - systemInfo
19+
- GET
20+
- /systemInfo
21+
22+
:return: Returns dictionary of appliance system information \n
23+
* keyword **hostName** (`str`): Appliance hostname
24+
* keyword **applianceid** (`int`): Appliance integer ID
25+
* keyword **model** (`str`): Appliance Model (longform)
26+
* keyword **modelShort** (`str`): Appliance Model (shortform)
27+
* keyword **status** (`str`): Appliance Status
28+
* keyword **uptime** (`int`): Appliance uptime in milliseconds
29+
* keyword **uptimeString** (`str`): Appliance uptime as string,
30+
e.g., ``56d 13h 15m 29s``
31+
* keyword **datetime** (`str`): Current datetime on appliance,
32+
e.g., ``2022/09/28 13:04:47 Etc/UTC``
33+
* keyword **timezone** (`str`): Timezone, e.g., ``Etc/UTC``
34+
* keyword **gmtOffset** (`int`): GMT offset value
35+
* keyword **release** (`str`): Software release with ECOS,
36+
e.g., ``ECOS 9.1.1.3_91760``
37+
* keyword **releaseWithoutPrefix** (`str`): Software release,
38+
numbers only, e.g., ``9.1.1.3_91760``
39+
* keyword **serial** (`str`): Appliance serial number
40+
* keyword **uuid** (`str`): Appliance uuid
41+
* keyword **deploymentMode** (`str`): Appliance deployment mode,
42+
e.g., ``router``
43+
* keyword **inlineRouter** (`bool`): ``True`` if appliance is in
44+
inline-router mode
45+
* keyword **licenseRequired** (`bool`): Legacy license
46+
requirement check
47+
* keyword **isLicenseInstalled** (`bool`): Legacy license
48+
install check
49+
* keyword **licenseExpiryDate** (`str`): Legacy license expire
50+
date
51+
* keyword **licenseExpirationDaysLeft** (`int`): Legacy license
52+
expire days left
53+
* keyword **hasUnsavedChanges** (`bool`): ``True`` if appliance
54+
has unsaved configuration changes
55+
* keyword **rebootRequired** (`bool`): ``True`` if appliance
56+
requires reboot
57+
* keyword **biosVersion** (`str`): BIOS version on appliance
58+
* keyword **alarmSummary** (`dict`): Alarm summary \n
59+
* keyword **num_cleared** (`int`): Number of alarms cleared
60+
* keyword **num_critical** (`int`): Number of critical
61+
alarms
62+
* keyword **num_equipment_outstanding** (`int`): Number of
63+
hardware alarms outstanding
64+
* keyword **num_major** (`int`): Number of major alarms
65+
* keyword **num_minor** (`int`): Number of minor alarms
66+
* keyword **num_outstanding** (`int`): Number of
67+
outstanding alarms
68+
* keyword **num_raise_ignore** (`int`): Number of raise
69+
ignore
70+
* keyword **num_software_outstanding** (`int`): Number of
71+
software alarms outstanding
72+
* keyword **num_tca_outstanding** (`int`): Number of TCA
73+
alarms outstanding
74+
* keyword **num_traffic_class_outstanding** (`int`): Number
75+
of traffic class alarms outstanding
76+
* keyword **num_tunnel_outstanding** (`int`): Number of
77+
tunnel alarms outstanding
78+
* keyword **num_warning** (`int`): Number of warning alarms
79+
:rtype: dict
80+
"""
81+
return self._get("/systemInfo")

0 commit comments

Comments
 (0)