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
package mongo | |
import ( | |
"github.com/globalsign/mgo" | |
"github.com/prometheus/client_golang/prometheus" | |
) | |
type mgoCollector struct { | |
clusterDesc *prometheus.Desc | |
masterConnDesc *prometheus.Desc |
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
'use strict'; | |
const bunyan = require('bunyan'); | |
const Promise = require('bluebird'); | |
const amqp = require('amqplib'); | |
const os = require('os'); | |
const CBuffer = require('CBuffer'); | |
const util = require('util'); | |
const EventEmitter = require('events').EventEmitter; |
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
filter { | |
if [type] == "mongo-log" { | |
grok { | |
match => {"message" => "%{TIMESTAMP_ISO8601:timestamp}\s+%{MONGO3_SEVERITY:severity}\s+%{MONGO3_COMPONENT:component}\s+(?:\[%{DATA:context}\])?\s+%{GREEDYDATA:message}"} | |
overwrite => [ "message" ] | |
remove_tag => ["beats_input_codec_plain_applied"] | |
} | |
if [context] =~ "^conn" { | |
grok { |
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
# For your nodejs app | |
# Change your node.js version here | |
FROM node:latest | |
MAINTAINER Xu Zhipei "xuzhipei@gmail.com" | |
RUN groupadd -r app && useradd -r -m -g app app | |
ENV UBUNTU_MIRROR http://ftp.sjtu.edu.cn |
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
registry=https://registry.npm.taobao.org/ | |
loglevel=http | |
python=python2.7 | |
phantomjs_cdnurl=http://cnpmjs.org/downloads | |
#phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs | |
selenium_cdnurl=https://npm.taobao.org/mirrors/selenium | |
electron_mirror=https://npm.taobao.org/mirrors/electron/ | |
sass_binary_site=https://npm.taobao.org/mirrors/node-sass |
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
const gulp = require('gulp'), | |
gulpLoadPlugins = require('gulp-load-plugins'); | |
const $ = gulpLoadPlugins(); | |
gulp.task('babel', () => { | |
return gulp.src('src/**/*.js') | |
.pipe($.babel()) | |
.pipe(gulp.dest('dist')); | |
}); |
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
import nconf from 'nconf'; | |
import mongoose from 'mongoose'; | |
import Promise from 'bluebird'; | |
import logger from './winston'; | |
import _s from 'underscore.string'; | |
import models from '../models/index'; | |
mongoose.Promise = Promise; |
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
import mkdirp from 'mkdirp'; | |
import winston from 'winston'; | |
import nconf from 'nconf'; | |
import moment from 'moment'; | |
//import 'winston-logstash'; | |
//import {Mail} from 'winston-mail'; | |
const logDir = nconf.get('logDir'); | |
mkdirp.sync(logDir); |
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
'use strict'; | |
var _ = require('underscore'); | |
exports.randomString = function (length) { | |
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz'; | |
length = length ? length : 32; | |
var string = ''; | |
for (var i = 0; i < length; i++) { | |
var randomNumber = Math.floor(Math.random() * chars.length); |
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
'use strict'; | |
var _ = require('underscore'), | |
Excel = require('exceljs'), | |
Promise = require('bluebird'); | |
exports.getColumns = function (fieldMap, fields) { | |
var data = _.pick.apply(null, [fieldMap].concat(fields)); | |
return _.map(data, function (v, k) { | |
return { |