Hc_hosts_info - Информация о состоянии серверов
hosts_info
Команда возвращает информацию о состоянии ресурсов северов - CPU, память, дисковая подсистема, сетевые интерфейсы.
Аналог команды в CoCon:
node/hosts-info
Метод HTTP-запроса:
POST
Шаблон HTTP-запроса:
http://host:port/commands/hosts_info
Код HTTP-ответа:
- 200 – в случае успеха;
- 404 – в случае ошибки.
XSD-схема XML-файла запроса/ответа:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- HostInfoType-->
<xs:complexType name="HostInfoType">
<xs:all>
<xs:element name="cpu" type="ItemsListType"/>
<xs:element name="memory" type="ItemsListType"/>
<xs:element name="memoryTotal" type="ItemsListType"/>
<xs:element name="disk" type="DiskInfoType"/>
<xs:element name="iface" type="IfaceInfoType"/>
<xs:element name="node" type="NodeInfoType"/>
</xs:all>
<xs:attribute name="node" type="xs:string" use="required"/>
</xs:complexType>
<!-- ItemsListType-->
<xs:complexType name="ItemsListType">
<xs:sequence>
<xs:element name="item" type="ItemType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- ItemType-->
<xs:complexType name="ItemType">
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<!-- DiskInfoType-->
<xs:complexType name="DiskInfoType">
<xs:sequence>
<xs:element name="item" type="DiskItemType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- DiskItemType-->
<xs:complexType name="DiskItemType">
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
<xs:attribute name="used" type="xs:string" use="required"/> <!-- 0-100% usage -->
</xs:complexType>
<!-- IfaceInfoType-->
<xs:complexType name="IfaceInfoType">
<xs:sequence>
<xs:element name="item" type="IfaceItemType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- IfaceItemType-->
<xs:complexType name="IfaceItemType">
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="macaddr" type="xs:string" use="required"/>
<xs:attribute name="addr" type="xs:string" use="required"/>
<xs:attribute name="netmask" type="xs:string" use="required"/>
<xs:attribute name="dstaddr" type="xs:string" use="required"/>
</xs:complexType>
<!-- NodeInfoType-->
<xs:complexType name="NodeInfoType">
<xs:sequence>
<xs:element name="item" type="NodeItemType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- NodeItemType-->
<xs:complexType name="NodeItemType">
<xs:attribute name="node" type="xs:string" use="required"/>
</xs:complexType>
<!-- in-->
<xs:element name="in">
</xs:element>
<!-- out-->
<xs:element name="out">
<xs:complexType>
<xs:sequence>
<xs:element name="host" type="HostInfoType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
CODE
Пример
Запрос: http://192.168.1.21:9999/commands/hosts_info
<in/>
CODE
Ответ:200
<?xml version="1.0"?>
<out
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="hc_hosts_info.xsd">
<host node="core1@ecss1">
<cpu>
<item name="Total" value="20.59"/>
<item name="CPU #1" value="18.75"/>
<item name="CPU #2" value="11.76"/>
</cpu>
<memory>
<item name="total" value="372827688"/>
<item name="processes" value="130079880"/>
<item name="processes_used" value="130078488"/>
<item name="system" value="242747808"/>
<item name="atom" value="3223825"/>
<item name="atom_used" value="3211956"/>
<item name="binary" value="31969736"/>
<item name="code" value="71185090"/>
<item name="ets" value="30218280"/>
</memory>
<memoryTotal>
<item name="system_total_memory" value="4096815104"/>
<item name="free_swap" value="0"/>
<item name="total_swap" value="0"/>
<item name="cached_memory" value="342142976"/>
<item name="buffered_memory" value="168120320"/>
<item name="free_memory" value="214089728"/>
<item name="total_memory" value="4096815104"/>
</memoryTotal>
<disk>
<item name="/" value="52576092160" used="26"/>
<item name="/dev" value="2012602368" used="0"/>
<item name="/dev/shm" value="2048405504" used="0"/>
<item name="/run" value="409681920" used="1"/>
<item name="/run/lock" value="5242880" used="0"/>
<item name="/sys/fs/cgroup" value="2048405504" used="0"/>
<item name="/snap/stress-ng/924" value="3407872" used="100"/>
<item name="/snap/core/7917" value="93454336" used="100"/>
<item name="/snap/keepalived/514" value="18743296" used="100"/>
<item name="/snap/keepalived/618" value="18874368" used="100"/>
<item name="/var/log" value="21003583488" used="13"/>
<item name="/var/log/ecss" value="31572529152" used="6"/>
<item name="/var/lib/ecss" value="31572529152" used="2"/>
<item name="/var/lib/ecss/glusterfs" value="31572529152" used="1"/>
<item name="/var/lib/ecss-mysql" value="52576092160" used="2"/>
<item name="/snap/stress-ng/1046" value="3407872" used="100"/>
<item name="/snap/core/8039" value="93454336" used="100"/>
</disk>
<iface>
<item name="lo" macaddr="00:00:00:00:00:00" addr="127.0.0.1" netmask="255.0.0.0" dstaddr="-"/>
<item name="enp1s0" macaddr="82:17:A8:3B:DC:FD" addr="-" netmask="-" dstaddr="-"/>
<item name="enp2s0" macaddr="82:17:A8:3B:DC:FD" addr="-" netmask="-" dstaddr="-"/>
<item name="bond1" macaddr="82:17:A8:3B:DC:FD" addr="fe80::8017:a8ff:fe3b:dcfd" netmask="ffff:ffff:ffff:ffff::" dstaddr="-"/>
<item name="bond1.3" macaddr="82:17:A8:3B:DC:FD" addr="192.168.1.21" netmask="255.255.255.0" dstaddr="-"/>
<item name="bond1.476" macaddr="82:17:A8:3B:DC:FD" addr="10.16.33.5" netmask="255.255.255.0" dstaddr="-"/>
<item name="bond1.2" macaddr="82:17:A8:3B:DC:FD" addr="192.168.2.21" netmask="255.255.255.0" dstaddr="-"/>
<item name="bond1.3:MYSQL" macaddr="" addr="192.168.1.71" netmask="255.255.255.0" dstaddr="-"/>
<item name="bond1.2:SIP62" macaddr="" addr="192.168.2.62" netmask="255.255.255.0" dstaddr="-"/>
<item name="bond1.2:SIP61" macaddr="" addr="192.168.2.61" netmask="255.255.255.0" dstaddr="-"/>
</iface>
<node>
<item node="megaco1@ecss1"/>
<item node="sip1@ecss1"/>
<item node="md1@ecss1"/>
<item node="core1@ecss1"/>
<item node="ds1@ecss1"/>
<item node="mycelium1@ecss1"/>
<item node="subscriber-portal@ecss1"/>
</node>
</host>
</out>
CODE