/usr/lib/python3/dist-packages/nagiosplugin/resource.py is in python3-nagiosplugin 1.2.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | """Domain model for data :term:`acquisition`.
:class:`Resource` is the base class for the plugin's :term:`domain
model`. It shoul model the relevant details of reality that a plugin is
supposed to check. The :class:`~.check.Check` controller calls
:meth:`Resource.probe` on all passed resource objects to acquire data.
Plugin authors should subclass :class:`Resource` and write
whatever methods are needed to get the interesting bits of information.
The most important resource subclass should be named after the plugin
itself.
"""
class Resource(object):
"""Abstract base class for custom domain models.
Subclasses may add arguments to the constructor to parametrize
information retrieval.
"""
@property
def name(self):
return self.__class__.__name__
def probe(self):
"""Query system state and return metrics.
This is the only method called by the check controller.
It should trigger all necessary actions and create metrics.
:return: list of :class:`~nagiosplugin.metric.Metric` objects,
or generator that emits :class:`~nagiosplugin.metric.Metric`
objects, or single :class:`~nagiosplugin.metric.Metric`
object
"""
return []
|