示例#1
0
 def get_energy_cons(self, metrics):
     for metric in metrics:
         if self.is_lite:
             value = self.snmp.get("1.3.6.1.4.1.27514.103.0.30.0")
         else:
             value = self.snmp.get("1.3.6.1.4.1.27514.102.0.24")
         self.set_metric(
             id=("Environment | Energy Consumption", metric.labels),
             value=value,
             scale=scale(0.01, 2),
         )
示例#2
0
 def get_voltage(self, metrics):
     for metric in metrics:
         value = self.snmp.get("1.3.6.1.3.55.1.3.1.4.%s" % metric.ifindex)
         port = metric.labels[0].rsplit("::", 1)[-1]
         self.set_metric(
             id=("Environment | Voltage", metric.labels),
             labels=[f"noc::module::{port}", f"noc::sensor::{port}"],
             value=value,
             scale=scale(0.001, 2),
             multi=True,
         )
示例#3
0
 def get_current_input(self, metrics):
     for metric in metrics:
         if self.is_lite:
             value = self.snmp.get("1.3.6.1.4.1.27514.103.0.28.0")
         else:
             value = self.snmp.get("1.3.6.1.4.1.27514.102.0.21")
         if is_float(value) or is_int(value):
             self.set_metric(
                 id=("Environment | Electric Current", metric.labels),
                 value=value,
                 scale=scale(0.01),
             )
示例#4
0
 def get_voltage(self, metrics):
     for metric in metrics:
         if self.is_lite:
             value = self.snmp.get("1.3.6.1.4.1.27514.103.0.24.0")
             port = metric.labels[0].rsplit("::", 1)[-1]
             self.set_metric(
                 id=("Environment | Voltage", metric.labels),
                 labels=["noc::module::battery", f"noc::name::{port}"],
                 value=value,
                 scale=scale(0.1, 2),
                 multi=True,
             )
示例#5
0
 def get_voltage(self, metrics):
     for metric in metrics:
         if metric.ifindex == 29:
             value = self.snmp.get("1.3.6.1.4.1.51315.1.40.0")
             port = metric.labels[0].rsplit("::", 1)[-1]
             self.set_metric(
                 id=("Environment | Voltage", metric.labels),
                 labels=["noc::module::battery", f"noc::sensor::{port}"],
                 value=value,
                 scale=scale(0.1, 2),
                 multi=True,
             )
示例#6
0
 def get_energy_cons(self, metrics):
     for metric in metrics:
         if self.is_lite:
             value = self.snmp.get("1.3.6.1.4.1.27514.103.0.30.0")
         else:
             value = self.snmp.get("1.3.6.1.4.1.27514.102.0.24")
         port = metric.labels[0].rsplit("::", 1)[-1]
         self.set_metric(
             id=("Environment | Energy Consumption", metric.labels),
             value=value,
             labels=[f"noc::sensor::{port}"],
             scale=scale(0.01, 2),
         )
示例#7
0
 def get_current_input(self, metrics):
     for metric in metrics:
         if self.is_lite:
             value = self.snmp.get("1.3.6.1.4.1.27514.103.0.28.0")
         else:
             value = self.snmp.get("1.3.6.1.4.1.27514.102.0.21")
         port = metric.labels[0].rsplit("::", 1)[-1]
         if is_float(value) or is_int(value):
             self.set_metric(
                 id=("Environment | Electric Current", metric.labels),
                 labels=[f"noc::sensor::{port}"],
                 value=value,
                 scale=scale(0.01),
             )
示例#8
0
 def get_temperature(self, metrics):
     for metric in metrics:
         port = metric.labels[0].rsplit("::", 1)[-1]
         if "temp" in port:
             value = self.snmp.get(
                 "1.3.6.1.4.1.27514.%s.0.%s.0" % (self.check_oid(), metric.ifindex)
             )
             self.set_metric(
                 id=("Environment | Temperature", metric.labels),
                 labels=[f"noc::module::{port}", f"noc::name::{port}"],
                 value=value,
                 multi=True,
             )
         if "ups" in port:
             if self.is_lite:
                 value = self.snmp.get("1.3.6.1.4.1.27514.103.0.26.0")
                 self.set_metric(
                     id=("Environment | Temperature", metric.labels),
                     labels=["noc::module::battery", f"noc::name::{port}"],
                     value=value,
                     scale=scale(0.1, 2),
                     multi=True,
                 )