Ejemplo n.º 1
0
  def setup_sensors_beam (self, beam):

    b = str(beam)
    self._beam_sensors = {}

    self.script.log(2, "KATCPServer::setup_sensors_beam ="+b)

    self._beam_sensors["observing"] = Sensor.boolean("observing",
      description="Beam " + b + " is observing",
      unit="",
      default=0)
    self.add_sensor(self._beam_sensors["observing"])

    self._beam_sensors["snr"] = Sensor.float("snr",
      description="SNR of Beam "+b,
      unit="",
      params=[0,1e9],
      default=0)
    self.add_sensor(self._beam_sensors["snr"])

    self._beam_sensors["power"] = Sensor.float("power",
      description="Power Level of Beam "+b,
      unit="",
      default=0)
    self.add_sensor(self._beam_sensors["power"])

    self._beam_sensors["integrated"] = Sensor.float("integrated",
      description="Length of integration for Beam "+b,
      unit="",
      default=0)
    self.add_sensor(self._beam_sensors["integrated"])
Ejemplo n.º 2
0
 def setup_sensors(self):
     """
     @brief   Setup monitoring sensors
     """
     self._device_status_sensor = Sensor.discrete(
         "device-status",
         description="Health status of FIServer",
         params=self.DEVICE_STATUSES,
         default="ok",
         initial_status=Sensor.UNKNOWN)
     self.add_sensor(self._device_status_sensor)
     self._active_beams_sensor = Sensor.float(
         "nbeams",
         description="Number of beams that are currently active",
         default=1,
         initial_status=Sensor.UNKNOWN)
     self.add_sensor(self._active_beams_sensor)
     self._nchannels_sensor = Sensor.float(
         "nchannels",
         description="Number of channels in each beam",
         default=1,
         initial_status=Sensor.UNKNOWN)
     self.add_sensor(self._nchannels_sensor)
     self._integration_time_sensor = Sensor.float(
         "integration-time",
         description="The integration time for each beam",
         default=1,
         initial_status=Sensor.UNKNOWN)
     self.add_sensor(self._integration_time_sensor)
     self._nblank_phases_sensor = Sensor.integer(
         "nblank-phases",
         description="The number of blank phases",
         default=1,
         initial_status=Sensor.UNKNOWN)
     self.add_sensor(self._nblank_phases_sensor)
Ejemplo n.º 3
0
    def add_input_stream_sensor(self, streamid):
        """
        @brief add sensors for i/o buffers for an input stream with given streamid.
        """
        self._polarization_sensors[streamid] = {}
        self._polarization_sensors[streamid]["mkrecv_sensors"] = MkrecvSensors(streamid)
        for s in self._polarization_sensors[streamid]["mkrecv_sensors"].sensors.values():
            self.add_sensor(s)
        self._polarization_sensors[streamid]["input-buffer-fill-level"] = Sensor.float(
                "input-buffer-fill-level-{}".format(streamid),
                description="Fill level of the input buffer for polarization{}".format(streamid),
                params=[0, 1])
        self.add_sensor(self._polarization_sensors[streamid]["input-buffer-fill-level"])
        self._polarization_sensors[streamid]["input-buffer-total-write"] = Sensor.float(
                "input-buffer-total-write-{}".format(streamid),
                description="Total write into input buffer for polarization {}".format(streamid),
                params=[0, 1])

        self.add_sensor(self._polarization_sensors[streamid]["input-buffer-total-write"])
        self._polarization_sensors[streamid]["output-buffer-fill-level"] = Sensor.float(
                "output-buffer-fill-level-{}".format(streamid),
                description="Fill level of the output buffer for polarization {}".format(streamid)
                )
        self._polarization_sensors[streamid]["output-buffer-total-read"] = Sensor.float(
                "output-buffer-total-read-{}".format(streamid),
                description="Total read from output buffer for polarization {}".format(streamid)
                )
        self.add_sensor(self._polarization_sensors[streamid]["output-buffer-total-read"])
        self.add_sensor(self._polarization_sensors[streamid]["output-buffer-fill-level"])
Ejemplo n.º 4
0
    def __init__(self, name_suffix, nsum=100):
        """
        List of sensors and handler to be connected to a mkrecv process
        """
        self.sensors = {}

        self.sensors['global_payload_frac'] = Sensor.float(
            "global-payload-received-fraction-{}".format(name_suffix),
            description="Ratio of received and expected payload.",
            params=[0, 1])
        self.sensors['received_heaps_frac'] = Sensor.float(
            "received-heaps-frac-{}".format(name_suffix),
            description="Fraction of received heaps for last {} slots.".format(
                100),
            params=[0, 1])
        self.sensors['slot_received_heaps'] = Sensor.integer(
            "slot_received-heaps-{}".format(name_suffix),
            description="Received heaps.",
        )
        self.sensors['slot_expected_heaps'] = Sensor.integer(
            "slot_expected-heaps-{}".format(name_suffix),
            description="Expected heaps.",
        )

        self.sensors['missing_heaps'] = Sensor.string(
            "missing-heaps-{}".format(name_suffix),
            description="Missing heaps per multicast group.",
        )

        self.__received_heaps = 0.
        self.__expected_heaps = 0.
        self.__idx = 0
        self.__nsum = nsum

        self.__missing_heaps = np.zeros(8)
Ejemplo n.º 5
0
 def __init__(self,polling_interval=1):
     super(CpuMonitor,self).__init__(polling_interval)
     for cpu_idx in range(psutil.cpu_count()):
         self._sensors["cpu%02d_percent"%cpu_idx] = Sensor.float("cpu%02d_percent"%cpu_idx,
             description = "percentage usage of cpu%02d"%cpu_idx,
             params = [0,200],
             unit = "%",
             default = 0)
         self._sensors["cpu%02d_temperature"%cpu_idx] = Sensor.float("cpu%02d_temperature"%cpu_idx,
             description = "temperature of cpu%02d"%cpu_idx,
             params = [0,200],
             unit = "Celsius",
             default = 0)
Ejemplo n.º 6
0
    def setup_sensors_beam(self, beam):

        b = str(beam)
        self._beam_sensors = {}

        self.script.log(2, "KATCPServer::setup_sensors_beam beam=" + b)

        self._beam_sensors["observing"] = Sensor.boolean("observing",
                                                         description="Beam " +
                                                         b + " is observing",
                                                         unit="",
                                                         default=0)
        self.add_sensor(self._beam_sensors["observing"])

        self._beam_sensors["snr"] = Sensor.float("snr",
                                                 description="SNR of Beam " +
                                                 b,
                                                 unit="",
                                                 params=[0, 1e9],
                                                 default=0)
        self.add_sensor(self._beam_sensors["snr"])

        self._beam_sensors["beamformer_stddev_polh"] = Sensor.float(
            "beamformer_stddev_polh",
            description="Standard deviation of beam voltages for pol H",
            unit="",
            params=[0, 127],
            default=0)
        self.add_sensor(self._beam_sensors["beamformer_stddev_polh"])

        self._beam_sensors["beamformer_stddev_polv"] = Sensor.float(
            "beamformer_stddev_polv",
            description="Standard deviation of beam voltages for pol V",
            unit="",
            params=[0, 127],
            default=0)
        self.add_sensor(self._beam_sensors["beamformer_stddev_polv"])

        self._beam_sensors["integrated"] = Sensor.float(
            "integrated",
            description="Length of integration for Beam " + b,
            unit="",
            default=0)
        self.add_sensor(self._beam_sensors["integrated"])

        self._beam_sensors["input_channels"] = Sensor.integer(
            "input_channels",
            description="Number of configured input channels for Beam " + b,
            unit="",
            default=0)
        self.add_sensor(self._beam_sensors["input_channels"])
Ejemplo n.º 7
0
 def __init__(self,polling_interval=1):
     super(MemoryMonitor,self).__init__(polling_interval)
     for node in get_meminfo().keys():
         name_ = "%s_memory_size"%node
         self._sensors[name_] = Sensor.float(name_,
             description = "total memory on %s"%node,
             params = [8192,1e9],
             unit = "MB",
             default = 0)
         name_ = "%s_memory_avail"%node
         self._sensors[name_] = Sensor.float(name_,
             description = "available memory on %s"%node,
             params = [8192,1e9],
             unit = "MB",
             default = 0)
Ejemplo n.º 8
0
 def setup_sensors(self):
     """Set up basic monitoring sensors.
     """
     for name, params in self._parser.items():
         if params["type"] == "float":
             sensor = Sensor.float(name,
                                   description=params["description"],
                                   unit=params.get("units", None),
                                   default=params.get("default", 0.0),
                                   initial_status=Sensor.UNKNOWN)
         elif params["type"] == "string":
             sensor = Sensor.string(name,
                                    description=params["description"],
                                    default=params.get("default", ""),
                                    initial_status=Sensor.UNKNOWN)
         elif params["type"] == "int":
             sensor = Sensor.integer(name,
                                     description=params["description"],
                                     default=params.get("default", 0),
                                     unit=params.get("units", None),
                                     initial_status=Sensor.UNKNOWN)
         elif params["type"] == "bool":
             sensor = Sensor.boolean(name,
                                     description=params["description"],
                                     default=params.get("default", False),
                                     initial_status=Sensor.UNKNOWN)
         else:
             raise Exception("Unknown sensor type '{0}' requested".format(
                 params["type"]))
         self.add_sensor(sensor)
Ejemplo n.º 9
0
 def __init__(self,volumes,polling_interval=1):
     super(DiskMonitor,self).__init__(polling_interval)
     self._volumes = volumes
     for name,path in self._volumes:
         name_ = "%s_partition_size"%name
         self._sensors[name_] = Sensor.float(name_,
             description = "total size of %s partition"%name,
             params = [8192,1e9],
             unit = "MB",
             default = 0)
         name_ = "%s_partition_avail"%name
         self._sensors[name_] = Sensor.float(name_,
             description = "available space on %s partition"%name,
             params = [8192,1e9],
             unit = "MB",
             default = 0)
Ejemplo n.º 10
0
    def setup_sensors(self):
        """
        @brief Setup monitoring sensors
        """
        self._beam_sensor0 = Sensor.float("beam0.id",
                                          description="The ID of current beam",
                                          default=0,
                                          initial_status=Sensor.UNKNOWN)
        self.sensors.append(self._beam_sensor0)

        self._instant_sensor0 = Sensor.float(
            "beam0.inst-packet-loss-fraction",
            description="The instanteous packet loss fraction",
            default=0,
            initial_status=Sensor.UNKNOWN)
        self.sensors.append(self._instant_sensor0)

        self._time_sensor0 = Sensor.float(
            "beam0.time-elapsed",
            description="The time so far in seconds",
            default=0,
            initial_status=Sensor.UNKNOWN)
        self.sensors.append(self._time_sensor0)

        self._average_sensor0 = Sensor.float(
            "beam0.total-packet-loss-fraction",
            description="Fraction of packets lost",
            default=0,
            initial_status=Sensor.UNKNOWN)
        self.sensors.append(self._average_sensor0)

        self._beam_sensor1 = Sensor.float("beam1.id",
                                          description="The ID of current beam",
                                          default=0,
                                          initial_status=Sensor.UNKNOWN)
        self.sensors.append(self._beam_sensor1)

        self._instant_sensor1 = Sensor.float(
            "beam1.inst-packet-loss-fraction",
            description="The instanteous packet loss fraction",
            default=0,
            initial_status=Sensor.UNKNOWN)
        self.sensors.append(self._instant_sensor1)

        self._time_sensor1 = Sensor.float(
            "beam1.time-elapsed",
            description="The time so far in seconds",
            default=0,
            initial_status=Sensor.UNKNOWN)
        self.sensors.append(self._time_sensor1)

        self._average_sensor1 = Sensor.float(
            "beam1.total-packet-loss-fraction",
            description="Fraction of packets lost",
            default=0,
            initial_status=Sensor.UNKNOWN)
        self.sensors.append(self._average_sensor1)
Ejemplo n.º 11
0
    def add_input_stream_sensor(self, streamid):
        """
        Add sensors for i/o buffers for an input stream with given streamid.
        """
        self._polarization_sensors[streamid] = {}
        self._polarization_sensors[streamid]["mkrecv_sensors"] = MkrecvSensors(
            streamid)
        for s in self._polarization_sensors[streamid][
                "mkrecv_sensors"].sensors.values():
            self.add_sensor(s)
        self._polarization_sensors[streamid][
            "input-buffer-fill-level"] = Sensor.float(
                "input-buffer-fill-level-{}".format(streamid),
                description="Fill level of the input buffer for polarization{}"
                .format(streamid),
                initial_status=Sensor.UNKNOWN,
                params=[0, 1])
        self.add_sensor(
            self._polarization_sensors[streamid]["input-buffer-fill-level"])
        self._polarization_sensors[streamid][
            "input-buffer-total-write"] = Sensor.float(
                "input-buffer-total-write-{}".format(streamid),
                description="Total write into input buffer for polarization {}"
                .format(streamid),
                initial_status=Sensor.UNKNOWN,
                params=[0, 1])

        self.add_sensor(
            self._polarization_sensors[streamid]["input-buffer-total-write"])
        self._polarization_sensors[streamid][
            "output-buffer-fill-level"] = Sensor.float(
                "output-buffer-fill-level-{}".format(streamid),
                description="Fill level of the output buffer for polarization {}"
                .format(streamid),
                initial_status=Sensor.UNKNOWN)
        self._polarization_sensors[streamid][
            "output-buffer-total-read"] = Sensor.float(
                "output-buffer-total-read-{}".format(streamid),
                description="Total read from output buffer for polarization {}"
                .format(streamid),
                initial_status=Sensor.UNKNOWN)
        self.add_sensor(
            self._polarization_sensors[streamid]["output-buffer-total-read"])
        self.add_sensor(
            self._polarization_sensors[streamid]["output-buffer-fill-level"])
        self.mass_inform(Message.inform('interface-changed'))
Ejemplo n.º 12
0
  def setup_sensors_beam (self, beam):

    b = str(beam)
    self._beam_sensors = {}

    self.script.log(2, "KATCPServer::setup_sensors_beam beam="+b)

    self._beam_sensors["observing"] = Sensor.boolean("observing",
      description="Beam " + b + " is observing",
      unit="",
      default=0)
    self.add_sensor(self._beam_sensors["observing"])

    self._beam_sensors["snr"] = Sensor.float("snr",
      description="SNR of Beam "+b,
      unit="",
      params=[0,1e9],
      default=0)
    self.add_sensor(self._beam_sensors["snr"])

    self._beam_sensors["beamformer_stddev_polh"] = Sensor.float("beamformer_stddev_polh",
      description="Standard deviation of beam voltages for pol H",
      unit="",
      params=[0,127],
      default=0)
    self.add_sensor(self._beam_sensors["beamformer_stddev_polh"])

    self._beam_sensors["beamformer_stddev_polv"] = Sensor.float("beamformer_stddev_polv",
      description="Standard deviation of beam voltages for pol V",
      unit="",
      params=[0,127],
      default=0)
    self.add_sensor(self._beam_sensors["beamformer_stddev_polv"])

    self._beam_sensors["integrated"] = Sensor.float("integrated",
      description="Length of integration for Beam "+b,
      unit="",
      default=0)
    self.add_sensor(self._beam_sensors["integrated"])

    self._beam_sensors["input_channels"] = Sensor.integer("input_channels",
      description="Number of configured input channels for Beam "+b,
      unit="",
      default=0)
    self.add_sensor(self._beam_sensors["input_channels"])
Ejemplo n.º 13
0
 def setup_sensors(self):
     """
     @brief Setup monitoring sensors
     """
     EDDPipeline.setup_sensors(self)
     self._fpga_clock = Sensor.float("fpga-clock",
                                     description="FPGA Clock estimate",
                                     initial_status=Sensor.UNKNOWN)
     self.add_sensor(self._fpga_clock)
Ejemplo n.º 14
0
    def setup_sensors(self):
        """
        @brief Setup monitoring sensors
        """
        EDDPipeline.setup_sensors(self)

        self._integration_time_status = Sensor.float(
            "block-length-time",
            description="Length of a processing block [s]",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._integration_time_status)

        self._output_rate_status = Sensor.float(
            "output-rate",
            description="Output data rate [Gbyte/s]",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._output_rate_status)

        self._polarization_sensors = {}
Ejemplo n.º 15
0
    def setup_sensors(self):
        """
        Setup the monitoring sensors
        """
        EDDPipeline.setup_sensors(self)

        self._integration_time_status = Sensor.float(
            "integration-time",
            description="Integration time [s]",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._integration_time_status)

        self._output_rate_status = Sensor.float(
            "output-rate",
            description="Output data rate [Gbyte/s]",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._output_rate_status)

        self._polarization_sensors = {}
Ejemplo n.º 16
0
    def setup_sensors(self):
        self._config_sensor = Sensor.string(
            "configuration",
            description="The current configuration of the capture instance",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._config_sensor)

        self._mkrecv_header_sensor = Sensor.string(
            "mkrecv-capture-header",
            description=
            "The MKRECV/DADA header used for configuring capture with MKRECV",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._mkrecv_header_sensor)

        self._apsuse_args_sensor = Sensor.string(
            "apsuse-arguments",
            description="The command line arguments used to invoke apsuse",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._apsuse_args_sensor)

        self._mkrecv_heap_loss = Sensor.float(
            "fbf-heap-loss",
            description=("The percentage of FBFUSE heaps lost "
                         "(within MKRECV statistics window)"),
            default=0.0,
            initial_status=Sensor.UNKNOWN,
            unit="%")
        self.add_sensor(self._mkrecv_heap_loss)

        self._ingress_buffer_percentage = Sensor.float(
            "ingress-buffer-fill-level",
            description=("The percentage fill level for the capture"
                         "buffer between MKRECV and APSUSE"),
            default=0.0,
            initial_status=Sensor.UNKNOWN,
            unit="%")
        self.add_sensor(self._ingress_buffer_percentage)
Ejemplo n.º 17
0
    def setup_sensors(self):
        """Setup some server sensors."""
	
        self._add_result = Sensor.float("add.result",
                                        "Last ?add result.", "", [-10000, 10000])

        self._time_result = Sensor.timestamp("time.result",
                                             "Last ?time result.", "")

        self._eval_result = Sensor.string("eval.result",
                                          "Last ?eval result.", "")

        self._fruit_result = Sensor.discrete("fruit.result",
                                             "Last ?pick-fruit result.", "", self.FRUIT)
        self._device_armed = Sensor.boolean(
            "device-armed",
            description="Is the CAM server armed?",
            initial_status=Sensor.NOMINAL,
            default=True)
        self._bandwidth = Sensor.float("bandwidth", default=300)
        self._sourcename = Sensor.string("sourcename", default="none")
        self._source_ra = Sensor.string("source_RA", default=0)
        self._source_dec = Sensor.string("source_DEC", default=0)
        self._exposure_time = Sensor.float("EXP_time", default=0)

        self.add_sensor(self._sourcename)
        self.add_sensor(self._source_ra)
        self.add_sensor(self._source_dec)
        self.add_sensor(self._exposure_time)

        self.add_sensor(self._bandwidth)
        self.add_sensor(self._device_armed)
        self.add_sensor(self._add_result)
        self.add_sensor(self._time_result)
        self.add_sensor(self._eval_result)
        self.add_sensor(self._fruit_result)

        self._systemp_result = Sensor.float("add.result",
                                            "Last ?add result.", "", [-10000, 10000])
        self.add_sensor(self._systemp_result)
Ejemplo n.º 18
0
    def setup_sensors(self):
        """Setup some server sensors."""
        self._add_result = Sensor.float("add.result",
            "Last ?add result.", "", [-10000, 10000])
        self._add_result.set_value(0, Sensor.UNREACHABLE)

        self._time_result = Sensor.timestamp("time.result",
            "Last ?time result.", "")
        self._time_result.set_value(0, Sensor.INACTIVE)

        self._eval_result = Sensor.string("eval.result",
            "Last ?eval result.", "")
        self._eval_result.set_value('', Sensor.UNKNOWN)

        self._fruit_result = Sensor.discrete("fruit.result",
            "Last ?pick-fruit result.", "", self.FRUIT)
        self._fruit_result.set_value('apple', Sensor.ERROR)

        self.add_sensor(self._add_result)
        self.add_sensor(self._time_result)
        self.add_sensor(self._eval_result)
        self.add_sensor(self._fruit_result)
Ejemplo n.º 19
0
    def setup_sensors(self):
        """Setup some server sensors."""
        self._add_result = Sensor.float("add.result",
            "Last ?add result.", "", [-10000, 10000])

        self._time_result = Sensor.timestamp("time.result",
            "Last ?time result.", "")

        self._eval_result = Sensor.string("eval.result",
            "Last ?eval result.", "")

        self._fruit_result = Sensor.discrete("fruit.result",
            "Last ?pick-fruit result.", "", self.FRUIT)

        self._james_result = Sensor.string("james.result",
            "Last ?james result.", "")

        self.add_sensor(self._add_result)
        self.add_sensor(self._time_result)
        self.add_sensor(self._eval_result)
        self.add_sensor(self._fruit_result)
        self.add_sensor(self._james_result)
Ejemplo n.º 20
0
    def setup_sensors(self):
        """
        Setup monitoring sensors
        """
        EDDPipeline.setup_sensors(self)

        self._spectra_written = Sensor.integer(
            "written-packages",
            description="Number of spectra written to file.",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._spectra_written)

        self._incomplete_heaps = Sensor.integer(
            "incomplete-heaps",
            description="Incomplete heaps received.",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._incomplete_heaps)

        self._complete_heaps = Sensor.integer(
            "complete-heaps",
            description="Complete heaps received.",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._complete_heaps)

        self._current_file = Sensor.string("current-file",
                                           description="Current filename.",
                                           initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._current_file)

        self._current_file_size = Sensor.float("current-file-size",
                                               description="Current filesize.",
                                               initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._current_file_size)

        self._bandpass = Sensor.string(
            "bandpass",
            description="band-pass data (base64 encoded)",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._bandpass)
Ejemplo n.º 21
0
    def setup_sensors(self):
        super(ApsMasterController, self).setup_sensors()
        self._disk_fill_level_sensor = Sensor.float(
            "beegfs-fill-level",
            description="The percentage fill level of the BeeGFS cluster",
            default=0.0,
            unit="percentage",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._disk_fill_level_sensor)

        def check_disk_fill_level():
            try:
                used, avail = map(float, check_output(["df", "/DATA/"]
                    ).splitlines()[1].split()[2:4])
                percent_used = 100.0 * used / (used + avail)
                self._disk_fill_level_sensor.set_value(percent_used)
            except Exception as error:
                log.warning("Failed to check disk usage level: {}".format(
                    str(error)))
        check_disk_fill_level()
        self._disk_fill_callback = PeriodicCallback(
            check_disk_fill_level, 60 * 1000)
        self._disk_fill_callback.start()
Ejemplo n.º 22
0
    def setup_sensors(self):
        """Set up basic monitoring sensors.
        """
        for name, params in self._parser.items():
            v = params.copy()
            v.pop('updater')
            if 'range' in v:
                v.pop('range')

            self.__eddDataStore.addTelescopeDataItem(name, v)
            if params["type"] == "float":
                sensor = Sensor.float(name,
                                      description=params["description"],
                                      unit=params.get("units", None),
                                      default=params.get("default", 0.0),
                                      initial_status=Sensor.UNKNOWN)
            elif params["type"] == "string":
                sensor = Sensor.string(name,
                                       description=params["description"],
                                       default=params.get("default", ""),
                                       initial_status=Sensor.UNKNOWN)
            elif params["type"] == "int":
                sensor = Sensor.integer(name,
                                        description=params["description"],
                                        default=params.get("default", 0),
                                        unit=params.get("units", None),
                                        initial_status=Sensor.UNKNOWN)
            elif params["type"] == "bool":
                sensor = Sensor.boolean(name,
                                        description=params["description"],
                                        default=params.get("default", False),
                                        initial_status=Sensor.UNKNOWN)
            else:
                raise Exception("Unknown sensor type '{0}' requested".format(
                    params["type"]))
            self.add_sensor(sensor)
    def setup_sensors(self):
        """
        Setup monitoring sensors
        """
        EDDPipeline.setup_sensors(self)

        self._integration_time_status = Sensor.float(
            "integration-time",
            description="Integration time [s]",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._integration_time_status)

        self._output_rate_status = Sensor.float(
            "output-rate",
            description="Output data rate [Gbyte/s]",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._output_rate_status)

        self._mkrecv_sensors = MkrecvSensors("")

        for s in self._mkrecv_sensors.sensors.values():
            self.add_sensor(s)

        self._input_buffer_fill_level = Sensor.float(
            "input-buffer-fill-level",
            description="Fill level of the input buffer",
            params=[0, 1])
        self.add_sensor(self._input_buffer_fill_level)

        self._input_buffer_total_write = Sensor.float(
            "input-buffer-total-write",
            description="Total write into input buffer ",
            params=[0, 1])
        self.add_sensor(self._input_buffer_total_write)

        self._output_buffer_fill_level = Sensor.float(
            "output-buffer-fill-level",
            description="Fill level of the output buffer")
        self.add_sensor(self._output_buffer_fill_level)
        self._output_buffer_total_read = Sensor.float(
            "output-buffer-total-read",
            description="Total read from output buffer")
        self.add_sensor(self._output_buffer_total_read)
Ejemplo n.º 24
0
    def setup_sensors(self):
        """
        @brief Setup monitoring sensors
        """
        EDDPipeline.setup_sensors(self)

        self._edd_config_sensor = Sensor.string(
            "current-config",
            description="The current configuration for the EDD backend",
            default=json.dumps(DEFAULT_CONFIG, indent=4),
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._edd_config_sensor)

        self._output_rate_status = Sensor.float(
            "output-rate",
            description="Output data rate [Gbyte/s]",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._output_rate_status)

        self._polarization_sensors = {}
        for p in POLARIZATIONS:
            self._polarization_sensors[p] = {}
            self._polarization_sensors[p]["mkrecv_sensors"] = MkrecvSensors(p)
            for s in self._polarization_sensors[p][
                    "mkrecv_sensors"].sensors.itervalues():
                self.add_sensor(s)
            self._polarization_sensors[p][
                "input-buffer-fill-level"] = Sensor.float(
                    "input-buffer-fill-level-{}".format(p),
                    description=
                    "Fill level of the input buffer for polarization{}".format(
                        p),
                    params=[0, 1])
            self.add_sensor(
                self._polarization_sensors[p]["input-buffer-fill-level"])
            self._polarization_sensors[p][
                "input-buffer-total-write"] = Sensor.float(
                    "input-buffer-total-write-{}".format(p),
                    description=
                    "Total write into input buffer for polarization {}".format(
                        p),
                    params=[0, 1])

            self.add_sensor(
                self._polarization_sensors[p]["input-buffer-total-write"])
            self._polarization_sensors[p][
                "output-buffer-fill-level"] = Sensor.float(
                    "output-buffer-fill-level-{}".format(p),
                    description=
                    "Fill level of the output buffer for polarization {}".
                    format(p))
            self._polarization_sensors[p][
                "output-buffer-total-read"] = Sensor.float(
                    "output-buffer-total-read-{}".format(p),
                    description=
                    "Total read from output buffer for polarization {}".format(
                        p))
            self.add_sensor(
                self._polarization_sensors[p]["output-buffer-total-read"])
            self.add_sensor(
                self._polarization_sensors[p]["output-buffer-fill-level"])
Ejemplo n.º 25
0
    def setup_sensors(self):
        """
        @brief    Setup the default KATCP sensors.

        @note     As this call is made only upon an APSUSE configure call a mass inform
                  is required to let connected clients know that the proxy interface has
                  changed.
        """
        self._state_sensor = LoggingSensor.discrete(
            "state",
            description="Denotes the state of this APS instance",
            params=self.STATES,
            default=self.IDLE,
            initial_status=Sensor.NOMINAL)
        self._state_sensor.set_logger(self.log)
        self.add_sensor(self._state_sensor)

        self._fbf_sb_config_sensor = Sensor.string(
            "fbfuse-sb-config",
            description="The full FBFUSE schedule block configuration",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._fbf_sb_config_sensor)

        self._worker_configs_sensor = Sensor.string(
            "worker-configs",
            description="The configurations for each worker server",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._worker_configs_sensor)

        self._servers_sensor = Sensor.string(
            "servers",
            description="The worker server instances currently allocated to this product",
            default=",".join(["{s.hostname}:{s.port}".format(s=server) for server in self._servers]),
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._servers_sensor)

        self._data_rate_per_worker_sensor = Sensor.float(
            "data-rate-per-worker",
            description="The maximum ingest rate per APSUSE worker server",
            default=6e9,
            unit="bits/s",
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._data_rate_per_worker_sensor)

        self._current_recording_directory_sensor = Sensor.string(
            "current-recording-directory",
            description="The current directory for recording from this subarray",
            default="",
            initial_status=Sensor.UNKNOWN
            )
        self.add_sensor(self._current_recording_directory_sensor)

        self._current_recording_sensor = Sensor.string(
            "recording-params",
            description="The parameters of the current APSUSE recording",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._current_recording_sensor)

        self._parent.mass_inform(Message.inform('interface-changed'))
        self._state_sensor.set_value(self.READY)
Ejemplo n.º 26
0
    def setup_sensors(self):
        """
        @brief  Set up monitoring sensors.
        """
        self._device_status = Sensor.discrete(
            "device-status",
            description=json.dumps(
                dict(description="Health of device server",
                     valid_states=self.DEVICE_STATUSES)),
            params=self.DEVICE_STATUSES,
            default="ok",
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._device_status)

        self._current_time = Sensor.float(
            "current-time",
            description=json.dumps(dict(description="The current time", )),
            default=time.time(),
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._current_time)

        self._dummy_sensor = Sensor.string(
            "dummy-sensor",
            description=json.dumps(
                dict(description="A dummy sensor with a mutable value",
                     metadata={
                         "mysql_task_type": "DROPDOWN",
                         "options": {
                             "weee": 0,
                             "wooo": 1,
                             "wayhay": 2
                         },
                         "label": "Dummy Sensor Value"
                     },
                     setter="set-dummy-sensor-value",
                     timeout=30.0)),
            default="",
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._dummy_sensor)

        self._bool_sensor = Sensor.boolean(
            "bool-sensor",
            description=json.dumps(
                dict(description="A bool sensor with a mutable value",
                     metadata={"mysql_task_type": "BOOL"},
                     setter="set-bool-sensor-value",
                     timeout=30.0)),
            default=False,
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._bool_sensor)

        self._getset_sensor = Sensor.string(
            "getset-sensor",
            description=json.dumps(
                dict(description="A getset sensor with a mutable value",
                     metadata={"mysql_task_type": "GET_SET"},
                     setter="set-getset-sensor-value",
                     timeout=30.0)),
            default="A value!",
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._getset_sensor)
Ejemplo n.º 27
0
    def setup_sensors(self):
        """
        @brief    Set up monitoring sensors.

        Sensor list:
        - device-status
        - local-time-synced
        - fbf0-status
        - fbf1-status

        @note     The following sensors are made available on top of default
                  sensors implemented in AsynDeviceServer and its base classes.

                  device-status:      Reports the health status of the FBFUSE
                                      and associated devices:
                                      Among other things report HW failure, SW
                                      failure and observation failure.
        """
        self._device_status_sensor = Sensor.discrete(
            "device-status",
            description="Health status of FbfWorkerServer instance",
            params=self.DEVICE_STATUSES,
            default="ok",
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._device_status_sensor)

        self._state_sensor = LoggingSensor.discrete(
            "state",
            params=self.STATES,
            description="The current state of this worker instance",
            default=self.IDLE,
            initial_status=Sensor.NOMINAL)
        self._state_sensor.set_logger(log)
        self.add_sensor(self._state_sensor)

        self._capture_interface_sensor = Sensor.string(
            "capture-interface",
            description="The IP address of the NIC to be used for data capture",
            default=self._capture_interface,
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._capture_interface_sensor)

        self._delay_client_sensor = Sensor.string(
            "delay-engine-server",
            description="The address of the currently set delay engine",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._delay_client_sensor)

        self._antenna_capture_order_sensor = Sensor.string(
            "antenna-capture-order",
            description=
            "The order in which the worker will capture antennas internally",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._antenna_capture_order_sensor)

        self._mkrecv_header_sensor = Sensor.string(
            "mkrecv-capture-header",
            description=
            "The MKRECV/DADA header used for configuring capture with MKRECV",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._mkrecv_header_sensor)

        self._mksend_coh_header_sensor = Sensor.string(
            "mksend-coherent-beam-header",
            description=
            "The MKSEND/DADA header used for configuring transmission of coherent beam data",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._mksend_coh_header_sensor)

        self._mksend_incoh_header_sensor = Sensor.string(
            "mksend-incoherent-beam-header",
            description=
            "The MKSEND/DADA header used for configuring transmission of incoherent beam data",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._mksend_incoh_header_sensor)

        self._psrdada_cpp_args_sensor = Sensor.string(
            "psrdada-cpp-arguments",
            description="The command line arguments used to invoke psrdada_cpp",
            default="",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._psrdada_cpp_args_sensor)

        self._mkrecv_heap_loss = Sensor.float(
            "feng-heap-loss",
            description=("The percentage if F-engine heaps lost "
                         "(within MKRECV statistics window)"),
            default=0.0,
            initial_status=Sensor.UNKNOWN,
            unit="%")
        self.add_sensor(self._mkrecv_heap_loss)

        self._ingress_buffer_percentage = Sensor.float(
            "ingress-buffer-fill-level",
            description=("The percentage fill level for the capture"
                         "buffer between MKRECV and PSRDADA_CPP"),
            default=0.0,
            initial_status=Sensor.UNKNOWN,
            unit="%")
        self.add_sensor(self._ingress_buffer_percentage)

        self._cb_egress_buffer_percentage = Sensor.float(
            "cb-egress-buffer-fill-level",
            description=("The percentage fill level for the transmission"
                         "buffer between PSRDADA_CPP and MKSEND (for "
                         "coherent beams)"),
            default=0.0,
            initial_status=Sensor.UNKNOWN,
            unit="%")
        self.add_sensor(self._cb_egress_buffer_percentage)

        self._ib_egress_buffer_percentage = Sensor.float(
            "ib-egress-buffer-fill-level",
            description=("The percentage fill level for the transmission"
                         "buffer between PSRDADA_CPP and MKSEND (for "
                         "incoherent beams)"),
            default=0.0,
            initial_status=Sensor.UNKNOWN,
            unit="%")
        self.add_sensor(self._ib_egress_buffer_percentage)
Ejemplo n.º 28
0
  def setup_sensors_host (self, host, port):

    self.script.log(1, "KATCPServer::setup_sensors_host ("+host+","+port+")")
    sock = sockets.openSocket (DL, host, int(port), 1)

    if sock:
      self.script.log(2, "KATCPServer::setup_sensors_host sock.send(" + self.script.lmc_cmd + ")") 
      sock.send (self.script.lmc_cmd + "\r\n")
      lmc_reply = sock.recv (65536)
      sock.close()
      xml = xmltodict.parse(lmc_reply)
      self.script.log(2, "KATCPServer::setup_sensors_host sock.recv=" + str(xml))

      self._host_sensors = {}

      # Disk sensors
      self.script.log(2, "KATCPServer::setup_sensors_host configuring disk sensors")
      disk_prefix = host+".disk"
      self._host_sensors["disk_size"] = Sensor.float(disk_prefix+".size",
        description=host+": disk size",
        unit="MB",
        params=[8192,1e9],
        default=0)
      self._host_sensors["disk_available"] = Sensor.float(disk_prefix+".available",
        description=host+": disk available space",
        unit="MB",
        params=[1024,1e9],
        default=0)
      self.add_sensor(self._host_sensors["disk_size"])
      self.add_sensor(self._host_sensors["disk_available"])

      # Server Load sensors
      self.script.log(2, "KATCPServer::setup_sensors_host configuring load sensors")
      self._host_sensors["num_cores"] = Sensor.integer (host+".num_cores",
        description=host+": disk available space",
        unit="MB",
        params=[1,64],
        default=0)

      self._host_sensors["load1"] = Sensor.float(host+".load.1min",
        description=host+": 1 minute load ",
        unit="",
        default=0)

      self._host_sensors["load5"] = Sensor.float(host+".load.5min",
        description=host+": 5 minute load ",
        unit="",
        default=0)
      
      self._host_sensors["load15"] = Sensor.float(host+".load.15min",
        description=host+": 15 minute load ",
        unit="",
        default=0)

      self._host_sensors["local_time_synced"] = Sensor.boolean("local_time_synced",
        description=host+": NTP server synchronisation",
        unit="",
        default=0)

      self.add_sensor(self._host_sensors["num_cores"])
      self.add_sensor(self._host_sensors["num_cores"])
      self.add_sensor(self._host_sensors["load1"])
      self.add_sensor(self._host_sensors["load5"])
      self.add_sensor(self._host_sensors["load15"])
      self.add_sensor(self._host_sensors["local_time_synced"])

      cpu_temp_pattern  = re.compile("cpu[0-9]+_temp")
      fan_speed_pattern = re.compile("fan[0-9,a-z]+")
      power_supply_pattern = re.compile("ps[0-9]+_status")
        
      self.script.log(2, "KATCPServer::setup_sensors_host configuring other metrics")

      if not xml["lmc_reply"]["sensors"] == None:

        for sensor in xml["lmc_reply"]["sensors"]["metric"]:
          name = sensor["@name"]
          if name == "system_temp":
            self._host_sensors[name] = Sensor.float((host+".system_temp"),
              description=host+": system temperature",
              unit="C",
              params=[-20,150],
              default=0)
            self.add_sensor(self._host_sensors[name])

          if cpu_temp_pattern.match(name):
            (cpu, junk) = name.split("_")
            self._host_sensors[name] = Sensor.float((host+"." + name),
              description=host+": "+ cpu +" temperature",
              unit="C",
              params=[-20,150],
              default=0)
            self.add_sensor(self._host_sensors[name])

          if fan_speed_pattern.match(name):
            self._host_sensors[name] = Sensor.float((host+"." + name),
              description=host+": "+name+" speed",
              unit="RPM",
              params=[0,20000],
              default=0)
            self.add_sensor(self._host_sensors[name])

          if power_supply_pattern.match(name):
            self._host_sensors[name] = Sensor.boolean((host+"." + name),
              description=host+": "+name,
              unit="",
              default=0)
            self.add_sensor(self._host_sensors[name])

          # TODO consider adding power supply sensors: e.g.
          #   device-status-kronos1-powersupply1
          #   device-status-kronos1-powersupply2
          #   device-status-kronos2-powersupply1
          #   device-status-kronos2-powersupply2

          # TODO consider adding raid/disk sensors: e.g.
          #   device-status-<host>-raid
          #   device-status-<host>-raid-disk1
          #   device-status-<host>-raid-disk2

        self.script.log(2, "KATCPServer::setup_sensors_host done!")

      else:
        self.script.log(2, "KATCPServer::setup_sensors_host no sensors found")

    else:
      self.script.log(-2, "KATCPServer::setup_sensors_host: could not connect to LMC")
Ejemplo n.º 29
0
  def setup_sensors_host (self, host, port):

    self.script.log(2, "KATCPServer::setup_sensors_host ("+host+","+port+")")
    sock = sockets.openSocket (DL, host, int(port), 1)

    if sock:
      self.script.log(2, "KATCPServer::setup_sensors_host sock.send(" + self.script.lmc_cmd + ")") 
      sock.send (self.script.lmc_cmd + "\r\n")
      lmc_reply = sock.recv (65536)
      sock.close()
      xml = xmltodict.parse(lmc_reply)

      self._host_sensors = {}

      # Disk sensors
      self.script.log(2, "KATCPServer::setup_sensors_host configuring disk sensors")
      disk_prefix = host+".disk"
      self._host_sensors["disk_size"] = Sensor.float(disk_prefix+".size",
        description=host+": disk size",
        unit="MB",
        params=[8192,1e9],
        default=0)
      self._host_sensors["disk_available"] = Sensor.float(disk_prefix+".available",
        description=host+": disk available space",
        unit="MB",
        params=[1024,1e9],
        default=0)
      self.add_sensor(self._host_sensors["disk_size"])
      self.add_sensor(self._host_sensors["disk_available"])

      # Server Load sensors
      self.script.log(2, "KATCPServer::setup_sensors_host configuring load sensors")
      self._host_sensors["num_cores"] = Sensor.integer (host+".num_cores",
        description=host+": disk available space",
        unit="MB",
        params=[1,64],
        default=0)

      self._host_sensors["load1"] = Sensor.float(host+".load.1min",
        description=host+": 1 minute load ",
        unit="",
        default=0)

      self._host_sensors["load5"] = Sensor.float(host+".load.5min",
        description=host+": 5 minute load ",
        unit="",
        default=0)
      
      self._host_sensors["load15"] = Sensor.float(host+".load.15min",
        description=host+": 15 minute load ",
        unit="",
        default=0)

      self.add_sensor(self._host_sensors["num_cores"])
      self.add_sensor(self._host_sensors["load1"])
      self.add_sensor(self._host_sensors["load5"])
      self.add_sensor(self._host_sensors["load15"])

      cpu_temp_pattern  = re.compile("cpu[0-9]+_temp")
      fan_speed_pattern = re.compile("fan[0-9,a-z]+")
      power_supply_pattern = re.compile("ps[0-9]+_status")
        
      self.script.log(2, "KATCPServer::setup_sensors_host configuring other metrics")

      if not xml["lmc_reply"]["sensors"] == None:

        for sensor in xml["lmc_reply"]["sensors"]["metric"]:
          name = sensor["@name"]
          if name == "system_temp":
            self._host_sensors[name] = Sensor.float((host+".system_temp"),
              description=host+": system temperature",
              unit="C",
              params=[-20,150],
              default=0)
            self.add_sensor(self._host_sensors[name])

          if cpu_temp_pattern.match(name):
            (cpu, junk) = name.split("_")
            self._host_sensors[name] = Sensor.float((host+"." + name),
              description=host+": "+ cpu +" temperature",
              unit="C",
              params=[-20,150],
              default=0)
            self.add_sensor(self._host_sensors[name])

          if fan_speed_pattern.match(name):
            self._host_sensors[name] = Sensor.float((host+"." + name),
              description=host+": "+name+" speed",
              unit="RPM",
              params=[0,20000],
              default=0)
            self.add_sensor(self._host_sensors[name])

          if power_supply_pattern.match(name):
            self._host_sensors[name] = Sensor.boolean((host+"." + name),
              description=host+": "+name,
              unit="",
              default=0)
            self.add_sensor(self._host_sensors[name])

          # TODO consider adding power supply sensors: e.g.
          #   device-status-kronos1-powersupply1
          #   device-status-kronos1-powersupply2
          #   device-status-kronos2-powersupply1
          #   device-status-kronos2-powersupply2

          # TODO consider adding raid/disk sensors: e.g.
          #   device-status-<host>-raid
          #   device-status-<host>-raid-disk1
          #   device-status-<host>-raid-disk2

        self.script.log(2, "KATCPServer::setup_sensors_host done!")

      else:
        self.script.log(2, "KATCPServer::setup_sensors_host no sensors found")

    else:
      self.script.log(-2, "KATCPServer::setup_sensors_host: could not connect to LMC")
Ejemplo n.º 30
0
    def setup_sensors(self):
        # Position sensors
        self._SCM_request_azim = Sensor.float("SCM.request-azim", "Sky-space requested azimuth position.", "Degrees CW of north")
        self.add_sensor(self._SCM_request_azim)

        self._SCM_request_elev = Sensor.float("SCM.request-elev", "Sky-space requested elevation position.", "Degrees CW of north")
        self.add_sensor(self._SCM_request_elev)

        self._SCM_desired_azim = Sensor.float("SCM.desired-azim", "Sky-space desired azimuth position.", "Degrees CW of north")
        self.add_sensor(self._SCM_desired_azim)

        self._SCM_desired_elev = Sensor.float("SCM.desired-elev", "Sky-space desired elevation position.", "Degrees CW of north")
        self.add_sensor(self._SCM_desired_elev)

        self._SCM_actual_azim = Sensor.float("SCM.actual-azim", "Sky-space actual azimuth position.", "Degrees CW of north")
        self.add_sensor(self._SCM_actual_azim)

        self._SCM_actual_elev = Sensor.float("SCM.actual-elev", "Sky-space actual elevation position.", "Degrees CW of north")
        self.add_sensor(self._SCM_actual_elev)

        # Pointing model
        self._SCM_pmodel1 = Sensor.float("SCM.pmodel1", "Pointing model parameter 1")
        self.add_sensor(self._SCM_pmodel1)
        self._SCM_pmodel2 = Sensor.float("SCM.pmodel2", "Pointing model parameter 2")
        self.add_sensor(self._SCM_pmodel2)
        self._SCM_pmodel3 = Sensor.float("SCM.pmodel3", "Pointing model parameter 3")
        self.add_sensor(self._SCM_pmodel3)
        self._SCM_pmodel4 = Sensor.float("SCM.pmodel4", "Pointing model parameter 4")
        self.add_sensor(self._SCM_pmodel4)
        self._SCM_pmodel5 = Sensor.float("SCM.pmodel5", "Pointing model parameter 5")
        self.add_sensor(self._SCM_pmodel5)
        self._SCM_pmodel6 = Sensor.float("SCM.pmodel6", "Pointing model parameter 6")
        self.add_sensor(self._SCM_pmodel6)
        self._SCM_pmodel7 = Sensor.float("SCM.pmodel7", "Pointing model parameter 7")
        self.add_sensor(self._SCM_pmodel7)
        self._SCM_pmodel8 = Sensor.float("SCM.pmodel8", "Pointing model parameter 8")
        self.add_sensor(self._SCM_pmodel8)
        self._SCM_pmodel9 = Sensor.float("SCM.pmodel9", "Pointing model parameter 9")
        self.add_sensor(self._SCM_pmodel9)
        self._SCM_pmodel10 = Sensor.float("SCM.pmodel10", "Pointing model parameter 10")
        self.add_sensor(self._SCM_pmodel10)
        self._SCM_pmodel11 = Sensor.float("SCM.pmodel11", "Pointing model parameter 11")
        self.add_sensor(self._SCM_pmodel11)
        self._SCM_pmodel12 = Sensor.float("SCM.pmodel12", "Pointing model parameter 12")
        self.add_sensor(self._SCM_pmodel12)
        self._SCM_pmodel13 = Sensor.float("SCM.pmodel13", "Pointing model parameter 13")
        self.add_sensor(self._SCM_pmodel13)
        self._SCM_pmodel14= Sensor.float("SCM.pmodel14", "Pointing model parameter 14")
        self.add_sensor(self._SCM_pmodel14)
        self._SCM_pmodel15= Sensor.float("SCM.pmodel15", "Pointing model parameter 15")
        self.add_sensor(self._SCM_pmodel15)
        self._SCM_pmodel16 = Sensor.float("SCM.pmodel16", "Pointing model parameter 16")
        self.add_sensor(self._SCM_pmodel16)
        self._SCM_pmodel17 = Sensor.float("SCM.pmodel17", "Pointing model parameter 17")
        self.add_sensor(self._SCM_pmodel17)
        self._SCM_pmodel18 = Sensor.float("SCM.pmodel18", "Pointing model parameter 18")
        self.add_sensor(self._SCM_pmodel18)
        self._SCM_pmodel19 = Sensor.float("SCM.pmodel19", "Pointing model parameter 19")
        self.add_sensor(self._SCM_pmodel19)
        self._SCM_pmodel20 = Sensor.float("SCM.pmodel20", "Pointing model parameter 20")
        self.add_sensor(self._SCM_pmodel20)
        self._SCM_pmodel21 = Sensor.float("SCM.pmodel21", "Pointing model parameter 21")
        self.add_sensor(self._SCM_pmodel21)
        self._SCM_pmodel22 = Sensor.float("SCM.pmodel22", "Pointing model parameter 22")
        self.add_sensor(self._SCM_pmodel22)
        self._SCM_pmodel23 = Sensor.float("SCM.pmodel23", "Pointing model parameter 23")
        self.add_sensor(self._SCM_pmodel23)
        self._SCM_pmodel24 = Sensor.float("SCM.pmodel24", "Pointing model parameter 24")
        self.add_sensor(self._SCM_pmodel24)
        self._SCM_pmodel25 = Sensor.float("SCM.pmodel25", "Pointing model parameter 25")
        self.add_sensor(self._SCM_pmodel25)
        self._SCM_pmodel26 = Sensor.float("SCM.pmodel26", "Pointing model parameter 26")
        self.add_sensor(self._SCM_pmodel26)
        self._SCM_pmodel27 = Sensor.float("SCM.pmodel27", "Pointing model parameter 27")
        self.add_sensor(self._SCM_pmodel27)
        self._SCM_pmodel28 = Sensor.float("SCM.pmodel28", "Pointing model parameter 28")
        self.add_sensor(self._SCM_pmodel28)
        self._SCM_pmodel29 = Sensor.float("SCM.pmodel29", "Pointing model parameter 29")
        self.add_sensor(self._SCM_pmodel29)
        self._SCM_pmodel30 = Sensor.float("SCM.pmodel30", "Pointing model parameter 30")
        self.add_sensor(self._SCM_pmodel30)

        # # Target
        self._SCM_Target = Sensor.string("SCM.Target", "Target description string in katpoint format")
        self.add_sensor(self._SCM_Target)

        # Antenna activity
        self._SCM_Antenna_Activity = Sensor.string("SCM.AntennaActivity", "Antenna activity label")
        self.add_sensor(self._SCM_Antenna_Activity)

        # RF sensor information
        self._SCM_LcpAttenuation = Sensor.float("SCM.LcpAttenuation", "Variable attenuator setting on LCP")
        self.add_sensor(self._SCM_LcpAttenuation)
        self._SCM_RcpAttenuation = Sensor.float("SCM.RcpAttenuation", "Variable attenuator setting on RCP")
        self.add_sensor(self._SCM_RcpAttenuation)
        self._RFC_LcpFreqSel = Sensor.boolean("RFC.LcpFreqSel", "LCP Frequency Select Switch")
        self.add_sensor(self._RFC_LcpFreqSel)
        self._RFC_RcpFreqSel = Sensor.boolean("RFC.RcpFreqSel", "RCP Frequency Select Switch")
        self.add_sensor(self._RFC_RcpFreqSel)
        self._RFC_IntermediateStage_5GHz = Sensor.float("RFC.IntermediateStage_5GHz", "5 GHz Intermediate Stage LO frequency")
        self.add_sensor(self._RFC_IntermediateStage_5GHz)
        self._RFC_IntermediateStage_6_7GHz = Sensor.float("RFC.IntermediateStage_6_7GHz", "6.7 GHz Intermediate Stage LO frequency")
        self.add_sensor(self._RFC_IntermediateStage_6_7GHz)
        self._RFC_FinalStage = Sensor.float("RFC.FinalStage", "Final Stage LO frequency")
        self.add_sensor(self._RFC_FinalStage)

        # Noise diode sensor information
        self._RFC_NoiseDiode_1 = Sensor.integer("RFC.NoiseDiode_1", "All noise diode data (bitfield)")
        self.add_sensor(self._RFC_NoiseDiode_1)

        # EMS information
        self._EMS_WindDirection = Sensor.float("EMS.WindDirection", "Wind direction")
        self.add_sensor(self._EMS_WindDirection)
        self._EMS_WindSpeed = Sensor.float("EMS.WindSpeed", "Wind speed")
        self.add_sensor(self._EMS_WindSpeed)
        self._EMS_AirTemperature = Sensor.float("EMS.AirTemperature", "Air temperature")
        self.add_sensor(self._EMS_AirTemperature)
        self._EMS_AbsolutePressure = Sensor.float("EMS.AbsolutePressure", "Air pressure")
        self.add_sensor(self._EMS_AbsolutePressure)
        self._EMS_RelativeHumidity = Sensor.float("EMS.RelativeHumidity", "Ambient relative humidity")
        self.add_sensor(self._EMS_RelativeHumidity)

        self.animation_thread = threading.Thread(target=self.sensor_value_thread_function)
        self.animation_thread.start()
Ejemplo n.º 31
0
    def setup_sensors(self):
        """
        @brief Setup monitoring sensors
        """
        EDDPipeline.setup_sensors(self)
        self._tscrunch = Sensor.string("tscrunch_PNG",
                                       description="tscrunch png",
                                       default=BLANK_IMAGE,
                                       initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._tscrunch)

        self._fscrunch = Sensor.string("fscrunch_PNG",
                                       description="fscrunch png",
                                       default=BLANK_IMAGE,
                                       initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._fscrunch)

        self._profile = Sensor.string("profile_PNG",
                                      description="pulse profile png",
                                      default=BLANK_IMAGE,
                                      initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._profile)

        self._central_freq = Sensor.string("_central_freq",
                                           description="_central_freq",
                                           default="N/A",
                                           initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._central_freq)

        self._source_name_sensor = Sensor.string("target_name",
                                                 description="target name",
                                                 default="N/A",
                                                 initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._source_name_sensor)

        self._nchannels = Sensor.string("_nchannels",
                                        description="_nchannels",
                                        default="N/A",
                                        initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._nchannels)

        self._nbins = Sensor.string("_nbins",
                                    description="_nbins",
                                    default="N/A",
                                    initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._nbins)

        self._time_processed = Sensor.string("_time_processed",
                                             description="_time_processed",
                                             default=0,
                                             initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._time_processed)

        self._dm_sensor = Sensor.string("_source_dm",
                                        description="_source_dm",
                                        default=0,
                                        initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._dm_sensor)

        self._par_dict_sensor = Sensor.string("_par_dict_sensor",
                                              description="_par_dict_sensor",
                                              default="N/A",
                                              initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._par_dict_sensor)
        self._directory_size_sensor = Sensor.string(
            "_directory_size_sensor",
            description="_directory_size_sensor",
            default=0,
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._directory_size_sensor)
        self._input_buffer_fill_level = Sensor.float(
            "input-buffer-fill-level",
            description="Fill level of the input buffer",
            params=[0, 1])
        self.add_sensor(self._input_buffer_fill_level)

        self._input_buffer_total_write = Sensor.float(
            "input-buffer-total-write",
            description="Total write into input buffer ",
            params=[0, 1])
        self.add_sensor(self._input_buffer_total_write)

        self._output_buffer_fill_level = Sensor.float(
            "output-buffer-fill-level",
            description="Fill level of the output buffer")
        self.add_sensor(self._output_buffer_fill_level)
        self._output_buffer_total_read = Sensor.float(
            "output-buffer-total-read",
            description="Total read from output buffer")
        self.add_sensor(self._output_buffer_total_read)

        self._polarization_sensors = {}
    def setup_sensors(self):
        """
        @brief    Setup the default KATCP sensors.

        @note     As this call is made only upon an FBFUSE configure call a mass inform
                  is required to let connected clients know that the proxy interface has
                  changed.
        """
        self._state_sensor = LoggingSensor.discrete(
            "state",
            description = "Denotes the state of this FBF instance",
            params = self.STATES,
            default = self.IDLE,
            initial_status = Sensor.NOMINAL)
        self._state_sensor.set_logger(self.log)
        self.add_sensor(self._state_sensor)

        self._ca_address_sensor = Sensor.string(
            "configuration-authority",
            description = "The address of the server that will be deferred to for configurations",
            default = "",
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._ca_address_sensor)

        self._available_antennas_sensor = Sensor.string(
            "available-antennas",
            description = "The antennas that are currently available for beamforming",
            default = json.dumps({antenna.name:antenna.format_katcp() for antenna in self._katpoint_antennas}),
            initial_status = Sensor.NOMINAL)
        self.add_sensor(self._available_antennas_sensor)

        self._phase_reference_sensor = Sensor.string(
            "phase-reference",
            description="A KATPOINT target string denoting the F-engine phasing centre",
            default="unset,radec,0,0",
            initial_status=Sensor.UNKNOWN)
        self.add_sensor(self._phase_reference_sensor)

        reference_antenna = Antenna("reference,{ref.lat},{ref.lon},{ref.elev}".format(
            ref=self._katpoint_antennas[0].ref_observer))
        self._reference_antenna_sensor = Sensor.string(
            "reference-antenna",
            description="A KATPOINT antenna string denoting the reference antenna",
            default=reference_antenna.format_katcp(),
            initial_status=Sensor.NOMINAL)
        self.add_sensor(self._reference_antenna_sensor)

        self._bandwidth_sensor = Sensor.float(
            "bandwidth",
            description = "The bandwidth this product is configured to process",
            default = self._default_sb_config['bandwidth'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._bandwidth_sensor)

        self._nchans_sensor = Sensor.integer(
            "nchannels",
            description = "The number of channels to be processesed",
            default = self._n_channels,
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._nchans_sensor)

        self._cfreq_sensor = Sensor.float(
            "centre-frequency",
            description = "The centre frequency of the band this product configured to process",
            default = self._default_sb_config['centre-frequency'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cfreq_sensor)

        self._cbc_nbeams_sensor = Sensor.integer(
            "coherent-beam-count",
            description = "The number of coherent beams that this FBF instance can currently produce",
            default = self._default_sb_config['coherent-beams-nbeams'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_nbeams_sensor)

        self._cbc_nbeams_per_group = Sensor.integer(
            "coherent-beam-count-per-group",
            description = "The number of coherent beams packed into a multicast group",
            default = 1,
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_nbeams_per_group)

        self._cbc_ngroups = Sensor.integer(
            "coherent-beam-ngroups",
            description = "The number of multicast groups used for coherent beam transmission",
            default = 1,
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_ngroups)

        self._cbc_nbeams_per_server_set = Sensor.integer(
            "coherent-beam-nbeams-per-server-set",
            description = "The number of beams produced by each server set",
            default = 1,
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_nbeams_per_server_set)

        self._cbc_tscrunch_sensor = Sensor.integer(
            "coherent-beam-tscrunch",
            description = "The number time samples that will be integrated when producing coherent beams",
            default = self._default_sb_config['coherent-beams-tscrunch'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_tscrunch_sensor)

        self._cbc_fscrunch_sensor = Sensor.integer(
            "coherent-beam-fscrunch",
            description = "The number frequency channels that will be integrated when producing coherent beams",
            default = self._default_sb_config['coherent-beams-fscrunch'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_fscrunch_sensor)

        self._cbc_antennas_sensor = Sensor.string(
            "coherent-beam-antennas",
            description = "The antennas that will be used when producing coherent beams",
            default = self._default_sb_config['coherent-beams-antennas'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_antennas_sensor)

        self._cbc_mcast_groups_sensor = Sensor.string(
            "coherent-beam-multicast-groups",
            description = "Multicast groups used by this instance for sending coherent beam data",
            default = "",
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_mcast_groups_sensor)

        self._cbc_mcast_groups_mapping_sensor = Sensor.string(
            "coherent-beam-multicast-group-mapping",
            description = "Mapping of mutlicast group address to the coherent beams in that group",
            default= "",
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._cbc_mcast_groups_mapping_sensor)

        self._ibc_nbeams_sensor = Sensor.integer(
            "incoherent-beam-count",
            description = "The number of incoherent beams that this FBF instance can currently produce",
            default = 1,
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._ibc_nbeams_sensor)

        self._ibc_tscrunch_sensor = Sensor.integer(
            "incoherent-beam-tscrunch",
            description = "The number time samples that will be integrated when producing incoherent beams",
            default = self._default_sb_config['incoherent-beam-tscrunch'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._ibc_tscrunch_sensor)

        self._ibc_fscrunch_sensor = Sensor.integer(
            "incoherent-beam-fscrunch",
            description = "The number frequency channels that will be integrated when producing incoherent beams",
            default = self._default_sb_config['incoherent-beam-fscrunch'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._ibc_fscrunch_sensor)

        self._ibc_antennas_sensor = Sensor.string(
            "incoherent-beam-antennas",
            description = "The antennas that will be used when producing incoherent beams",
            default = self._default_sb_config['incoherent-beam-antennas'],
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._ibc_antennas_sensor)

        self._ibc_mcast_group_sensor = Sensor.string(
            "incoherent-beam-multicast-group",
            description = "Multicast group used by this instance for sending incoherent beam data",
            default = "",
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._ibc_mcast_group_sensor)

        self._servers_sensor = Sensor.string(
            "servers",
            description = "The worker server instances currently allocated to this product",
            default = ",".join(["{s.hostname}:{s.port}".format(s=server) for server in self._servers]),
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._servers_sensor)

        self._nserver_sets_sensor = Sensor.integer(
            "nserver-sets",
            description = "The number of server sets (independent subscriptions to the F-engines)",
            default = 1,
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._nserver_sets_sensor)

        self._nservers_per_set_sensor = Sensor.integer(
            "nservers-per-set",
            description = "The number of servers per server set",
            default = 1,
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._nservers_per_set_sensor)

        self._delay_config_server_sensor = Sensor.string(
            "delay-config-server",
            description = "The address of the delay configuration server for this product",
            default = "",
            initial_status = Sensor.UNKNOWN)
        self.add_sensor(self._delay_config_server_sensor)