Skip to content

Prerequisites

Prerequisites in Uptime & Downtime Report Configuration.

5 min read Updated SS

Prerequisites#

  • Shell access to the HEAL primary node and to the database migration directory under the HEAL installation home (a1home).
  • OpenSearch admin credentials, and the OpenSearch coordinator IP address and port.
  • Grafana admin access for adding data sources and importing dashboards.
  • The report packages Uptime_sql_files.zip and Downtime_Report.tar.gz. These are delivered with the HEAL release package — contact HEAL Support (support@healsoftware.ai) if you do not have them.
  • Consul key-value entries for OpenSearch and the Percona database populated on the primary node (the downtime script reads its connection details from Consul — see the key list below).

Configure the Uptime Report#

The uptime report requires new KPI definitions in the HEAL database, followed by a manual KPI-to-instance mapping in the Control Center for existing instances.

Register the uptime KPIs#

  1. Navigate to the migration directory:

    a1home/Appsone_Service/migration-db/appsone
    
  2. Copy the SQL files from Uptime_sql_files.zip into the appsone directory.

    Note: Copy only the files that are missing from the directory.

  3. Navigate to the migration root:

    a1home/Appsone_Service/migration-db
    
  4. Execute the migrate command, substituting your database IP, port, and credentials:

    env 'MIGRATION-DIR=./appsone' SUBNAME=//<db ip>:<port>/appsone username=<db username> password=<db password> java -jar migrate-db.jar --migrate
    
  5. Deploy the latest CA (Control Agent) build.

Map the KPIs in the Control Center#

Note: For existing instances, map the new KPIs to each instance manually in the Control Center so that data collection starts for them. Instances discovered after the migration pick the KPIs up automatically.

  1. Select the required Account and navigate to Setup > Monitoring > Services.
  2. Select the specific service.
  3. On the Manage Service page, click Metric Details (Host level).
  4. On the Edit Metric Details page, locate any KPI that shows No under Mapped to instance and click the KPI.
  5. Under Bulk actions, select Edit Details.
  6. Click the mapping toggle button to map the KPI to the instance, then click Save.
  7. Repeat for every uptime KPI listed below.
  8. Restart the Redis microservice so the new mappings take effect:

    nomad stop heal-redis-microservice
    nomad run heal-redis-microservice.nomad
    

Map all of the following KPIs:

  • Uptime — supported on RHEL, CentOS, Solaris, AIX, HP-UX, and Windows.
  • The following network KPIs, supported on RHEL only: Received Bytes, Received Errors, Received Dropped, Received Overruns, Transmitted Bytes, Transmitted Errors, Transmitted Dropped, Transmitted Overruns, and Transmitted Collisions.

Configure the Downtime Report#

The downtime report is driven by a wrapper script that reads uptime and maintenance data from OpenSearch and application metadata from the HEAL database. Before running it, add the uptime index template and its ISM retention policy to OpenSearch.

Add the OpenSearch index template#

On the OpenSearch node, register the uptime data collection template. Replace <username>, <password>, <OpenSearch IP>, and <port> with your actual values, and replace <template body> with the contents of the heal_uptime_data_collection_template.json file from the report package:

curl -ku <username>:<password> -XPUT "https://<OpenSearch IP>:<port>/_template/heal_uptime_data_collection_template" -H 'Content-Type: application/json' -d '<template body>'

Add the ISM policy for the uptime indexes#

Still on the OpenSearch node, register the ISM policy. Replace <policy body> with the contents of the ism_heal_uptime_indexes.json file from the report package:

curl -ku <username>:<password> -XPUT "https://<OpenSearch IP>:<port>/_plugins/_ism/policies/ism_heal_uptime_indexes" -H 'Content-Type: application/json' -d '{<policy body>}'

Set up the downtime report script#

  1. Access the primary node and copy Downtime_Report.tar.gz (delivered with the HEAL release package) to it.
  2. Untar the file and open config.sh. The file contains the following parameters:

    # Wrapper script sleep time before iterating through each app name,
    # below value is in seconds
    WRAPPER_SLEEP_INTERVAL=300
    
    # Time diff threshold configure below
    TIME_THRESHOLD=1
    
    #START_TIME="`date -d"yesterday" "+%Y-%m-%d 00:00:00"`"
    #END_TIME="`date -d"yesterday" "+%Y-%m-%d 23:59:59"`"
    
    # Account Name
    ACCOUNT_NAME="<account name>"
    APP_NAMES="<application name>"
    
    ## Provide Opensearch/Elastic Search URL
    ## Ex: OPENSEARCH_URL="http://192.0.2.8:9211"
    OPENSEARCH_IP=$(consul kv get service/opensearch/node1/ip)
    OPENSEARCH_PORT=$(consul kv get service/opensearch/port/cordinator/http)
    OPENSEARCH_URL="https://${OPENSEARCH_IP}:${OPENSEARCH_PORT}"
    
    ## Provide credentials. Leave blank if not applicable
    OPENSEARCH_USER=$(consul kv get service/opensearch/username)
    OPENSEARCH_PASS=$(consul kv get service/opensearch/password/encrypted | base64 -d)
    
    # Mysql details
    DB_IP=$(consul kv get service/perconadb/ip)
    DB_USER=$(consul kv get service/perconadb/username)
    DB_PORT=$(consul kv get service/perconadb/port)
    MYSQL_PWD=$(consul kv get service/perconadb/password_ui | base64 -d)
    export MYSQL_PWD
    
    # This field determines whether instanceIdentifier or instanceName is
    # used to query the heal_maintenence_data index.
    # If instanceIdentifier's value is the instance name, set NAME below.
    # If instanceIdentifier's value is the instance identifier itself, set ID below.
    MAINT_INDEX_ID_VALUE_FLAG="ID"
    
    # FILE_CLEANUP_DETAILS
    CLEANUP_DAYS=5
    

    ACCOUNT_NAME and MAINT_INDEX_ID_VALUE_FLAG are mandatory fields:

    • ACCOUNT_NAME — the HEAL account name to report on.
    • MAINT_INDEX_ID_VALUE_FLAG — determines whether the script queries the heal_maintenance_data index by instanceIdentifier or by instanceName. At the time the script was written, some deployments stored the instance name in the instanceIdentifier field. If the instanceIdentifier values in your index hold instance names, set NAME; if they hold the instance identifier itself, set ID.
    • APP_NAMES (optional) — if multiple application names are provided, the script executes the downtime report for each one in turn. If left blank, the script fetches all applications for the account from the database and runs the report for all of them.
    • To run the report on demand for a specific window, execute the wrapper script with START_TIME and END_TIME arguments:
    ./downtime_wrapper.sh START_TIME=<"YYYY-MM-DD HH:MM:SS"> END_TIME=<"YYYY-MM-DD HH:MM:SS">
    

    For example:

    ./downtime_wrapper.sh START_TIME="1970-01-01 00:00:00" END_TIME="1970-01-01 23:59:59"
    

    Note: The maximum time range for a single run is 7 days.

When the wrapper script executes, it resolves its connections from the following required Consul key-value pairs:

  • service/opensearch/node1/ip
  • service/opensearch/port/cordinator/http
  • service/opensearch/username
  • service/opensearch/password/encrypted (base64-decoded by the script)
  • service/perconadb/ip
  • service/perconadb/username
  • service/perconadb/port
  • service/perconadb/password_ui (base64-decoded by the script)

Schedule the report as a daily cron job#

To collect downtime data continuously every day, run the same wrapper script from cron with the time window derived automatically.

  1. In config.sh, uncomment the START_TIME and END_TIME lines so each run covers the previous day:

    START_TIME="`date -d"yesterday" "+%Y-%m-%d 00:00:00"`"
    END_TIME="`date -d"yesterday" "+%Y-%m-%d 23:59:59"`"
    
  2. Open the crontab for editing:

    crontab -e
    
  3. Add the following line to run the report daily at 04:00:

    0 4 * * * cd <path of downtime report> && ./downtime_wrapper.sh
    

    Note: The schedule can be adjusted as per your requirements.