This module contains functionality for accessing System Diagnostics
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") >>> ht = pl.SysDiag()
Methods: | ||
---|---|---|
close(self) Immediately disconnects the resource |
||
commit(self, message='PythonAPI commit') Store the current transaction to the database |
||
log_clear(self) Clear the system diagnostics log |
||
list of SysDiagLogEntry
|
log_list(self, only_new=False, min_id=0) Lists system diagnostics log entries |
|
log_post(self, severity, title, body) Post a new entry to the System Diagnostics log |
||
list of SysDiagMallocUsageEntry
|
malloc_usage_list(self) Lists system diagnostics malloc usage entries |
|
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 |
|
zone_create(self, oid, name, functional_area='Undefined') |
||
dict of SysDiagZone
|
zone_list(self) Lists all available system diagnostics zones |
|
zone_system_name_set(self, systemid, systemname) Sets the systemid and system-name used for updating zone values Must be |
||
zone_version(self) |
Properties: | |
---|---|
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.
Clear the system diagnostics log.
Lists system diagnostics log entries.
list
of SysDiagLogEntry
bool
) - Only return entries with the is_new flag set.
int
) - Only return entries with a id > min_id
Post a new entry to the System Diagnostics log.
int
) - Event severity. (SYSDIAG_LOG_SEVERITY_INFO, SYSDIAG_LOG_SEVERITY_WARNING or
SYSDIAG_LOG_SEVERITY_CRITICAL)
str
) - Event title.
str
) - Event body.
Lists system diagnostics malloc usage entries.
list
of SysDiagMallocUsageEntry
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
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
Lists all available system diagnostics zones
dict
of SysDiagZone
Sets the systemid and system-name used for updating zone values Must be called before using SysDiagZone.update_values()
The CommitID associated with this session. (14.0 or newer only)
Information about a System Diagnostiscs Log Entry
Returned in a list by SysDiag.log_list.
Methods: | ||
---|---|---|
Ungrouped | ack(self) Clears this entry's is_new flag |
Properties: | |
---|---|
body | Event details |
id | ID number of the event |
is_new | Status of the event |
severity | Event severity |
system | Name of the system that generated the event |
systemid | System ID of the system that generated the event |
title | Title of the event |
tstamp | Timestamp of the event |
Clears this entry's is_new flag.
Event details
ID number of the event
Status of the event
Event severity
Name of the system that generated the event
System ID of the system that generated the event
Title of the event
Timestamp of the event
Information about a System Diagnostiscs Malloc Usage Entry
Returned in a list by SysDiag.log_list.
Methods: | ||
---|---|---|
Ungrouped | fetch(self) Clears this entry's is_new flag |
Properties: | |
---|---|
names | List of malloc names |
systemname | Name of the system |
zonename | Name of the zone |
Clears this entry's is_new flag.
List of malloc names
Name of the system
Name of the zone
Information about a System Diagnostiscs Zone
Returned in a list by SysDiag.zone_list.
Methods: | ||
---|---|---|
Ungrouped | enum_name_add(self, valueid, enumvalue, enumname) Adds a enum entry for specified value |
|
get_string_value(self, idx, level) Get string value of a specified level and id |
||
get_string_values(self) Get string values of this zone |
||
refresh(self) Refreshes all top-level values for this zone |
||
refresh_string_values(self) Refreshes all string values for this zone |
||
register(self) Register a new zone with PLDB |
||
send(self, elapsed) Update zone values |
||
string_value_add(self, valueidx, level, value) Adds a string value for specified value |
||
string_values_send(self) Send added string values for this zone |
||
sublevel_add(self, levelname) Create a new sublevel under this zone |
||
value_definition_add(self, id, name, type, flags=0) Adds a new value definition to the zone, this should be done before |
Properties: | |
---|---|
functional_area | Functional area of the zone |
name | Name of the zone |
num_values | Number of value definitions in the zone |
oid | Zone OID |
valuedefs | Dict of value definitions |
Adds a enum entry for specified value.
Get string value of a specified level and id.
str
string value belongs to specified level and id.
int
) - Id of specified sysdiag value.
str
) - Path of specificed sysdiag value (MAC Address/000BBBCC231/Channel 1:2:1 -
e10k0 for example).
Get string values of this zone.
Refreshes all top-level values for this zone
Refreshes all string values for this zone.
Register a new zone with PLDB
Adds a string value for specified value.
Send added string values for this zone.
Create a new sublevel under this zone.
Adds a new value definition to the zone, this should be done before registering the zone with PLDB
Functional area of the zone
Name of the zone
Number of value definitions in the zone
Zone OID
Dict of value definitions