Documentation for PythonAPI
17.2.0py1

packetlogic2.pldb.systemoverview

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", "pldemo00")
>>> so = pl.SystemOverview()

Classes defined here:

  • System - Information about a System in the SystemOverview
  • Template - Information about a Template in the SystemOverview

System

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

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.

SystemOverview

This is the resource for System Overview.

Inherits from: Resource
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

close(self)

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.

commit(self, message='PythonAPI commit')

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.

Parameters:
  • message (str) - Message recorded in the commit log. Ignored in v12.1 and earlier.
  • message parameter is ignored in v12.1 firmware and earlier.

ping(self, string='')

Send a command to server to test if it is up.

protocol(self, protocol, strict=False)

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.

Returns:
  • Tuple with name and nr of specified protocol.
  • tuple of (str, int)
Parameters:
  • protocol (int, str or a ProtocolObject Item) - Name or number of an IP protocol
  • strict (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).

protocols_dict(self)

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.

Returns:
  • Dict with name:nr and nr:name items for IP protocols.
  • dict of str:int and int:str

rollback(self)

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.

Exceptions raised:
  • resource.PLDBError - If the rollback command failed.

services_cmd(self, services=[], props=[])

Send services to pldbd

Sets stringtable for services and properties. Do NOT use this unless you know exactly what you are doing.

Parameters:
  • services (list of str) - List of services
  • props (list of str) - List of service properties

services_list(self)

List all services

Returns:
  • List of services
  • list of str

services_prop_list(self)

List all properties.

Returns:
  • List of service properties
  • list of str

sysinfo_get(self, systemid)

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.

sysinfo_systems_list(self)

Return systems having reported sysinfo data

Returns:
  • list of str.
Exceptions raised:
  • PLDBUnsupportedInFirmware - If used on firmware without support for sysinfo.
  • sysinfo requires v14.0 firmware or newer.

system_graph(self, templateid, systemid=None)

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.

Returns:
  • list of int or {False}
Parameters:
  • systemid (str) - The systemid for which to fetch data. See system_list. Defaults to the connected system.
Exceptions raised:
  • ValueError - if no data can be read for the specified criteria.

system_list(self)

Return systems defined in systems overview.

Returns:

template_list(self)

Return templates used by systems overview.

Returns:

wait_for_commit(self, pinginterval=60)

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.

Parameters:
  • pinginterval (int) - Interval used to check if connection still is alive.

xfb_flags_list(self)

List all XFB (Transfer Behaviour) flags, that can be used in FlagObjects.

Returns:
  • List of XFB flags
  • list of str

TEMPLATE_TYPE_STATS

Deprecated alias for TEMPLATE_TYPE_SYSDIAG

commitid

The CommitID associated with this session. (14.0 or newer only)

Template

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

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

TemplateFlags

Undocumented!
Inherits from: BaseFlags
Methods:
items(self)
Return a list of (prop, value) tuples, similar to dict.items()
Properties:
summary

items(self)

Return a list of (prop, value) tuples, similar to dict.items().

summary

Undocumented!