Parse NGINX stub status into StatusData&lt;NginxMetrics&gt;.
@param nginxStatus retrieved stub status.
@return parsed metrics, put into StatusData.
424547
public StatusData<NginxMetrics> parse(String nginxStatus) {
        StatusData<NginxMetrics> status = new StatusData<>();
        if (StringUtils.isEmpty(nginxStatus)) {
            throw new IllegalArgumentException("nginx status is empty!");
        } else {
            Matcher matcher = pattern.matcher(nginxStatus);
            if (matcher.matches()) {
                status.put(NginxMetrics.ACTIVE, Long.parseLong(matcher.group(1)));
                Long accepted = Long.parseLong(matcher.group(2));
                status.put(NginxMetrics.ACCEPTED, accepted);
                status.put(NginxMetrics.ACCEPTEDPERSECOND, accepted);
                Long handled = Long.parseLong(matcher.group(3));
                status.put(NginxMetrics.HANDLED, handled);
                status.put(NginxMetrics.HANDLEDPERSECOND, handled);
                Long dropped = handled - accepted;
                status.put(NginxMetrics.DROPPED, dropped);
                status.put(NginxMetrics.DROPPEDPERSECOND, dropped);
                Long requests = Long.parseLong(matcher.group(4));
                status.put(NginxMetrics.REQUESTS, requests);
                status.put(NginxMetrics.REQUESTSPERSECOND, requests);
                status.put(NginxMetrics.READING, Long.parseLong(matcher.group(5)));
                status.put(NginxMetrics.WRITING, Long.parseLong(matcher.group(6)));
                status.put(NginxMetrics.WAITING, Long.parseLong(matcher.group(7)));
            } else {
                String message = "NginxStubStatusParser can't parse nginx status response: ["+nginxStatus + "]";
                throw new IllegalArgumentException(message);
            }
        }
        return status;
    }
818437
public function create(OpportunityStatus $opportunityStatus): OpportunityStatus
    {
        $response = $this->client->post($this->prepareUrlForKey('add-status'), [], $opportunityStatus->jsonSerialize());
        $responseData = $response->getDecodedBody();

        return new OpportunityStatus($responseData);
    }
70730
@GET
  @Path("/loadStatus")
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.APPLICATION_JSON)
  @ResourceFilters(BasicSecurityResourceFilter.class)
  public Response getLoadStatus(
      @Context HttpServletRequest req
  )
  {
    return handler.getLoadStatus();
  }
1331635
public static tunnelip6_stats[] get(nitro_service service) throws Exception{
		tunnelip6_stats obj = new tunnelip6_stats();
		tunnelip6_stats[] response = (tunnelip6_stats[])obj.stat_resources(service);
		return response;
	}
1144513
public function checkServiceStatusInCluster(array $loadBalancers, $proxyName, $serviceName, $statusToCheck = 'UP')
	{
		$statusVerified = false;
		$noServiceInProxy = false;
		$lbTries = 0;

		while ($statusVerified === false && $lbTries < $this->_checkMaxRetries) {
			$lbTries++;

			$clusterStats = $this->getStatsFromCluster($loadBalancers);

			if (count($clusterStats) <= 0) {
				$this->_log(
					'alert', "Unable to retrieve stats from any of $serviceName's load balancers. Please contact a Systems Administrator."
				);
				break; // break out of while loop
			}

			foreach ($clusterStats as $loadBalancer => $stats) {

				if (isset($stats[$proxyName][$serviceName])) {

					$proxyServiceStatus = $stats[$proxyName][$serviceName]['status'];
					$this->_log(
						'debug', "$loadBalancer: Status for service '$serviceName' in proxy '$proxyName' is '$proxyServiceStatus'"
					);

					if ($statusToCheck == 'UP') {
						$statusVerified = ($proxyServiceStatus == 'UP') ? true : false;
					} else {
						// make sure status is 'DOWN' or 'MAINT' and has zero current connections
						$statusVerified = ($proxyServiceStatus == 'DOWN' || $proxyServiceStatus == 'MAINT')
						&& ($stats[$proxyName][$serviceName]['scur'] == '0') ? true : false;
					}

				} else {
					$this->_log(
						'alert', "Unable to find service named '$serviceName' in proxy named '$proxyName' on $loadBalancer. Please contact a Systems Administrator."
					);
					$noServiceInProxy = true;
					break 2; // break out of while loop
				}
			}

			// wait 2 seconds between tries
			sleep(2);
		}

		if ($statusVerified === true) {
			$this->_log(
				'info', "HAProxy detected service '$serviceName' of proxy '$proxyName' is '$statusToCheck'.  Retried $lbTries times ("
				. $lbTries * 2 . ' seconds).'
			);
		} elseif ($noServiceInProxy === false) {
			$this->_log(
				'warn', "HAProxy did not detect service '$serviceName' of proxy '$proxyName' as '$statusToCheck'.  Retried $lbTries times ("
				. $lbTries * 2 . ' seconds).'
			);
		}
	}
1143074
private static IdTagInfo__.Status convert(AuthorizationResultStatus status) {
        IdTagInfo__.Status result;

        switch (status) {
            case ACCEPTED:
                result = IdTagInfo__.Status.ACCEPTED;
                break;
            case BLOCKED:
                result = IdTagInfo__.Status.BLOCKED;
                break;
            case EXPIRED:
                result = IdTagInfo__.Status.EXPIRED;
                break;
            case INVALID:
                result = IdTagInfo__.Status.INVALID;
                break;
            default:
                throw new AssertionError("AuthorizationResultStatus has unknown status: " + status);
        }

        return result;
    }
207011
void processStatus(final HttpServerExchange exchange, final RequestData requestData) throws IOException {

        final String jvmRoute = requestData.getFirst(JVMROUTE);
        final String loadValue = requestData.getFirst(LOAD);

        if (loadValue == null || jvmRoute == null) {
            processError(TYPESYNTAX, SMISFLD, exchange);
            return;
        }

        UndertowLogger.ROOT_LOGGER.receivedNodeLoad(jvmRoute, loadValue);
        final int load = Integer.parseInt(loadValue);
        if (load > 0 || load == -2) {

            final Node node = container.getNode(jvmRoute);
            if (node == null) {
                processError(MCMPErrorCode.CANT_READ_NODE, exchange);
                return;
            }

            final NodePingUtil.PingCallback callback = new NodePingUtil.PingCallback() {
                @Override
                public void completed() {
                    final String response = "Type=STATUS-RSP&State=OK&JVMRoute=" + jvmRoute + "&id=" + creationTime;
                    try {
                        if (load > 0) {
                            node.updateLoad(load);
                        }
                        sendResponse(exchange, response);
                    } catch (Exception e) {
                        UndertowLogger.ROOT_LOGGER.failedToSendPingResponse(e);
                    }
                }

                @Override
                public void failed() {
                    final String response = "Type=STATUS-RSP&State=NOTOK&JVMRoute=" + jvmRoute + "&id=" + creationTime;
                    try {
                        node.markInError();
                        sendResponse(exchange, response);
                    } catch (Exception e) {
                        UndertowLogger.ROOT_LOGGER.failedToSendPingResponseDBG(e, node.getJvmRoute(), jvmRoute);
                    }
                }
            };

            // Ping the node
            node.ping(exchange, callback);

        } else if (load == 0) {
            final Node node = container.getNode(jvmRoute);
            if (node != null) {
                node.hotStandby();
                sendResponse(exchange, "Type=STATUS-RSP&State=OK&JVMRoute=" + jvmRoute + "&id=" + creationTime);
            } else {
                processError(MCMPErrorCode.CANT_READ_NODE, exchange);
            }
        } else if (load == -1) {
            // Error, disable node
            final Node node = container.getNode(jvmRoute);
            if (node != null) {
                node.markInError();
                sendResponse(exchange, "Type=STATUS-RSP&State=NOTOK&JVMRoute=" + jvmRoute + "&id=" + creationTime);
            } else {
                processError(MCMPErrorCode.CANT_READ_NODE, exchange);
            }
        } else {
            processError(TYPESYNTAX, SMISFLD, exchange);
        }
    }
1006079
public IpcLogEntry withHttpStatus(int httpStatus) {
    if (httpStatus >= 100 && httpStatus < 600) {
      this.httpStatus = httpStatus;
      if (status == null) {
        status = IpcStatus.forHttpStatus(httpStatus);
      }
      if (result == null) {
        result = status.result();
      }
    } else {
      // If an invalid HTTP status code is passed in
      this.httpStatus = -1;
    }
    return this;
  }
815098
def replicaStatus(self, url):
        """"""
        params = {"f" : "json"}
        url = url + "/status"
        return self._get(url=url,
                            param_dict=params,
                            securityHandler=self._securityHandler,
                            proxy_port=self._proxy_port,
                            proxy_url=self._proxy_url)
987352
public java.util.List<BulkEmailDestinationStatus> getStatus() {
        if (status == null) {
            status = new com.amazonaws.internal.SdkInternalList<BulkEmailDestinationStatus>();
        }
        return status;
    }
1328404
private String getSonarTaskStatus(String ceTaskResponse) throws org.json.simple.parser.ParseException {
        JSONObject ceTaskResponseObject = (JSONObject) new org.json.simple.parser.JSONParser().parse(ceTaskResponse);
        JSONObject task = (JSONObject) ceTaskResponseObject.get("task");
        return str(task, "status");
    }
973810
public static dns_stats get(nitro_service service) throws Exception{
		dns_stats obj = new dns_stats();
		dns_stats[] response = (dns_stats[])obj.stat_resources(service);
		return response[0];
	}
360882
private void parseQueryStatus(boolean lastChunk) {
        //some sections don't always come up, unlike status. Take this chance to close said sections' observables here.
        querySignatureObservable.onCompleted();
        queryRowObservable.onCompleted();
        queryErrorObservable.onCompleted();

        responseContent.markReaderIndex();
        responseContent.skipBytes(findNextChar(responseContent, '"') + 1);
        int endStatus = findNextChar(responseContent, '"');
        if (endStatus > -1) {
            ByteBuf resultSlice = responseContent.readSlice(endStatus);
            queryStatusObservable.onNext(resultSlice.toString(CHARSET));
            queryStatusObservable.onCompleted();
            sectionDone();
            queryParsingState = transitionToNextToken(lastChunk);
        } else {
            responseContent.resetReaderIndex();
            return; //need more data
        }
    }
160191
public static HttpResponseStatus parseStatus(CharSequence status) throws Http2Exception {
        HttpResponseStatus result;
        try {
            result = parseLine(status);
            if (result == HttpResponseStatus.SWITCHING_PROTOCOLS) {
                throw connectionError(PROTOCOL_ERROR, "Invalid HTTP/2 status code '%d'", result.code());
            }
        } catch (Http2Exception e) {
            throw e;
        } catch (Throwable t) {
            throw connectionError(PROTOCOL_ERROR, t,
                            "Unrecognized HTTP status code '%s' encountered in translation to HTTP/1.x", status);
        }
        return result;
    }
690690
def parse_status_line(cls, data):
        '''
        '''
        match = re.match(
            br'(HTTP/\d+\.\d+)[ \t]+([0-9]{1,3})[ \t]*([^\r\n]*)',
            data
        )
        if match:
            groups = match.groups()
            if len(groups) == 3:
                return wpull.string.to_str(
                    (groups[0], int(groups[1]), groups[2]),
                    encoding='latin-1',
                )

        raise ProtocolError(
            'Error parsing status line {line}".'.format(line=ascii(data))
        )
952495
protected void handleStatsResetIfNeeded(StatusData<NginxMetrics> status) {
        StatValue previousHandled = getStatValue(NginxMetrics.HANDLED);
        Long currentHandled = Long.class.cast(status.get(NginxMetrics.HANDLED));
        if (previousHandled != null && currentHandled != null && previousHandled.getValueAsLong() > currentHandled) {
            for (NginxMetrics metric : getAvailableMetrics()) {
                if (metric.getType() == StatValueTypes.DIFFLONG) {
                    StatValue stat = getStatValue(metric);
                    if (stat != null)
                        stat.reset();
                }
            }
        }
    }
586233
def _parse_linux_cx_state(self, lines, tcp_states, state_col, protocol=None, ip_version=None):
        
        metrics = {}
        for _, val in iteritems(self.cx_state_gauge):
            metrics[val] = 0
        for l in lines:
            cols = l.split()
            if cols[0].startswith('tcp') or protocol == 'tcp':
                proto = "tcp{0}".format(ip_version) if ip_version else ("tcp4", "tcp6")[cols[0] == "tcp6"]
                if cols[state_col] in tcp_states:
                    metric = self.cx_state_gauge[proto, tcp_states[cols[state_col]]]
                    metrics[metric] += 1
            elif cols[0].startswith('udp') or protocol == 'udp':
                proto = "udp{0}".format(ip_version) if ip_version else ("udp4", "udp6")[cols[0] == "udp6"]
                metric = self.cx_state_gauge[proto, 'connections']
                metrics[metric] += 1

        return metrics