Skip to content

Instantly share code, notes, and snippets.

@pegasuskim
pegasuskim / logstash.conf
Created November 17, 2016 09:30 — forked from dbaba/logstash.conf
LogStash configuration file for Storm
input {
stdin {
type => "stdin-type"
}
file {
type => "syslog"
path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ]
start_position => "beginning"
}
@pegasuskim
pegasuskim / cpu.js
Created August 16, 2016 04:54 — forked from bag-man/cpu.js
How to calculate the current CPU load with Node.js; without using any external modules or OS specific calls.
var os = require("os");
//Create function to get CPU information
function cpuAverage() {
//Initialise sum of idle and time of cores and fetch CPU info
var totalIdle = 0, totalTick = 0;
var cpus = os.cpus();
//Loop through CPU cores