Auxiliary Classes

nagiosplugin’s auxiliary classes are not strictly required to write checks, but simplify common tasks and provide convenient access to functionality that is regularly needed by plugin authors.

Note

All classes that plugin authors typically need are imported directly into the nagiosplugin name space. For example, use

import nagiosplugin
# ...
with nagiosplugin.Cookie(path) as cookie:
   # ...

to get a cookie.

nagiosplugin.logtail

LogTail example

Calls process() for each new line in a log file:

cookie = nagiosplugin.Cookie(self.statefile)
with nagiosplugin.LogTail(self.logfile, cookie) as newlines:
   for line in newlines:
      process(line.decode())