Skip to content

sipcapture/statstrmr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

statstrmr

JSON-HEP Statistics Streamer for HOMER 5.x

Description

statstrmr is a simple tool to stream custom JSON formatted statistics to the HOMER 5 HTTP API
Data can be parsed from streaming JSON logs, or generated in cycles by custom node scripts/functions

Status

  • Status: Experimental

Install

npm install

Config

Fork and edit config.js or config_scripts.js with your HOMER API_SERVER and API_PATH details

cp config.js myconfig.js

📃 SCRIPTS

Each SCRIPTS entry defines a timed function returning a valid JSON object

Configuration example:
var config = {
        API_SERVER: 'http://127.0.0.1',
        API_PATH: '/api/v1/stats/push',
        SCRIPTS: [
                {
                  name: 'Custom Stats',
                  timer : 5000, // milliseconds
                  exec: function(){
                        var value = function(){ // YOUR CODE HERE }
                        var doc = { 'key': value };
                        return JSON.stringify(doc);
                  }
                }
              ]

};

📄 LOGS

Each LOGS entry points at a log streaming valid JSON strings and requires/defines a log path and a (regex) pattern to match the "type" field from each JSON object

JSON Log example:
{ "timestamp": 1457782570, "interval": 10, "streams": 2, "packets": 937, "lost": 0, "late": 0, "lost_perc": 0, "late_perc": 0, "out_of_seq": 0, "delay_min": 19172, "delay_max": 40974, "delay_avg": 30073, "jitter": 3577, "mos": 439, "type": "rtp_stat" }
Configuration example:
var config = {
        API_SERVER: 'http://127.0.0.1',
        API_PATH: '/api/v1/stats/push',
        LOGS: [
                {
                  tag : 'custom_tag',
                  host : 'your_hostname',
                  pattern: 'report_id', // matching JSON: "type":"report_id" 
                  path : '/path/to/your.log'
                }
              ]
};

Test

nodejs statsstrmr.js -c ./myconfig.js

Configure

Copy your final application parameters for API and LOGS monitoring in config.js and run forever

npm forever

Example Output in HOMER 5

Learn how to use this extension with real data on the HOMER Wiki


Developers

Contributions to our projects are always welcome! If you intend to participate and help us improve our software, we kindly ask you to sign a CLA (Contributor License Agreement) and coordinate at best with the existing team via the homer-dev mailing list.


If you use our projects in production, please consider supporting us with a donation

Donate

About

JSON-HEP Statistics Streamer for HOMER 5.x

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published