This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
stdin { | |
type => "stdin-type" | |
} | |
file { | |
type => "syslog" | |
path => [ "/var/log/*.log", "/var/log/messages", "/var/log/syslog" ] | |
start_position => "beginning" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* express 처음에 init 하시면 app.js 를 비롯하여 여러 디렉토리가 생기는데 | |
* logs 디렉토리에 아무것도 안남는다고 의문을 가지신 분에게 도움이 될거 같습니다. | |
* connect의 middleware logger 는 기본이 stdout 으로 출력하고 있었네요. | |
* http://senchalabs.github.com/connect/middleware-logger.html | |
* manual을 살펴보니 stream options 이 있었군요. | |
* 한번 생각나서 fs core module의 createWriteStream 을 사용하여 해봤더니 잘되네요. | |
* 다른 방법도 있으신분은 알려주세요 | |
*/ | |
var fs = require('fs'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
pipe { | |
tags => [ "sar", "loadavg" ] | |
command => "env LANG=C sar -q 5" | |
} | |
pipe { | |
tags => [ "sar", "cpu" ] | |
command => "env LANG=C sar -u 5" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# The MySQL database server configuration file. | |
# | |
# You can copy this to one of: | |
# - "/etc/mysql/my.cnf" to set global options, | |
# - "~/.my.cnf" to set user-specific options. | |
# | |
# One can use all long options that the program supports. | |
# Run program with --help to get a list of available options and with | |
# --print-defaults to see which it would actually understand and use. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modules | |
var redis = require('redis'); | |
var Step = require('step'); | |
// config file | |
var config = require('config'); | |
// mysql client connect | |
var mysql = require('mysql'); | |
var connection = mysql.createConnection({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modules | |
var redis = require('redis'); | |
var Step = require('step'); | |
// config file | |
var config = require('config'); | |
// mysql client connect | |
var mysql = require('mysql'); | |
var connection = mysql.createConnection({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# The following arguments are passed to the script: | |
# | |
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port> | |
MASTER_IP=$6 | |
VIP=172.17.0.101 | |
NETMASK=16 | |
IF=eth0 | |
MY_IP=$(ip addr show dev $IF | grep "global $IF" | head -1 | sed -e "s/^.*inet \(.*\)\/$NETMASK .*$/\1/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# redis-notify.sh | |
MAIL_FROM="[email protected]" | |
MAIL_TO="[email protected]" | |
if [ "$#" = "2" ]; then | |
mail_subject="Redis Notification" | |
mail_body=`cat << EOB | |
============================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
_DEBUG="on" | |
DEBUGFILE=/tmp/sentinel_failover.log | |
VIP='10.125.125.30' | |
MASTERIP=${6} | |
MASK='24' | |
IFACE='eth0' | |
MYIP=$(ip -4 -o addr show dev ${IFACE}| grep -v secondary| awk '{split($4,a,"/");print a[1]}') | |
DEBUG () { |
OlderNewer