prtg package

Submodules

prtg.version module

Version information for package

Module contents

Module load point

class prtg.PRTGApi(host, user, passhash, rootid=0, protocol='https', port='443', verify=True)

Bases: prtg.client.GlobalArrays, prtg.client.BaseConfig

Parameters: - host: Enter the ip address or hostname where PRTG is running - port: Enter the tcp port used to connect to prtg. (usually 80 or 443) - user: Enter your PRTG username - passhash: Enter your PRTG passhash. Can be found in PRTG

webgui > settings > account settings
  • protocol: Enter the protocol used to connect to PRTG server (http or
    https)
  • rootid: Enter the id of the group/probe that contains all the objects
    you want to manage. Defaults to 0 (gets entire sensortree)

Example: host = ‘192.168.1.1’ port = ‘443’ user = ‘prtgadmin’ passhash = ‘0000000’ protocol = ‘https’ rootid = ‘53’ prtg = PRTGApi(host,user,passhash,rootid,protocol,port)

initialize()

Called to load the local cache

refresh(refreshsoup=None)

Used to supply or obtain and update local cache

search_byid(idval)

Find an element with the specified ID looking in all the cached kinds of data.

class prtg.PRTGDevice(host, user, passhash, deviceid, protocol='https', port='443', verify=True)

Bases: prtg.client.BaseConfig

Separate top level object to manage just a device and its sensors instead of downloading details for an entire group

initialize()

Called to load the local cache

refresh(refreshsoup=None)

Used to supply or obtain and update local cache

class prtg.PRTGSensor(host, user, passhash, sensorid, protocol='https', port='443', verify=True)

Bases: prtg.client.BaseConfig

Separate top level object to manage just a sensor and its channels instead of downloading details for an entire group

acknowledge(message='')

Used to indicate a response to a sensor being investigated.

get_channels()

Lookup the channels the sensor has.

initialize()

Called to load the local cache

refresh(refreshsoup=None)

Used to supply or obtain and update local cache

save_graph(graphid, filepath, size, hidden_channels='', filetype='svg')

Size options: S,M,L

exception prtg.AuthenticationError

Bases: Exception

Raised when failing to login to the API

exception prtg.ResourceNotFound

Bases: Exception

Raised if requesting a node and PRTG says it is not found or it can not be located via an ID search

class prtg.PRTGHistoricData(host, port, user, passhash, protocol, verify=True)

Bases: prtg.client.ConnectionMethods

class used for calls to the historic data api. Call the class first using connection params then use methods to get/process data. yyyy-mm-dd-hh-mm-ss

static format_date(dateobj)

Pass a datetime object and this will format appropriately for use with the historic data api

get_historic_data(objid, startdate, enddate, timeaverage)

Call PRTG API to load historic data