Return server uptime.
502919
def runtime(self):
        """"""
        if self._start_time is None:
            return self._run_time
        else:
            return self._run_time + (time.time() - self._start_time)
739594
def request_time(self) -> float:
        """"""
        if self._finish_time is None:
            return time.time() - self._start_time
        else:
            return self._finish_time - self._start_time
992075
def table_server_timings():
    """"""
    table_data = [
        [Color('{autogreen}<10ms{/autogreen}'), '192.168.0.100, 192.168.0.101'],
        [Color('{autoyellow}10ms <= 100ms{/autoyellow}'), '192.168.0.102, 192.168.0.103'],
        [Color('{autored}>100ms{/autored}'), '192.168.0.105'],
    ]
    table_instance = SingleTable(table_data)
    table_instance.inner_heading_row_border = False
    return table_instance.table
445096
def all_status():
    '''
    
    '''
    return {'cpuinfo': cpuinfo(),
            'cpustats': cpustats(),
            'diskstats': diskstats(),
            'diskusage': diskusage(),
            'loadavg': loadavg(),
            'meminfo': meminfo(),
            'netdev': netdev(),
            'netstats': netstats(),
            'uptime': uptime(),
            'vmstats': vmstats(),
            'w': w()}
550865
function getServer() {
  var o = {}
    , uptime = process.uptime()
  o.version = this.version;
  o.os = process.platform;
  o.arch = process.arch;
  o.process_id = process.pid;

  o.tcp_port = this.state.addr && this.state.addr.port
    ? this.state.addr.port : NA;

  o.uptime_in_seconds = uptime;
  o.uptime_in_days = Math.floor(uptime / DAY_SECS);
  o.hz = this.conf.get(ConfigKey.HZ);
  o.config_file = this.conf.isDefault() ? '' : this.conf.getFile();
  return o;
}
62993
def uptime
      @uptime ||= if (uptime = @node.at_xpath('uptime'))
                    Uptime.new(
                      uptime['seconds'].to_i,
                      Time.parse(uptime['lastboot'])
                    )
                  end

      yield @uptime if (@uptime && block_given?)
      return @uptime
    end
814105
def update(self):
        """"""
        if self.client_mode == 'glances':
            return self.update_glances()
        elif self.client_mode == 'snmp':
            return self.update_snmp()
        else:
            self.end()
            logger.critical("Unknown server mode: {}".format(self.client_mode))
            sys.exit(2)
345544
def _get_uptime(self, app_stats):
        
        if "program_start" not in app_stats.keys():
            return 0

        if not app_stats["program_start"].isdigit():
            return 0

        uptime = int(time.time()) - int(app_stats["program_start"])
        if uptime < 0:
            return 0

        return uptime
925433
def _get_next_server(self):
        """"""

        current_try = 0
        max_tries = len(self._servers)

        while current_try < max_tries:

            server_index = self._raise_server_index()
            server = self._servers[server_index]
            down_until = server['down_until']

            self._logger.debug('Checking server ' + str(current_try + 1) + '/' + str(max_tries) + ': ' + server['url'])

            if down_until == 0:
                self._logger.debug('Elected server: ' + server['url'])
                return server

            if down_until < time.time():
                if self._is_reachable(server):
                    server['down_until'] = 0
                    self._logger.debug('Elected server: ' + server['url'])

                    return server
                else:
                    self._logger.debug('Server still unavailable: ' + server['url'])
                    server['down_until'] = time.time() + 5

            current_try += 1

        raise TransportException('Cannot reach any redis server')
735097
def sys_up_time
      varbind = @varbind_list[0]
      if varbind && (varbind.name == SYS_UP_TIME_OID)
        return varbind.value
      else
        raise InvalidTrapVarbind, "Expected sysUpTime.0, found " + varbind.to_s
      end
    end
363911
def _get_server(self):
        
        with self._lock:
            inactive_server_count = len(self._inactive_servers)
            for i in range(inactive_server_count):
                try:
                    ts, server, message = heapq.heappop(self._inactive_servers)
                except IndexError:
                    pass
                else:
                    if (ts + self.retry_interval) > time():
                        # Not yet, put it back
                        heapq.heappush(self._inactive_servers,
                                       (ts, server, message))
                    else:
                        self._active_servers.append(server)
                        logger.warn("Restored server %s into active pool",
                                    server)

            # if none is old enough, use oldest
            if not self._active_servers:
                ts, server, message = heapq.heappop(self._inactive_servers)
                self._active_servers.append(server)
                logger.info("Restored server %s into active pool", server)

            server = self._active_servers[0]
            self._roundrobin()

            return server
871888
private function _uptime()
    {

        if (CommonFunctions::executeProgram('pidin', 'info', $buf)
           && preg_match('/^.* BootTime:(.*)/', $buf, $bstart)
           && CommonFunctions::executeProgram('date', '', $bstop)) {
            /* default error handler */
            if (function_exists('errorHandlerPsi')) {
                restore_error_handler();
            }
            /* fatal errors only */
            $old_err_rep = error_reporting();
            error_reporting(E_ERROR);

            $uptime = strtotime($bstop)-strtotime($bstart[1]);
            if ($uptime > 0) $this->sys->setUptime($uptime);

            /* restore error level */
            error_reporting($old_err_rep);
            /* restore error handler */
            if (function_exists('errorHandlerPsi')) {
                set_error_handler('errorHandlerPsi');
            }
        }
    }
728904
def get_restored(self):
        """"""
        return self._header.initial.restore_time > 0, self._header.initial.restore_time
1353820
def getUptime(self):
        
        try:
            fp = open(uptimeFile, 'r')
            line = fp.readline()
            fp.close()
        except:
            raise IOError('Failed reading stats from file: %s' % uptimeFile)
        return float(line.split()[0])
1052786
def _parse_uptime_string(self, uptime):
        
        uptime = uptime.strip()
        load_averages = uptime[uptime.find('load average:') :].split(':')[1].strip().split(',')
        load_averages = [float(load_avg) for load_avg in load_averages]
        return load_averages
1193719
def get_result(self):
        """"""
        result = get_json_from_remote_server(self.call)
        seconds = self._get_average_duration(result) if result else 0
        return stringify_seconds(seconds)
735252
private function _uptime()
    {
        if (CommonFunctions::executeProgram('uptime', '', $buf)) {
            if (preg_match("/up (\d+) day[s]?,\s*(\d+):(\d+),/", $buf, $ar_buf)) {
                $min = $ar_buf[3];
                $hours = $ar_buf[2];
                $days = $ar_buf[1];
                $this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
            } elseif (preg_match("/up (\d+):(\d+),/", $buf, $ar_buf)) {
                $min = $ar_buf[2];
                $hours = $ar_buf[1];
                $this->sys->setUptime($hours * 3600 + $min * 60);
            }
        }
    }