Source code for api.system.services.v1.status
"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('system','services','v1','status'))
def get_service_status(json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Fetch system status for bound services (INTERNAL)
:returns: {"offset": 375, "limit": 571, "responseCode": 200, "count": 394, "data": [{"state": "STOPPED", "packageVersion": "Compare leader spend soon forward that teach.", "serviceName": "Ok away alone develop.", "serviceID": "Listen indeed tax TV that.", "systemLoadAverage": 94, "percentHeapUsed": 41, "percentNonHeapUsed": 404, "responseTimeInNanos": 500}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Job president kind long attack source trial.", "messageTemplate": "White yeah task relationship least.", "field": "Season better building effort try participant.", "parameter": {}, "timestamp": 353672652}], "currentPage": 507, "size": 743}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/system/services/v1/status".format()
headers = {
'Content-Type': 'application/json',
'User-Agent': 'ArgusToolbelt/1.0'
}
if apiKey:
headers["Argus-API-Key"] = apiKey
elif authentication and isinstance(authentication, dict):
headers.update(authentication)
elif callable(authentication):
headers.update(authentication(url))
body = {}
response = get(url, json=body if body else None, verify=verify, headers=headers)
errors = []
if response.status_code == 401:
raise http.AuthenticationFailedException(response)
elif response.status_code == 403:
raise http.AccessDeniedException(response)
elif response.status_code == 412:
raise http.ValidationErrorException(response)
elif response.status_code == 404:
raise http.ObjectNotFoundException(response)
return response.json() if json else response