util Package¶
advLogging Module¶
-
class
eWRT.util.advLogging.SNMPHandler(moduleName)[source]¶ Bases:
logging.HandlerLogging handler for sending SNMP traps
assert Module¶
@package eWRT.util.assert Assertion based counters
Examples: see unittests
async Module¶
@package eWRT.util.async asynchronous procedure calls
@warning this library is still a draft and might change considerable
-
class
eWRT.util.async.Async(cache_dir, cache_nesting_level=0, cache_file_suffix='', max_processes=8, debug_dir=None)[source]¶ Bases:
eWRT.util.cache.DiskCacheAsynchronous Call Handling
-
getPostHashfile(cmd)[source]¶ returns an identifier representing the object which is compatible to the identifiers returned by the eWRT.util.cache.* classes.
-
cache Module¶
@package eWRT.util.cache caches arbitrary objects
-
class
eWRT.util.cache.Cache(fn=None)[source]¶ Bases:
objectAn abstract class for caching functions
-
fetch(fetch_function, *args, **kargs)[source]¶ Fetches a object from the cache or computes it by calling the fetch_function. The objectId is computed based on the function arguments
-
-
class
eWRT.util.cache.DiskCache(cache_dir, cache_nesting_level=0, cache_file_suffix='', fn=None)[source]¶ Bases:
eWRT.util.cache.Cache@class DiskCache Caches abitrary functions based on the function’s arguments (fetch) or on a user defined key (fetchObjectId)
@remarks This version of DiskCached is threadsafe
-
fetch(fetch_function, *args, **kargs)[source]¶ - fetches the object with the given id, querying
- the cache and
- the fetch_function
if the fetch_function is called, the functions result is saved in the cache
::param fetch_function: function to call if the result is not in the cache ::param args: arguments ::param kargs: optional keyword arguments
::returns: the object (retrieved from the cache or computed)
-
fetchObjectId(key, fetch_function, *args, **kargs)[source]¶ - fetches the object with the given id, querying
- the cache and
- the fetch_function
if the fetch_function is called, the functions result is saved in the cache
::param key: key to fetch ::param fetch_function: function to call if the result is not in the cache ::param args: arguments ::param kargs: optional keyword arguments
::returns: the object (retrieved from the cache or computed)
-
-
class
eWRT.util.cache.DiskCached(cache_dir, cache_nesting_level=0, cache_file_suffix='')[source]¶ Bases:
objectDecorator based on Cache for caching arbitrary function calls usage:
@DiskCached(”./cache/myfunction”) def myfunction(*args):@remarks This version of DiskCached is threadsafe
-
cache¶
-
-
class
eWRT.util.cache.IterableCache(cache_dir, cache_nesting_level=0, cache_file_suffix='', fn=None)[source]¶ Bases:
eWRT.util.cache.DiskCachecaches arbitrary iterable content identified by an identifier
-
fetchObjectId(key, function, *args, **kargs)[source]¶ - fetches the object with the given id, querying
- the cache and
- the function
if the function is called, the functions result is saved in the cache
::param key: key to fetch ::param function: function to call if the result is not in the cache ::param args: arguments ::param kargs: optional keyword arguments
::returns: the object (retrieved from the cache or computed)
-
-
class
eWRT.util.cache.MemoryCache(max_cache_size=0, fn=None)[source]¶ Bases:
eWRT.util.cache.Cache@class MemoryCached
Caches abitrary functions based on the function’s arguments (fetch) or on a user defined key (fetchObjectId)
-
max_cache_size¶
-
-
class
eWRT.util.cache.MemoryCached(arg)[source]¶ Bases:
eWRT.util.cache.MemoryCacheDecorator based on MemoryCache for caching arbitrary function calls usage:
@MemoryCached or @MemoryCached(max_cache_size) def myfunction(*args): ...
-
class
eWRT.util.cache.RedisCache(max_cache_size=0, fn=None, host='localhost', port=6379, db=0)[source]¶ Bases:
eWRT.util.cache.Cache
-
class
eWRT.util.cache.RedisCached(arg)[source]¶ Bases:
eWRT.util.cache.RedisCacheDecorator based on MemoryCache for caching arbitrary function calls usage:
@MemoryCached or @MemoryCached(max_cache_size) def myfunction(*args): ...
-
eWRT.util.cache.get_unique_temp_file(fname)¶
exception Module¶
@package eWRT.util.exception
-
exception
eWRT.util.exception.SNMPException(module_name, msg, level='warning')[source]¶ Bases:
exceptions.Exceptionreports an exception to snmp
execute Module¶
@package eWRT.util.execute Helpers for executing third party modules
monitoring Module¶
The class NSCA-Service helps the enables to send test-results over the NSCA service to Nagios. This is a more reliable way of sending messages directly from programs than with SNMP. On the one hand because they are not only associated to single service, but also as the configuration is easier
== Configuration ==
- Install the package nsca
aptitude install nsca
- On the monitoring system:
** edit the file ‘’/etc/nsca.cfg’‘: ** set a password and an appropriate encryption method
- On the host:
** edit the file ‘’/etc/send_nsca.cfg’’ ** enter the above password and encryption method
pickleIterator Module¶
pickelIterator
-
class
eWRT.util.pickleIterator.AbstractIterator(fname, file_mode=None)[source]¶ Bases:
objectAbstract Iterator class used to implement ReadPickleIterator and WritePickleIterator
-
class
eWRT.util.pickleIterator.ReadPickleIterator(fname)[source]¶ Bases:
eWRT.util.pickleIterator.AbstractIteratorprovides an iterator over pickeled elements
-
class
eWRT.util.pickleIterator.WritePickleIterator(fname)[source]¶ Bases:
eWRT.util.pickleIterator.AbstractIteratorwrites pickeled elements (available as iterator) to a file
profile Module¶
@package eWRT.util.profile google like profiling :)
@warning this library is still a draft and might change considerable