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: Experimental
npm install
Fork and edit config.js
or config_scripts.js
with your HOMER API_SERVER
and API_PATH
details
cp config.js myconfig.js
Link: working example
Each SCRIPTS entry defines a timed function returning a valid JSON object
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); } } ] };
Link: working example
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
{ "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" }
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' } ] };
nodejs statsstrmr.js -c ./myconfig.js
Copy your final application parameters for API and LOGS monitoring in config.js
and run forever
npm forever
Learn how to use this extension with real data on the HOMER Wiki
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.