apmon
 

ApMon - Application Monitoring Tool
* Version: 2.2.0

 
Modules
             
Logger
ProcInfo




 
Classes
             
ApMon

 
class ApMon
      Main class for sending monitoring data to a MonaLisa module.
One or more destinations can be chosen for the data. See constructor.
 
The data is packed in UDP datagrams, using XDR. The following fields are sent:
- version & password (string)
- cluster name (string)
- node name (string)
- number of parameters (int)
- for each parameter:
        - name (string)
        - value type (int)
        - value
- optionally a (int) with the given timestamp
 
Attributes (public):
- destinations - a list containing (ip, port, password) tuples
- configAddresses - list with files and urls from where the config is read
- configRecheckInterval - period, in seconds, to check for changes 
  in the configAddresses list
- configRecheck - boolean - whether to recheck periodically for changes 
  in the configAddresses list
 
  

__init__(self, initValue)
Class constructor:
- if initValue is a string, put it in configAddresses and load destinations
  from the file named like that. if it starts with "http://", the configuration 
  is loaded from that URL. For background monitoring, given parameters will overwrite defaults
 
- if initValue is a list, put its contents in configAddresses and create 
  the list of destinations from all those sources. For background monitoring, 
  given parameters will overwrite defaults (see __defaultOptions)
 
- if initValue is a tuple (of strings), initialize destinations with that values.
  Strings in this tuple have this form: "{hostname|ip}[:port][ passwd]", the
  default port being 8884 and the default password being "". Background monitoring will be
  enabled sending the parameters active from __defaultOptions (see end of file)
 
- if initValue is a hash (key = string(hostname|ip[:port][ passwd]),
  val = hash{'param_name': True/False, ...}) the given options for each destination 
  will overwrite the default parameters (see __defaultOptions)
__del__(self)
 Destructor

addJobToMonitor(self, pid, workDir, clusterName, nodeName)
Add a new job to monitor.
enableBgMonitoring(self, onOff)
Enable or disable background monitoring. Note that background monitoring information
can still be sent if user calls the sendBgMonitoring method.
free(self)
Stop background threands, close opened sockets. You have to use this function if you want to
free all the resources that ApMon takes, and allow it to be garbage-collected.
removeJobToMonitor(self, pid)
Remove a job from being monitored.
sendBgMonitoring(self)
Send now background monitoring about system and jobs to all interested destinations.
sendParameter(self, clusterName, nodeName, paramName, paramValue)
Send a single parameter to MonALISA.
sendParameters(self, clusterName, nodeName, params)
Send multiple parameters specifying cluster and node name for them
sendParams(self, params)
Send multiple parameters to MonALISA, with default (last given) cluser and node names.
sendTimedParameter(self, clusterName, nodeName, timeStamp, paramName, paramValue)
Send a single parameter, with a given time.
sendTimedParameters(self, clusterName, nodeName, timeStamp, params)
Send multiple monitored parameters to MonALISA. 
 
- clusterName is the name of the cluster being monitored. The first
  time this function is called, this paramenter must not be None. Then,
  it can be None; last given clusterName will be used instead.
- nodeName is the name of the node for which are the parameters. If this
  is None, the full hostname of this machine will be sent instead.
- timeStamp, if > 0, is given time for the parameters. This is in seconds from Epoch.
  Note that this option should be used only if you are sure about the time for the result.
  Otherwize, the parameters will be assigned a correct time (obtained from NTP servers)
  in MonALISA service. This option can be usefull when parsing logs, for example.
- params is a dictionary containing pairs with:
        - key: parameter name
        - value: parameter value, either int or float.
  or params is a vector of tuples (key, value). This version can be used
  in case you want to send the parameters in a given order.
 
NOTE that python doesn't know about 32-bit floats (only 64-bit floats!)
sendTimedParams(self, timeStamp, params)
Send multiple parameters, specifying the time for them, with default (last given) cluster and node names. 
(See sendTimedParameters for more details)
setLogLevel(self, strLevel)
Change the log level. Given level is a string, one of 'FATAL', 'ERROR', 'WARNING', 
'INFO', 'NOTICE', 'DEBUG'.
setMaxMsgRate(self, rate)
Set the maximum number of messages that can be sent, per second.
setMonitorClusterNode(self, clusterName, nodeName)
Set the cluster and node names where to send system related information.