<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>USAGE OF TIME SERIES DATABASES IN THE GRAFANA PLATFORM FOR THE NETIS SERVICE</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>E.I. Alexandrov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>M. E. Pozo Astigarraga</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>G. Avolio</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>on behalf of the ATLAS Software</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Computing Activity</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>European Organization for Nuclear Research</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Joint Institute for Nuclear Research</institution>
          ,
          <addr-line>Joliot-Curie 6, RU-141980 Dubna</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <fpage>5</fpage>
      <lpage>9</lpage>
      <abstract>
        <p>NetIs is a service used to monitor the Data Acquisition network of the ATLAS experiment. The first version was developed at CERN in 2010. Over the years, the need to replace NetIs with an improved service emerged. Indeed, the effort to maintain NetIs has considerably increased together with the size and complexity of the network system; additionally, the Round Robin Database used to store the data results in a loss of granularity over time that makes the tool unsuitable for retrieving accurate values from the past. The graphs produced by NetIs are generated by the backend server and they are quite static, though the GUI is familiar to many users. The main idea was to exploit the recent advancements in time series databases and visualization tools like Grafana in order to present data to the users in a more dynamic way. The Persistent Back-End for the ATLAS Information System, developed in ATLAS for permanent storage of operational data, was already integrated with Grafana and successfully collecting network monitoring statistics. Grafana, despite being a very popular visualization web application, does not support some GUI elements that are used in NetIs such as a tree or position of drop-down. Javascript code integrated with Grafana was used to overcome these limitations.</p>
      </abstract>
      <kwd-group>
        <kwd>ATLAS</kwd>
        <kwd>network</kwd>
        <kwd>monitoring</kwd>
        <kwd>Grafana</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. First version of the ATLAS network monitoring tool and motivation for upgrade</title>
      <p>
        The ATLAS experiment is one of four LHC accelerator experiments at CERN [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. The
computing and network infrastructure of the experiment consists of 4,020 computing nodes, 285
network switches and 14,778 switch interfaces (ports). The NetIs system was designed to monitor this
network [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. The first version of NetIs was developed in 2010 based on the cyclic time series Round
Robin Database (RRD) [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Over the years, the need to replace NetIs with an improved service
emerged. Indeed, the effort to maintain NetIs has considerably increased together with the size and
complexity of the network system; additionally, the RRD used to store the data results in a loss of
granularity over time that makes the tool unsuitable for retrieving accurate values from the past.
Another inconvenience of using the first version is that graphs displayed by NetIs are generated by the
server backend and they are quite static. This interface has a dynamic tree for selecting nodes,
switches or interfaces and information panels as depicted in the image (Figure 1). A new
Grafanabased monitoring version using the Persistent Back-End for the ATLAS information system
(PBEAST) [4] database has been developed in recent years.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. The common structure of the NetIs monitoring</title>
      <p>
        The common structure of the legacy NetIs monitoring had two data sources: the first for
creating dashboards and the second for obtaining the network topology (Figure 2). In this version, the
monitoring data was retrieved from switches using the Simple Network Management Protocol
(SNMP) and was stored in a MySQL database to be later converted into RRD files by a separate
service. The Matplotlib [
        <xref ref-type="bibr" rid="ref4">5</xref>
        ] library generated images from the RRD data sources and the Django
framework [6] passed these images to the client. The second data source was used for navigation and it
was implemented with a JavaScript tree object from the dhtmlxTree library [7]. The data source of the
tree was the Central DB (CDB) that contains a description of the whole system. The new NetIS
version has similar structure, but the monitoring data fetched with SNMP are placed in the P-BEAST.
P-BEAST was developed in ATLAS for permanent storage of operational data, and it has already been
integrated with Grafana [8]. Grafana was chosen as a new data visualization service, but it has some
limitations in the GUI implementation that makes the navigation less intuitive than in the legacy
version. The main problem is that Grafana doesn't support the visualization of hierarchical data
structures.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. The Graphics interface implementation of the Tree</title>
      <p>The tree is the main GUI navigator in NetIs, but as mentioned Grafana does not support the
Tree element. It is possible to add a tree to Grafana in the following ways: create a custom plugin or
inject JavaScript code dashboards using the Grafana text panel widget. Both approaches have their
pros and cons.</p>
      <p>Creating a new panel is the main way to add new functionality to Grafana. This path requires
the presence or acquisition of skills to improve Grafana itself. The plugin must be compiled as part of
the Grafana developer workflow and installed on the server side. Within this path, to add any new
function, for example, in our case we need to set the position for the dropdown menu, a new plugin is
required. Unfortunately, this path does not guarantee compatibility with new versions. Sometimes
some plugin does not work with new version.</p>
      <p>The most effective way to add a tree into Grafana is to add JavaScript code to the text panel.
This approach does not require a Grafana developer workflow because all the code will be placed in
the Grafana text panel. The tree is not an element of Grafana itself and cannot use the data retrieval
methods. It should directly use the JavaScript objects of the Grafana library to interact with other
Grafana elements. This method can be easily adopted for any HTML/JavaScript object, including a
dropdown menu.</p>
      <p>The new version of NetIs uses JavaScript code in a text panel to implement the tree (Figure 3)
and some other elements. The text panel is a basic element of Grafana. It supports HTML code and
JavaScript inside it. This external JavaScript tree interacts with the just using the Grafana JavaScript
code downloaded by the browser, which is included in the main HTML page. Using this library, the
user can receive data from other panels and update dashboards. The NetIs uses tree as the navigation
panel.</p>
      <p>The initial data to build the tree for NetIs is stored in the CDB MySQL database. Grafana has
a plugin for MySQL, but as already mentioned, the tree is not an element of Grafana so it cannot
directly interact with a Grafana data source. Instead, the tree receives data using the Grafana template
element. The template stores the data as a list of strings that needs to be created first out of the data
retrieved from several tables in the MySQL database. The strings have the following structure:
Function:Device::Linecard::Interface. Some devices do not have a linecard component, so in this case
when converting data for such devices a special token, PORTS or LAG, needs to be generated.</p>
      <p>The NetIs uses standard edition of the dhtmlxTree library for the tree implementation in
HTML. The Initial method gets all strings of the template, parses them and generates the tree. NetIs
uses special ID of tree node for detection the level of tree and getting the data required for the
dashboards. The ID has the following format:
●
●
●
●</p>
      <p>Root level (function in CDB): _RR_FunctionName
Level 1 (device in CDB): DeviceId
Level 2 (linecard in CDB): _LL_DeviceId:LinecardId</p>
      <p>Level 3 (interface in CDB): _II_DeviceId:LinecardId:InterfaceId
Different levels of the NetIs tree have different context structures, with the exception of the tree area,
which is always present in the upper left area. The tree uses the ID of selected node to generate content
of the page using Grafana‘s JavaScript library. This approach allows the developers to make deeper
changes in the structure of the monitoring page than those that can be done using standard Grafana
tools.</p>
    </sec>
    <sec id="sec-4">
      <title>4. View of NetIs monitoring</title>
      <p>The linecard view (level 2) has the same structure but uses the metrics gathered for the
selected linecard and its interfaces. The interface view (level 3) does not display aggregated data
(Figure 5), but instead it has a text area with additional information about the interface itself.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>The new version of NetIs was successfully implemented, tested and put into production. These
services are based on Grafana and P-BEAST. The use the P-BEAST time-series database avoided the
loss of data over time of the stored samples and does not degrade the resolution of the dashboards.
Grafana makes the NetIs page navigation more dynamic and flexible. Maintaining the new system
should be easier than before because only knowledge of Web and JavaScript technologies is required
to support the NetIs service. The monitoring system will be evolved and updated following operational
experience.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>ATLAS</given-names>
            <surname>Collaboration 2008 The ATLAS</surname>
          </string-name>
          <article-title>Experiment at the CERN Large Hadron Collider, JINST 3 S08003 doi</article-title>
          :10.1088/
          <fpage>1748</fpage>
          -0221/3/08/S08003
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>D.</given-names>
            <surname>Savu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Al-Shabibi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Martin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Sjoen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Batraneanu</surname>
          </string-name>
          and
          <string-name>
            <surname>S.</surname>
          </string-name>
          <article-title>Stancu 2010 Integrated System for Performance Monitoring of the ATLAS TDAQ Network</article-title>
          ,
          <source>Journal of Physics: Conference Series. 331 052031 doi:10</source>
          .1088/
          <fpage>1742</fpage>
          -6596/331/5/052031
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3] RRDtool: https://oss.oetiker.ch/rrdtool/index.en.html [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Sicoe</surname>
          </string-name>
          , G. Lehmann, Luca Magnoni,
          <string-name>
            <given-names>S.</given-names>
            <surname>Kolos</surname>
          </string-name>
          ,
          <string-name>
            <surname>I.</surname>
          </string-name>
          <article-title>Soloviev 2012 A persistent back-end for the ATLAS TDAQ online information service (P-BEAST)</article-title>
          ,
          <source>Journal of Physics: Conference Series</source>
          <volume>368</volume>
          (
          <year>2012</year>
          ) 012002 doi:10.1088/
          <fpage>1742</fpage>
          -6596/368/1/012002
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [5] Matplotlib: https://matplotlib.org/ [6] Django: https://www.djangoproject.com/ [7]
          <string-name>
            <given-names>JavaScript</given-names>
            <surname>Tree</surname>
          </string-name>
          : https://dhtmlx.com/docs/products/dhtmlxTree/ [8] Grafana: https://grafana.com/
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>