05 Configuration - netassist-ua/netgraphz2-gpl GitHub Wiki

Web frontend

Web front-end Phalcon-based application is configured by main configuration file located in web-phalcon/app/config/config.php relative to your installation path. This Phalcon application configuration file, it uses PHP array syntax to specify configuration variable values. Most of server-side parameters like gRPC backend server connection, MongoDB connection, company information. Configuration variables names are case sensitive!

Configuration syntax look like:

<?php
...
return new \Phalcon\Config(array(
    'information' => array(
        'companyName'   => 'My company',
        'siteName'      => 'NetGraphz2',
        'icingaUrl'     => '/icinga2-classicui',
        'openSignUp' => true
     ),
...
?>

It consist of several section represented as PHP arrays. Syntax should be valid PHP. Every option described below should be specified. Don't change some default values of 'application' configuration section unless you don't imagine how it may affect application stablity and performance

##Information

Section called information. Here you can change company information and global page title. These parameters are not quit important for application functionality. The main possible usage is distringuishing different NetGraphz2 installations.

Variable name Description Description Example (default)
companyName Specifies company name shown on all pages of the web-application string 'NetAssist'
siteName Name of site appended to the page title string 'Our NetGraphz'
icingaUrl URL of Icinga2 web interface (link shown in the topmenu) string 'http://example.com/icingaweb2'
openSignUp Allow to signup by follow sign up link (true/false) boolean true

##MongoDB section Section called mongo. Enter your MongoDB connection configuration here. This section is very short comparing to the rest of configuration. MongoDB is responsible for storing user settings like graph nodes positions.

Variable name Description Type Example (default)
connectionString PHP MongoDB driver connection string: host, port and additional network options. For more information and options follow MongoDB reference manual section here: https://docs.mongodb.org/manual/reference/connection-string/. Don't forget to specify connectTimeoutMS optionto avoid page hungs if MongoDB goes down. string 'mongodb://localhost:27017/?connectTimeoutMS=1200'
database Database to use string 'netgraphz2'
options Additional MongoDB driver options. Reserved forfuture usage. Leave as empty PHP array. PHP array array()

gRPC section

Section grpc of configuration file sets backend connection parameters. In order to make NetGraphz2 web instance work properly you should set correct host address and port matching backend configuration.

Variable name Description Type Example (default)
host Backend daemon host string 'localhost'
port Backend daemon port string 8088
timeout Connection timeout for backend in microseconds. Set this value smart way: in case of small timeout site will not be able to communicate with backend application, in case of too big timeout - PHP may be blocked in case of server failure leading to DoS. integer 5000000
options Additional gRPC PHP connection options PHP array array()

Application section

Phalcon's application section provides mostly framework speicific configuration options. Some of them are quit important and should be changed to make application work properly.

Variable name Description Type Example (default)
controllersDir ... Phalcon application component directories.Don't changes these settings unless you are not an application developer. string APP_PATH . '/app/controllers/' ...
baseUri Base relative URL of web application.Default value is '/' consider applicationlocated in the root directory of web-site. string '/'
cryptSalt Cryptographic salt for encryption algorithm.It has to be string of random characters 24chars long. Default value should be changed! string 'Thae4pijiexahfahYief3411'
rememberLifeTime Cookie life time for 'remember me' login option in seconds integer 604800
failLoginWindowTime Window time (t) in seconds for N unsuccessful login tries sequence before useraccount get blocked by application integer 300
failLoginBlockPermament Sets if user gets permanently blocked after N unsuccessful login tries sequence in window time (t) boolean false
failLoginBlockTime Sets temporary block time in seconds if userexceeds N unsuccesful login ties in window time (t). Works if failLoginBlockPermamentset to be false. integer 600
failLoginWindowMaxCount Specifies N - number of unsuccessful loginbefore user get blocked by application integer 5

JavaScript UI

JS user interface configuration located in web-phalcon/public/js/netrgraphz/settings.js file relative to your installation path. It's JavaScript file, so configuration is done by modifying object values in JSON-way.

File should stay same valid JavaScript after modifications, otherwise NetGraphz will not work properly. If you break syntax, restore original file from NetGraphz2 distribution package.

File syntax look like:

var netgraphz = netgraphz || {};
netgraphz.settings = (function(){
return {
   'communication': {
     'remote_url': 'http://netgraphz.naic.29632.as:3433', //URL of notifications server
   },
  'updater': { //Updater settings
  'updateInterval': 30000, //Interval to start fetching new nodes data (30 sec by default)
  'partInterval': 1200, //Interval between parts
  'partSize': 30 //Ammount of nodes to fetch by request, should be not too big and not too small
 },
...
};
})();

General

Variable name Description Type Example (default)
default_state_source Specifies default state source. Used to display node colors on graph. If parameter value set to null, source with latest timestamp will be used. string null

Initialization section

Settings file section init contains setting for initial graph loading by parts.

Variable name Description Type Example (default)
node_part_size Ammount of nodes in each part to load integer 10
node_part_retry_wait Time to wait before retrying loading part (milliseconds) integer 1000
node_part_retry_times How many retries of nodes collection part loading to do before giving up whole graph loading integer 5

Communication section

Settings for notification server connection. It used to have reverse communication WebSockets channel for notifications and status updates. Section name is communication.

Variable name Description Type Example (default)
remoteUrl URL of NetGraphz2 Notifications WebSocket service string 'http://my.host:3433'

Updater section

Automatic background nodes status updater. It runs each Tupd, downloads new some part of node status information, waits Tpart time then downloads next part until it finish update. Section name is updater.

Variable name Description Type Example (default)
updateInterval Interval between update batches (Tupd) in milliseconds. Update runs every Tupd time, if previous update iteaction took longer than Tupd, waiting time will be substracted from this interval. integer 30000
partInterval Interval between parts (Tpart) in milliseconds integer 1200
partSize Number of hosts in each update part integer 30

Renderer section

Graph renderer engine (Cytoscape.js) and Layout algrorithm parameters. Section names is renderer.

Variable name Description Type Example (default)
container_id DOM Element ID of container to place graph string 'mynet'
layout_time Layout (graph simulation) time in milliseconds integer 5500
initialRadius Radius of initial positioning circuit to place nodes in px integer 400
doubleTapTime Time to detect of double tap (double click) in milliseconds integer 400
animationTime Nodes transition animation time in milliseconds integer 1000
zoomNodeLevel Level to zoom in/out when node was double clicked float 1.75
autoResizeContainer Automatically resize container dimensions when window resizes boolean true
effective_state_palette Sets default color palette for effective node states: 0 - up; 1 - down; 2 - warning; 3 - unknown; 4 - flapping JS object { 0: "#86D95D", 1: "#FC766D", 2: "#F0DE78", 3: "#CCD5ED", 4: "#70C5CF" }
default_node_color Specifies default node color if no monitoring information attached string '#8C8B76'

Layout subsection

Layout algorithm paramaters

Variable name Description Type Example (default)
name Layout algorith to be used. Currently we support only ported version of ForceAtlas2. string 'forceAtlas2'
animate Animate layout changes boolean true
refresh Number of page refreshes between rendering integer 1
ungrabifyWhileSimulating Disable node grabbing ablities when simulation is running boolean true
fit Try to fit nodes into view port (container) boolean true
zoomNodeLevel Level to zoom in/out when node was double clicked float 1.75
padding Padding around simulational field in px integer 30
boundingBox Constrain layout bounds{ x1, y1, x2, y2 } or { x1, y1, w, h } or null (undefined) JS object undefined
useWebWorker Use WebWorker to run simulation. You should use it, otherwise application will tun into laggy mess. boolean true
linLogMode LinLog mode of layout algorithm (forceAtlas2) boolean false
outboundAttractionDistribution Enable outbound attraction distribution for algorithm. It makes final result a little wider. boolean false
adjustSizes Adjust simulation sizes to extend space between nodes boolean true
spreadAfterStop Spread out nodes after layout finishes (to prevent jams) boolean true
edgeWeightInfluence Coefficient of edge influence float 0
scallingRatio Scaling ratio of simulation. Important parameter: it set up physical dimensions scaling and affects on how far node clusters would be after simulation float 3.0
strongGravityMode Turns on strong gravity (R^2) mode boolean false
gravity Gravity coefficient float 0.95
slowDown Slow down coefficient for equations of motion step integration float 0.2
infinite Infinite simulation, don't count on potential energies values. Not implemented yet. boolean true

UI section

User interface configuration

Node panel subsection

Node information panel UI configuration. Called node_panel.

Variable name Description Type Example (default)
node_panel_id Node panel DOM element identifier string 'node_panel'
node_panel_close_button_id Node panel close button DOM element id string 'node_panel_close'
fadeTime Time to fade out panel in milliseconds integer 400
holdTime Time to hold panel in milliseconds integer 2400
waitTime Time (in milliseconds) to wait after mouse over event before showing up node panel integer 900
links Provides configuration for links in node panel (below) for each node. Look below for link configuration JS array [{ 'title': 'Icinga', 'url': '/cgi-bin/icinga2-classicui/extinfo.cgi?type=1&host={icinga_name}', 'type': 'link', 'newTab': true }, … ]

Edge (link) panel subsection

Provides configuration for link (edge) informational panel. Called link_panel.

Variable name Description Type Example (default)
link_panel_id Edge panel DOM element identifier string 'link_panel'
link_panel_close_button_id Edge panel close button DOM element id string 'link_panel_close'
fadeTime Time to fade out panel in milliseconds integer 200
holdTime Time to hold panel in milliseconds integer 600
waitTime Time to wait after mouseover event before showing up panel in milliseconds integer 1200
links Provides configuration for links in edge panel (below) for each node. Look below for link configuration JS array [{ 'title': 'Icinga', 'url': '/cgi-bin/icinga2-classicui/extinfo.cgi?type=1&host={icinga_name}', 'type': 'link', 'newTab': true }, … ]

Information links for panels

Information about links objects for node and edges panels.

Variable name Description Type Example (default)
title Label of link 'icinga'
url URL of link (contains tags to replace). Each tag is covered by brackets { }. Possible,tags to replace for nodes: {icinga_name},{ip},{name},{model}. Possible tags to replace for edges: {comment}, {src.db_id}, {dst.db_id}, {link_speed}, {src.port_id}, {dst.port_id}, {src.id}, {dst.id} string '/cgi-bin/icinga2-classicui/extinfo.cgi?type=1&host={icinga_name}'
type Type of link ('link' or 'popup'). link – acts as generic link, popup – creates popup window when clicking (may be blocked by browser) string 'link'
newTab Open link in new tab. Works for link type. boolean true
popupSize Size of popup window. JavaScript object. Contains 'width' and 'height',variables - integer size of popup in pixels. JS object { 'width': 300, 'height': 400 }
popupName Name of popup. Contains tags to replace. string 'icinga - {icinga_name}'

Tabstop

Settings of tab navigation module. Responsible for TAB, SHIFT+TAB navigation. Subsection called tabStop.

Variable name Description Type Example (default)
enabled Enable UI.TabStop module boolean true

Notifications

Settings of UI notifications. Subsection called notifications.

Variable name Description Type Example (default)
tryUseDesktop Try to use HTML5 desktop notification API boolean true
showTime Show time for Desktop notifications integer 900
sounds JS object to specify sounds to be played during different raise of different types of notifications. Notification types: info – System information; warning – Node enters warning state (packet loss, etc); error – Node goes or still down; ok – Node goes up; It's a key-value object. 'key' – string – notification type; 'value' – string – relative path of sound file. JS object { 'info': '/sounds/KDE-Sys-App-Message.ogg', 'warning': '/sounds/KDE-Sys-Warning.ogg', 'error': '/sounds/KDE-Sys-App-Error.ogg', 'ok': '/sounds/KDE-Sys-App-Positive.ogg' }
toastr Specify toast notification extension parameters used when Desktop notifications not available. Look http://codeseven.github.io/toastr/demo.html to get behavior you want. JS object { ... }

Search

Subsection called search. It defines behavior of search field.

Variable name Description Type Example (default)
enabled Set's if search field isenabled boolean true
searchInputId Search field DOM element id string 'node-name-search'

#Notifications server

Notifications server configuration located in notifications/config.json file. Here you may change basic configuration of NetGraphz2 notifications server.

Variable name Description Type Example (default)
host Hostname that identifies server string 'localhost'

##Icinga2 scripts HTTP API (RPC) settings

Section api. Provides settings for HTTP server to handle Icinga2 event scripts.

Variable name Description Type Example (default)
authEnabled Enable authentication boolean true
authTokensPath Path to the authentication tokens collection file string 'auth_tokens.json'
listenAll Listen on all addresses (0.0.0.0) boolean false
port Listen TCP port integer 3434
address Listen address string '127.0.0.1'
icinga Icinga2,event forward settings. 'broadcast_user' – Icinga user to resend it's notifications to all connected users JS object { 'broadcast_user': '_netgraphz2_notify_all' }

Aggregation subsection

Subsection aggregation configures event aggregation function of the notification server.

Variable name Description Type Example (default)
enabled Enable event aggregation boolean true
time Time to wait for aggregation in milliseconds integer 1000

Rate limit subsection

Subsection rateLimit configures event processign rate limit. It's designed to prevent notification server hangs if network suddenly goes down.

Variable name Description Type Example (default)
enabled Enable event rate limit boolean true
time Time to reset event rate counter in milliseconds integer 1000
rate Maximal number events in time period (specified in 'time' option) before rate limited gets activated integer 10
overrate Action when rate limit exceeds. Two possible values: 'queue' - put new events in queue and process after time, 'drop' - drop new events without processing. string 'queue'

##Neo4j NetGraphz settings

Section called netgraphzdb. Settings of graph database.

Variable name Description Type Example (default)
port Port of neo4j API integer 7474
useAuth Use authentication for server boolean true
auth Authentication data. JSON object with string properties login and password JS object { 'login': 'neo4j', 'password': 'neo4j' }

##Server section

Section called notificator. It provides settings for WebSocket connection listener.

Variable name Description Type Example (default)
port TCP port to listen integer 3433

Backend server

Backend configuration located in the backend/bin/config.json file. Default configuration values located there.

Daemon section

General daemon settings. Section daemon.

Variable name Description Type Example (default)
log_file Log file path string '/var/log/netgraphz2/ng_backend.log'
rpc_port gRPC server listening port integer 8088
rpc_host gRPC server listening address string '127.0.0.1'

State section

Settings for ng_state module. Responsible for state fetching, processing and caching.

Cache subsection

Cache settings for ng_state module. Subsection called cache.

Variable name Description Type Example (default)
ttl TTL of the cache records in milliseconds. If TTL is expired, a new request to the state source sent. integer 10000

###Icinga2 subsection Icinga2 MKLiveStatus state source settings of ng_state module. Subsection called icinga.

Variable name Description Type Example (default)
host MKLiveStatus host name string localhost
port MKLiveStatus port integer 6558
use_unix_socket Use Unix family socket to access MKLiveStatus boolean false
unix_socket Unix socket path (used when use_unix_socket option is enabled) string ''
timeout_enabled Enable MKLiveStatus connection timeout boolean true
timeout Connection timeout in milliseconds integer 5000

Graph section

Settings for Neo4j graph database. Section called graph.

Variable name Description Type Example (default)
url Neo4j database without /db suffix. Here you can also specify credentials. URL format: http://username:password@host:port/ string http://neo4j:changed@localhost:7474

Metric section

Settings of the ng_metric module. Section called ng_metric.

Memory storage subsection

Provides section for the in-RAM metric storage

Variable name Description Type Example (default)
capacity Storage capacity. Specifies how many values of each metric hold in RAM. E.g - size of ring buffer. integer 5

Collectd source subsection.

Subsection collectd provider settings for Collectd binary protocol listener. To collect metrics you should point your collectd network plugin to correct server address and port.

Variable name Description Type Example (default)
host Listening address for collectd listener string '0.0.0.0'
port UDP port to listen for collectd binary messages integer 27015