Influxdb Stats lib
The lib creates high level apis for system resource stats and general statistics functions based on influxdbudp module.
Install
npm install --save stats-influxdb
Usage
var session=; session; //collect current cpu usage (during next 500ms) and send to influxdb as 'cpu,unit=unit1,project=myProject,name=core1,core=40'. Each core is sent separately so data can be aggregated easily.session; //collect current mem usage 'mem,unit=unit1,project=myProject used=2000,used_ratio=70'session; //collect current disk usage 'disk,unit=unit1,project=myProject used=123456,used_ration=20'session; //collect current pid usage 'process,pid=<pid> mem=<mem in byte>,cpu=<cpu percent>'session; //add a value to a label 'count,label=myLabel,unit=unit1,project=myProject value=1'session; //calculate the amount of login attempts for a user. 'count,label=login_endpoint,user="userName",unit=unit1,project=myProject value=1'var time = session; //same as console.time(), start to count time elapsed for a label.var time = session; //Allows for additional tags also.`timeElapsed,label=ftp_upload,name=ftp1`session; //Like console.timeEnd() but you must pass the object returned by .time(), end counting the time elpased. 'timeElapsed,label=ftp_upload,unit=unit1,project=myProject value=<timeElapsed>'session; //customised measurement. 'process,name=nodeProc1,,unit=unit1,project=myProject mem=400,cpu=43'
Test
npm test
License
MIT