This module contains functionality for reading "System overview" data from the PacketLogic system.
Do NOT import this module directly. The PLConnection object should be used, e.g:
>>> import packetlogic2 >>> pl = packetlogic2.connect("192.168.1.25", "admin", "password") >>> so = pl.SystemOverview()
Information about a System in the SystemOverview.
Returned in a list by SystemOverview.system_list.
Class Variables: | |
---|---|
__slots__ | For internal use only. |
Properties: | |
---|---|
configmd5 | Config md5sum |
distversion | Version of distribution/firmware |
drdlrevision | DRDL Revision |
firstupdate | ISO Date/time when first updated |
host | Host name or IP address |
lastupdate | ISO Date/time when last updated |
name | Name given to identify this system |
systemid | SystemID (MachineID) |
values | Read-only list of two-item tuple values |
Config md5sum.
Version of distribution/firmware.
DRDL Revision.
ISO Date/time when first updated.
Host name or IP address.
ISO Date/time when last updated.
Name given to identify this system.
SystemID (MachineID).
Read-only list
of two-item tuple
values.
This is the resource for System Overview.
Methods: | ||
---|---|---|
Ungrouped | sysinfo_get(self, systemid) Get the sysinfo tree reported for specified system |
|
sysinfo_systems_list(self) Return systems having reported sysinfo data |
||
system_graph(self, templateid, systemid=None) Return a list of graph data for the specified system |
||
system_list(self) Return systems defined in systems overview |
||
template_list(self) Return templates used by systems overview |
||
Inherited from Resource | close(self) Immediately disconnects the resource |
|
commit(self, message='PythonAPI commit') Store the current transaction to the database |
||
ping(self, string='') Send a command to server to test if it is up |
||
tuple of (str , int )
|
protocol(self, protocol, strict=False) Translate protocol name OR number to tuple with name AND number |
|
dict of str :int and
int :str
|
protocols_dict(self) Returns a dictionary with name:nr and nr:name items for IP protocols |
|
rollback(self) Abort the current transaction and discard the data |
||
services_cmd(self, services=[], props=[]) Send services to pldbd |
||
list of str
|
services_list(self) List all services |
|
list of str
|
services_prop_list(self) List all properties |
|
wait_for_commit(self, pinginterval=60) Wait for new data to be committed on resource |
||
list of str
|
xfb_flags_list(self) List all XFB (Transfer Behaviour) flags, that can be used in FlagObjects |
Class Variables: | |
---|---|
TYPE_STRING | Type of the value is a string. |
TYPE_INT | Type of the value is an integer. |
TYPE_RATE | Type of the value is an integer representing a rate (per second). |
TYPE_BANDWIDTH | Type of the value is an integer representing bandwidth (bps) |
TYPE_TRANSFER | Type of the value is an integer representing bytes transfered. |
TYPE_DURATION | Type of the value is a time duration. |
TYPE_TIMESTAMP | Type of the value is a timestamp. |
TYPE_BITMASK | Type of the value is an integer representing a bitmask. |
TYPE_INT_K | Type of the value is an integer measuring thousands. |
VTYPE_TOTAL | Value is a total since system restart. |
VTYPE_RATE | Value is a speed or rate. |
VTYPE_MAX | Value is the maximum reached since system restart. |
TEMPLATE_TYPE_SYSDIAG | Value is from System Diagnostics. |
TEMPLATE_TYPE_CHANNEL | Value is from Channel Statistics. |
SYSDIAG_ZONE_ | All Stats Zones enumerated. |
Properties: | |
---|---|
TEMPLATE_TYPE_STATS | Deprecated alias for TEMPLATE_TYPE_SYSDIAG |
commitid | The CommitID associated with this session |
Immediately disconnects the resource.
After this method has been called this object becomes useless.
It may be used to force a disconnect when the garbage collector can't be trusted to do a timely disconnect.
Store the current transaction to the database.
When you do this PacketLogic will reload the ruleset. This will take a lot of CPU resources from the system, try to do this in batches.
Observe that if you don't commit the changes you've made, no other resource (including the client) will see your changes.
str
) - Message recorded in the commit log. Ignored in v12.1 and earlier.
Send a command to server to test if it is up.
Translate protocol name OR number to tuple with name AND number. Can be used to e.g translate numerical protocol in connlog.search() result to protocol name.
An unknown protocol will be translated to e.g '#7' or -1, unless strict is set to True, in which case ValueError is raised for unknown protocols.
tuple
of (str
, int
)
int
, str
or a ProtocolObject
Item) - Name or number of an IP protocol
bool
) - If True
, ValueError is raised for an unknown protocol, if
False
(default), an unknown protocol translates to number -1
or name '#7' (where 7 is the supplied unknown protocol number).
Returns a dictionary with name:nr and nr:name items for IP protocols. Can be used to e.g translate numerical protocol in connlog.search() result to protocol name.
dict
of str
:int
and
int
:str
Abort the current transaction and discard the data.
This will also automatically happen if your connection drops or that you exit the program without commit.
Send services to pldbd
Sets stringtable for services and properties. Do NOT use this unless you know exactly what you are doing.
list
of str
) - List of services
list
of str
) - List of service properties
Get the sysinfo tree reported for specified system. The returned data is in the format (key, value, children), where children is a list with same format. e.g: ("root", "", [("chassis", "", [("slot", "1", [("boottime", "1000", []), ("version", "1234", []), ("status", "ok", [])]), ("slot", "2", [("boottime", "1337", []), ("version", "1234", []), ("status", "ok", [])])])]) @type systemid: C{str} @param systemid: The system to retrieve data for. See also L{sysinfo_systems_list}. @returns: C{tuple} (key, value, children) @raises PLDBUnsupportedInFirmware: If used on firmware without support for sysinfo. @attention: sysinfo requires v14.0 firmware or newer.
Return systems having reported sysinfo data
list
of str
.
Return a list
of graph data for the specified system. Each
value represent one minute, and there are 1439 values (24 hours except the
minute in progress). Each value is an int
with the value, or
False
if data was missing at that point.
list
of int
or {False}
int
) - The templateid to use, see template_list.
str
) - The systemid for which to fetch data. See system_list.
Defaults to the connected system.
Wait for new data to be committed on resource.
This method returns as soon as the server signals that another client has committed new data to the resource. It also periodically tests the connection to the server. If connection is broken (or any other error happens) an exception is raised.
List all XFB (Transfer Behaviour) flags, that can be used in FlagObjects.
list
of str
Deprecated alias for TEMPLATE_TYPE_SYSDIAG
The CommitID associated with this session. (14.0 or newer only)
Information about a Template in the SystemOverview.
Returned in a list by SystemOverview.template_list.
Class Variables: | |
---|---|
__slots__ | For internal use only. |
Properties: | |
---|---|
descstr | String description of value (usually OID) |
flags | Boolean flag(s): summary |
id | Values internal ID within the zone |
name | Name of the template |
templateid | Internal ID, used in SystemOverview.system_graph call |
ttype | one of the TEMPLATE_TYPE_ constants |
type | one of the TYPE_ constants |
vtype | one of the VTYPE_ constants |
zone | Zone ID, one of the SYSDIAG_ZONE_ constants |
String description of value (usually OID)
Boolean flag(s): summary
Values internal ID within the zone.
Name of the template.
Internal ID, used in SystemOverview.system_graph call
one of the TEMPLATE_TYPE_ constants
one of the TYPE_ constants
one of the VTYPE_ constants
Zone ID, one of the SYSDIAG_ZONE_ constants
Methods: | ||
---|---|---|
items(self) Return a list of (prop, value) tuples, similar to dict.items() |
Properties: | |
---|---|
summary |
Return a list of (prop, value) tuples, similar to dict.items().