Дерево страниц
Перейти к концу метаданных
Переход к началу метаданных

Service description

Eltex-Bob is a RESTful API service intended for unloading AP information into a monitoring system in JSON format. By default, the service can be requested via port 9190 using a GET request.To get information on a number and a state of devices, an access to MySQL is required.To provide protection from DDoS attacks, the service has its own cache that makes it possible not to load a database. The service requests an AP list every hour. Information on accessibility of devices is updated every minute.
Available API methods:


GetAPList provides an AP list in JSON format that contains:

APHOSTNAME - device MAC address;

APVISIBLENAME - device name;

APGROUP - AP location specified according to a reference table;

APRTCGROUP - a domain in which a device is located (except for a hidden part - domain_search.regex, see Service settings);

FULLADDRESS - a column of a reference table that contains an AP location address.


Example:

{
    "data": [
        {
            "{#APHOSTNAME}": "a8:f9:4b:b4:99:60",
            "{#APVISIBLENAME}": "WEP-12ac",
            "{#APGROUP}": "Baikal Bank/Sakha (Yakutia)/Subsidiary office №178-758",
			"{#APRTCGROUP}": "Dalniy_Vostok/Habarovskiy_filial/Evreyskaya_AO/Obluche/Sberbank/4157-081_Kuznechnaya_11a",
			"{#FULLADDRESS}": "678100, Olyokminsk, Molodyozhnaya Street, 20741"
        },
	]
}

GetAPDetail Detailed information on an AP that contains:

"ip" - device IP address

"office" - a value for a VSP selected from a reference table

"city" - a value for a VSP selected from a reference table

"firmware-version" - firmware version

"serial-number" - device serial number

"vsp" - a value for a VSP selected from a reference table

"full-address" - a value for a VSP selected from a reference table  

Example:

{
    "ip": "192.168.6.18",
 	"office": "Subsidiary office №178-758",
	"city": "Beryozovsky",
	"firmware-version": "1.16.0.163",
    "serial-number": "WP01000177",
	"vsp": "4157-081"
	"full-address": "678100, Olyokminsk, Molodyozhnaya Street, 20741"
}

GetAPAvailable AP availability that contains:

"available" - AP availability, where 0 - AP is available, 1 - AP is unavailable

"uptime" - AP availability duration in seconds

Example:

{
    "available": 0,
    "uptime": 67370
}

GetAPPerformance AP metrics that contain:

"wifi_users" - number of connected users

Example:

{
    "wifi_users": "5"
}

Service authorization can be performed in two ways:

  • http-basic authorization that is enabled in service settings
  • An ACL list specified in nginx configuration file

Settings

To restrict the number of IP addresses that can access the service, configure nginx server using ACL. An Access Control List is added to nginx configuration file, for example:


where deny - IP address from which access is restricted

allow - IP address from which access is allowed


in the example below, access is restricted for all IP addresses but 192.168.1.3 and 127.0.0.1.

location /api { 
	allow 192.168.1.3/24; 
	allow 127.0.0.1; 
	deny all; 
}

If to access Bob nginx is used, configure proxying

server { 
	listen 80; 
	server_name bob; 
	location /api/ { 
		proxy_pass http://localhost:9190/; 
		proxy_set_header Host $host; 
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
		proxy_set_header X-Real-IP $remote_addr; 
		proxy_redirect default; 
	}
}


Service configuration:
The main configuration file is located in /etc/eltex-bob/application.properties:

# The Datasource Mysql properties
spring.application.name=bob
#An address of a server with MySQL database from EMS
spring.datasource.url=jdbc:mysql://localhost:3306/eltex_ems?useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
spring.datasource.username=javauser
spring.datasource.password=javapassword

# Common properties
#domain_search.mask=% 
domain_search.mask=%.ap.root - the domain used for unloading. Includes subdomains

domain_search.regex=^root/Ap/(.*)$  - a domain part that will be hidden while displaying a result
domain_search.replacement=$1

mac.splitter=: - delimiters for MAC address octets (":" by default)


auth.enabled=true - enabling login-password authorization, false - disabled 
auth.username=eltex - login for authorization on Bob service
auth.password=eltexeltex - password for for authorization on Bob service

excel.config.file=/etc/eltex-bob/excel_config.yaml - configuration file to maintain a VCP reference table.

server.port=9190 - a port listened by the service


Configuration file for working with a reference table - /etc/eltex-bob/excel_config.yam:

vspSheetName: For tenders - Name of a page for analysis
vspExcelFile: /home/vagrant/list2.xlsx - file path

type: TITLE - defines a mode for using the table. TITLE - columns will be searched by their titles, NUMBER - columns will be searched by their sequence number 0,1,...
columns:
  vsp: VSP number - in this column, a cell with VSP number consistent with one from a domain is searched. For example, "4157-081" for the domain .../Sberbank/4157-081_Kuznechnaya_11a...   
  bank: Regional bank           \
  region: RF territorial entity                   - cells from these columns will be used to make an APGROUP
  office: Office name           /
  address: Real address - values contained in this cell get into FULLADDRESS in GetAPList output

## Configuration example by column numbers
#vspSheetName: For tenders
#type: NUMBER
#columns:
#  vsp: 3
#  bank: 1
#  region: 10
#  office: 2
#  address: 7

By default, the service uses 10 connections to a database. This number can be increased when necessary by adding the following line spring.datasource.hikari.maximum-pool-size=20 (where 20 is the number of connections) to the configuration file.


A service initialization file is located at: /etc/default/eltex-bob.
 
 
 
 


  • Нет меток