SlapOS Home SlapOS

    How To Add Monitoring Stack

    How to add monitoring stack
    • Last Update:2022-11-14
    • Version:002
    • Language:en

    Agenda

    • Monitoring Stack
    • Add Monitoring Stack to html5as-base
    • Verification

    This tutorial describes how to add the monitoring stack to a software release using html5as-base as an example.

    Here is the commit introducing this functionality to html5as Software release: commit diff.

    Monitoring Stack

    • Provides promises to track the state of a service over time
    • Provides a dedicated webservice to remotely monitor the service
    • Bonus: Includes the logrotate stack

    The monitor stack is used in all productions instance. It is an essential component to monitor the internal of a service with the necessary granularity.

    Monitor App

    Monitor app for a Service

    In the monitor app that uses the monitor webservices to aggregate data, you can see the history of failing services.

    Add monitor stack in software.cfg

    The Monitor stack needs to be extended in software.cfg.

    Additionally the instance template for monitor needs to be provided to html5as instance. So it needs to be passed to the local instance template

    [buildout]
    extends =
      ...
    # Extend monitoring stack to provide necessary tools for monitoring
      ../../stack/monitor/buildout.cfg
    
    ...
    [template-cfg]
    ...
    context =
    ...
      key template_monitor monitor2-template:output

    Add monitor template

    In instance.cfg.in, add the monitor instance template to [profile-common].

    [profile-common]
    ...
    template_monitor = {{ template_monitor }}

    Extend Monitor Instance Template

    In instance_html5as.cfg.in extend the monitor instance template to include monitor sections.

    [buildout]
    ...
    # Instance profile extends monitoring stack
    extends = {{ parameter_list['template_monitor'] }}
    

    Update md5sums

    Refer How To Move to md5sum automatic update to update md5sum:

    $ cd ~/srv/project/slapos/software/html5as-base
    $ ../../update-hash

    Validation

    1. Locate runner/software/{software-hash}/
    2. Display template-monitor.cfg

    Locate {software-hash}

    Since the software.cfg has been modified, it requires to be re-compiled by

    $ slapos node software --all
    

    Once it finished, locate the {software-hash} file at runner/software/{software-hash}/

    template-monitor.cfg

    As template_monitor has been defined, you can find template-monitor.cfg is now present at runner/software/{software-hash}/template-monitor.cfg.