def performance(self, metric, resource): """ Format performance data. :param metric: Metric :param resource: Resource :return: Performance """ # for dev mode if len(metric.value) == 1: crit = nagiosplugin.Range("~:0".format(int(round(len(metric.value) / 2)))) warn = None # for 3 node cluster elif 1 < len(metric.value) < 4: crit = nagiosplugin.Range("~:2".format(int(round(len(metric.value) / 2)))) warn = None # anything bigger if len(metric.value) >= 4: crit = nagiosplugin.Range("~:{}".format(int(round(len(metric.value) / 2)))) warn = nagiosplugin.Range("{}:{}".format(int(round(len(metric.value) / 2))+1, len(metric.value)-1)) return nagiosplugin.Performance( label="OK ZK nodes", value=len(metric.value), uom="Number", warn=warn, crit=crit, )
def performance(self, metric, resource): """Derives performance data from a given metric. :param metric: associated metric from which performance data are derived :param resource: resource that produced the associated metric (may optionally be consulted) :returns: :class:`Perfdata` object """ return nagiosplugin.Performance(label=metric.name, value=metric.value)
def performance(self, metric, resource): if str(metric) == 'Up': return nagiosplugin.Performance('status_ap', 0) elif str(metric) == 'Down': return nagiosplugin.Performance('status_ap', 1)
def performance(self, metric, resource): return nagiosplugin.Performance("packages", len(metric.value))
def performance(self, metric, resource): return nagiosplugin.Performance('state_tunnel', int(metric.value))
def performance(self, metric, resource): return nagiosplugin.Performance(label=self.name, value=metric.value, min=0)
def performance( self, metric: nagiosplugin.Metric, resource: nagiosplugin.Resource ) -> Optional[nagiosplugin.Performance]: if self.check_lifetime and metric.value is not None: return nagiosplugin.Performance(self.name, metric.value, '') return None
def performance(self, metric, resource): return np.Performance(metric.name, metric.value, '', 0, 0, metric.min, metric.max)
def performance(self, metric, resource): if not opts.performance_data: return None return nagiosplugin.Performance(metric.name, metric.value, metric.uom, self.warning, self.critical, metric.min, metric.max)