Команда просмотра статистики.

Метод HTTP-запроса:

POST

Шаблон HTTP-запроса:

http://host:port/<DOMAIN>/service/cc/arm/statistics_show

Коды ответов:

200

XSD-схема XML-запроса/ответа:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <!-- systemType -->
    <xs:simpleType name="systemType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="ecss10.common"/>
            <xs:enumeration value="ecss10.ssw"/>
            <xs:enumeration value="ecss10.cc"/>
            <xs:enumeration value="ecss10.tc"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- statisticTypeType -->
    <xs:simpleType name="statisticTypeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="counter"/>
            <xs:enumeration value="gauge"/>
            <xs:enumeration value="meter"/>
            <xs:enumeration value="histogram"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- statisticsValueType -->
    <xs:complexType name="statisticsValueType">
        <xs:attribute name="time" type="xs:string"/> <!--YY/MM/DD HH:MM:SS-->
        <xs:attribute name="value" type="xs:int"/>
        <xs:attribute name="n" type="xs:int"/>
        <xs:attribute name="min" type="xs:int" use="optional"/>
        <xs:attribute name="max" type="xs:int" use="optional"/>
        <xs:attribute name="avg" type="xs:double" use="optional"/>
    </xs:complexType>
    <!-- statisticsInType -->
    <xs:complexType name="statisticsInType">
        <xs:attribute name="from" type="xs:string"/> <!--YY/MM/DD HH:MM:SS-->
        <xs:attribute name="to" type="xs:string"/> <!--YY/MM/DD HH:MM:SS-->
        <xs:attribute name="system" type="systemType"/>
        <xs:attribute name="subsystem" type="xs:string" use="optional"/>
        <xs:attribute name="statistic" type="xs:string" use="optional"/>
        <xs:attribute name="type" type="statisticTypeType" use="optional"/>
        <xs:attribute name="variable_part_1" type="xs:string" use="optional"/>
        <xs:attribute name="variable_part_2" type="xs:string" use="optional"/>
        <xs:attribute name="measure_type" type="statisticIntervalType" use="optional"/>
    </xs:complexType>
    <!-- statisticsOutType -->
    <xs:complexType name="statisticsOutType">
        <xs:sequence>
            <xs:element name="value" minOccurs="0" maxOccurs="unbounded" type="statisticsValueType"/>
        </xs:sequence>
        <xs:attribute name="system" type="systemType"/>
        <xs:attribute name="subsystem" type="xs:string"/>
        <xs:attribute name="statistic" type="xs:string"/>
        <xs:attribute name="type" type="statisticTypeType"/>
        <xs:attribute name="measure_type" type="xs:string" use="optional"/>
        <xs:attribute name="sum" type="xs:float" use="optional"/>
        <xs:attribute name="variable_part_1" type="xs:string" use="optional"/>
        <xs:attribute name="variable_part_2" type="xs:string" use="optional"/>
    </xs:complexType>
    <!-- statisticIntervalType -->
    <xs:simpleType name="statisticIntervalType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="realtime"/>
            <xs:enumeration value="intrahour"/>
            <xs:enumeration value="hour"/>
            <xs:enumeration value="day"/>
            <xs:enumeration value="week"/>
            <xs:enumeration value="month"/>
            <xs:enumeration value="auto"/>
        </xs:restriction>
    </xs:simpleType>
    <!-- in -->
    <xs:element name="in">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="request">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="statistics" maxOccurs="unbounded" type="statisticsInType"/>
                        </xs:sequence>
                        <xs:attribute name="domain" type="xs:string"/>
                        <xs:attribute name="measure_type" type="statisticIntervalType"/>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <!-- out -->
    <xs:element name="out">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="response">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="statistics" minOccurs="0" maxOccurs="unbounded" type="statisticsOutType"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
XML

XSD-схема с общими типами данных statistics_common.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <!-- systemType -->
    <xs:simpleType name="systemType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="ecss10.common"/>
            <xs:enumeration value="ecss10.ssw"/>
            <xs:enumeration value="ecss10.cc"/>
            <xs:enumeration value="ecss10.tc"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- statisticTypeType -->
    <xs:simpleType name="statisticTypeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="counter"/>
            <xs:enumeration value="gauge"/>
            <xs:enumeration value="meter"/>
            <xs:enumeration value="histogram"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- statisticIntervalType -->
    <xs:simpleType name="statisticIntervalType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="realtime"/>
            <xs:enumeration value="intrahour"/>
            <xs:enumeration value="hour"/>
            <xs:enumeration value="day"/>
            <xs:enumeration value="week"/>
            <xs:enumeration value="month"/>
            <xs:enumeration value="auto"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- dynamicDateType -->
    <xs:simpleType name="dynamicDateType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="none"/>
            <xs:enumeration value="today"/>
            <xs:enumeration value="yesterday"/>
            <xs:enumeration value="week"/>
            <xs:enumeration value="month"/>
            <xs:enumeration value="quarter"/>
            <xs:enumeration value="year"/>
        </xs:restriction>
    </xs:simpleType>

    <!-- statisticsInType -->
    <xs:complexType name="statisticsInType">
        <xs:attribute name="system" type="systemType" use="required"/>
        <xs:attribute name="subsystem" type="xs:string"/>
        <xs:attribute name="statistic" type="xs:string"/>
        <xs:attribute name="type" type="statisticTypeType"/>
        <xs:attribute name="variable_part_1" type="xs:string"/>
        <xs:attribute name="variable_part_2" type="xs:string"/>
        <!-- Displayable metric name -->
        <xs:attribute name="title" type="xs:string"/>
    </xs:complexType>

    <!-- statisticRequestType -->
    <xs:complexType name="statisticRequestType">
        <xs:sequence>
            <xs:element name="statistics" maxOccurs="unbounded" type="statisticsInType"/>
        </xs:sequence>
        <xs:attribute name="from" type="xs:dateTime" use="required"/>
        <xs:attribute name="to" type="xs:dateTime" use="required"/>
        <xs:attribute name="measure_type" type="statisticIntervalType"/>
        <xs:attribute name="request_time_utc" type="xs:boolean"/>
    </xs:complexType>

    <!-- statisticReportType -->
    <xs:complexType name="statisticReportType">
        <xs:sequence>
            <xs:element name="chart" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="statistics" maxOccurs="unbounded" type="statisticsInType"/>
                    </xs:sequence>
                    <xs:attribute name="name" type="xs:string" use="required"/>
                    <xs:attribute name="chart_type" type="xs:string"/>
                    <xs:attribute name="visible" type="xs:boolean"/>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="dynamic_date" type="dynamicDateType" use="required"/>
        <!-- Required if dynamic_date == 'none' -->
        <xs:attribute name="from" type="xs:dateTime"/>
        <xs:attribute name="to" type="xs:dateTime"/>
        <xs:attribute name="id" type="xs:string"/>
        <xs:attribute name="measure_type" type="statisticIntervalType"/>
        <xs:attribute name="description" type="xs:string"/>
        <xs:attribute name="created_at" type="xs:dateTime"/>
        <xs:attribute name="task_id" type="xs:string"/>
    </xs:complexType>

</xs:schema>

CODE

Пример использует технологию websocket

Пример:
Запрос:

0100000003440027statistics_show
[
  {
    "_name": "in",
    "_content": [
      {
        "_name": "request",
        "_content": [
          {
            "_name": "statistics",
            "_attributes": {
              "from": "2020/12/07 00:00:00",
              "to": "2020/12/14 23:59:59",
              "statistic": "accepted_direct_in_c",
              "subsystem": "agent",
              "system": "ecss10.cc",
              "type": "counter",
              "measure_type": "auto",
              "variable_part_2": "102"
            }
          }
        ]
      }
    ]
  }
]                     
PY

Код ответа:

200

Ответ:

0100000013900027200
[
  {
    "_name": "out",
    "_attributes": {
      "xmlns:xs": "http://www.w3.org/2001/XMLSchema-instance",
      "xs:noNamespaceSchemaLocation": "statistics_show.xsd"
    },
    "_content": [
      {
        "_name": "response",
        "_content": [
          {
            "_name": "statistics",
            "_attributes": {
              "domain": "arko",
              "from": "2020/12/07 00:00:00",
              "to": "2020/12/14 23:59:59",
              "system": "ecss10.cc",
              "subsystem": "agent",
              "statistic": "accepted_direct_in_c",
              "type": "counter",
              "measure_type": "day",
              "sum": "6.000000",
              "variable_part_2": "102"
            },
            "_content": [
              {
                "_name": "value",
                "_attributes": {
                  "time": "2020/12/07 23:59:59",
                  "value": "0",
                  "n": "-",
                  "min": "-",
                  "max": "-",
                  "avg": "-"
                }
              },
              {
                "_name": "value",
                "_attributes": {
                  "time": "2020/12/08 23:59:59",
                  "value": "0",
                  "n": "-",
                  "min": "-",
                  "max": "-",
                  "avg": "-"
                }
              },
              {
                "_name": "value",
                "_attributes": {
                  "time": "2020/12/09 23:59:59",
                  "value": "0",
                  "n": "-",
                  "min": "-",
                  "max": "-",
                  "avg": "-"
                }
              },
              {
                "_name": "value",
                "_attributes": {
                  "time": "2020/12/10 23:59:59",
                  "value": "5",
                  "n": "-",
                  "min": "-",
                  "max": "-",
                  "avg": "-"
                }
              },
              {
                "_name": "value",
                "_attributes": {
                  "time": "2020/12/11 23:59:59",
                  "value": "1",
                  "n": "-",
                  "min": "-",
                  "max": "-",
                  "avg": "-"
                }
              },
              {
                "_name": "value",
                "_attributes": {
                  "time": "2020/12/12 23:59:59",
                  "value": "0",
                  "n": "-",
                  "min": "-",
                  "max": "-",
                  "avg": "-"
                }
              },
              {
                "_name": "value",
                "_attributes": {
                  "time": "2020/12/13 23:59:59",
                  "value": "0",
                  "n": "-",
                  "min": "-",
                  "max": "-",
                  "avg": "-"
                }
              },
              {
                "_name": "value",
                "_attributes": {
                  "time": "2020/12/14 23:59:59",
                  "value": "-",
                  "n": "-",
                  "min": "-",
                  "max": "-",
                  "avg": "-"
                }
              }
            ]
          }
        ]
      }
    ]
  }
]
PY