/usage-stats-handler

Backend for handling usage statistic reports from OpenNMS instances

Primary LanguageTypeScriptApache License 2.0Apache-2.0

usage-stats-handler

How to test

  • Make sure the node.js installed on the system
  • Change to the project folder and run the following command
npm install
  • Start elastic search docker container first
docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.6.2
  • Run the following command to start the server
npm start

Docker development

  • Run Usage Stats Handler, Elasticsearch and Grafana
docker-compose up --build --abort-on-container-exit --remove-orphans --force-recreate
  • Note: At times elasticsearch hangs on startup, to fix this either run it again and/or run
docker system prune

Testing with Elasticsearch

  • Running test/opennms-test.http in Intellij to test or using the curl to post report
  • Using the following command to verify the report saved
curl -v -X POST --location "http://localhost:9200/opennms_log/_count?pretty"
curl -v -X POST --location "http://localhost:9200/opennms_system/_count?pretty"
  • Visualise the grafana graph update with new values on a refresh

Running in the production environment

npm start