Stop Ixia traffic flows and gather Ixia stats
340753
def run_stats_gather
      stats_tcl = File.open("/var/tmp/stats-#{@buildtime}", 'w')
      stats_tcl.write finish
      stats_tcl.close
      system "#@ixia_exe /var/tmp/stats-#{@buildtime}"
      File.delete stats_tcl
      ftp = Net::FTP.new(@host)
      ftp.login
      file = "#{@csv_file}.csv"
      Dir.chdir "#{$log_path}/ixia" do
        ftp.get "Reports/#{file}"
      end
      ftp.delete "Reports/#{file}"
      ftp.delete "Reports/#{file}.columns"
      ftp.close
      CSV.read("#{$log_path}/ixia/#{file}", headers: true)
    end
156533
function(action, variation, payload, throttle) {
          OT.analytics.logEvent({
            action: action,
            variation: variation,
            payload: payload,
            'sessionId': _session ? _session.sessionId : null,
            'connectionId': _session &&
              _session.isConnected() ? _session.connection.connectionId : null,
            'partnerId': _session ? _session.apiKey : OT.APIKEY,
            streamId: _streamId
          }, throttle);
        }
876165
def _clear_stats(self):
        
        for stat in (STAT_BYTES_RECEIVED,
                     STAT_BYTES_SENT,
                     STAT_MSG_RECEIVED,
                     STAT_MSG_SENT,
                     STAT_CLIENTS_MAXIMUM,
                     STAT_CLIENTS_CONNECTED,
                     STAT_CLIENTS_DISCONNECTED,
                     STAT_PUBLISH_RECEIVED,
                     STAT_PUBLISH_SENT):
            self._stats[stat] = 0
403912
public synchronized void stop() {
        if (!monitorActive) {
            return;
        }
        monitorActive = false;
        resetAccounting(milliSecondFromNano());
        if (trafficShapingHandler != null) {
            trafficShapingHandler.doAccounting(this);
        }
        if (scheduledFuture != null) {
            scheduledFuture.cancel(true);
        }
    }
626726
def start_traffic(self, blocking=False, *ports):
        

        for chassis, chassis_ports in self._per_chassis_ports(*self._get_operation_ports(*ports)).items():
            chassis.start_traffic(False, *chassis_ports)
        if blocking:
            for chassis, chassis_ports in self._per_chassis_ports(*self._get_operation_ports(*ports)).items():
                chassis.wait_traffic(*chassis_ports)
90825
def stop(self, handle, reason=None):
        """"""
        params = self._get_params(reason=reason)
        self._transport.stop(handle, params)
1091676
def stop(self):
        

        instance_status = Instance.InstanceStatus(status='Terminated')
        xml_content = instance_status.serialize()

        headers = {'Content-Type': 'application/xml'}
        self._client.put(self.resource(), xml_content, headers=headers)
687849
def commit_signal(data_id):
    """"""
    if not getattr(settings, 'FLOW_MANAGER_DISABLE_AUTO_CALLS', False):
        immediate = getattr(settings, 'FLOW_MANAGER_SYNC_AUTO_CALLS', False)
        async_to_sync(manager.communicate)(data_id=data_id, save_settings=False, run_sync=immediate)
1239434
def dump_stats(self):
        """"""
        log.info('Dumping statistics:')
        stats = []
        stats.append(
            'client-request-errors {}'.format(self._client_request_errors))
        stats.append('denied-allocations {}'.format(self._denied_allocations))
        stats.append('num-ports-managed {}'.format(self._port_pool.num_ports()))
        stats.append('num-ports-checked-for-last-request {}'.format(
            self._port_pool.ports_checked_for_last_request))
        stats.append('total-allocations {}'.format(self._total_allocations))
        for stat in stats:
            log.info(stat)
447827
def on_sigabrt(self, signal_unused, frame_unused):
        
        LOGGER.info('Stopping HTTP Server and IOLoop')
        self.http_server.stop()
        self.ioloop.stop()
1182688
def cli(obj, ids, query, filters, tags):
    """"""
    client = obj['client']
    if ids:
        total = len(ids)
    else:
        if query:
            query = [('q', query)]
        else:
            query = build_query(filters)
        total, _, _ = client.get_count(query)
        ids = [a.id for a in client.get_alerts(query)]

    with click.progressbar(ids, label='Untagging {} alerts'.format(total)) as bar:
        for id in bar:
            client.untag_alert(id, tags)
628677
def collect(self):
        
        if not os.access(self.config["bin"], os.X_OK):
            self.log.error("Path %s does not exist or is not executable",
                           self.config["bin"])
            return {}

        dict_stats = self.get_passenger_memory_stats()
        if len(dict_stats.keys()) == 0:
            return {}

        queue_stats = self.get_passenger_queue_stats()
        if len(queue_stats.keys()) == 0:
            return {}

        overall_cpu = self.get_passenger_cpu_usage(dict_stats)
        if overall_cpu >= 0:
            self.publish("phusion_passenger_cpu", overall_cpu)

        self.publish("total_passenger_procs", len(
            dict_stats["passenger_procs"]))
        self.publish("total_nginx_procs", len(dict_stats["nginx_procs"]))
        self.publish("total_apache_procs", len(dict_stats["apache_procs"]))
        self.publish("total_apache_memory", dict_stats["apache_mem_total"])
        self.publish("total_nginx_memory", dict_stats["nginx_mem_total"])
        self.publish("total_passenger_memory",
                     dict_stats["passenger_mem_total"])
        self.publish("top_level_queue_size", queue_stats[
                     "top_level_queue_size"])
        self.publish("passenger_queue_size", queue_stats[
                     "passenger_queue_size"])
959408
def stop(self):
        """"""
        self.state = STATE_STOPPED
        if self.transport:
            self.transport.close()
716658
def stop_traffic(self, *ports):
        

        for chassis, chassis_ports in self._per_chassis_ports(*self._get_operation_ports(*ports)).items():
            chassis.stop_traffic(*chassis_ports)
1313341
def gather_data(registry):
    """"""

    # Get the host name of the machine
    host = socket.gethostname()

    # Create our collectors
    io_metric = Summary("write_file_io_example",
                        "Writing io file in disk example.",
                        {'host': host})

    # register the metric collectors
    registry.register(io_metric)
    chunk = b'\xff'*4000  # 4000 bytes
    filename_path = "/tmp/prometheus_test"
    blocksizes = (100, 10000, 1000000, 100000000)

    # Start gathering metrics every 0.7 seconds
    while True:
        time.sleep(0.7)

        for i in blocksizes:
            time_start = time.time()
            # Action
            with open(filename_path, "wb") as f:
                for _ in range(i // 10000):
                    f.write(chunk)

            io_metric.add({"file": filename_path, "block": i},
                          time.time() - time_start)
1089258
def stop(self):
        """"""

        for tile in self._tiles.values():
            tile.signal_stop()

        for tile in self._tiles.values():
            tile.wait_stopped()

        super(TileBasedVirtualDevice, self).stop()
1343251
public void stop()
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "stop");
        ivIsInitialized = false;
        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "stop");
    }