Skip to content

Instantly share code, notes, and snippets.

View theeye-io's full-sized avatar

TheEye.io theeye-io

View GitHub Profile
@theeye-io
theeye-io / CheckExchangeMailQueue2013.ps1
Last active November 25, 2016 15:41
CheckExchangeMailQueue2013
#
# copied some parts of this script from
# https://gallery.technet.microsoft.com/office/e0bb250e-e699-4c6c-a5be-f1af245a2219
#
#$queueThreshold=$args[0]
$queueThreshold=50
#$domainUser=$args[1]
#$domainUser=
@theeye-io
theeye-io / checkDriveFreeSpaceWMIC.bat
Last active December 21, 2016 15:14
checkDriveFreeSpaceWMIC.bat
rem compatible from windows version 2003. Ejemplo C:,3000000 (bytes)
@echo off
set drive=%1
shift
set threshold=%1
shift
rem woooojojojo! todo esto solo para obtener el espacio libre .
for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='%drive%'" get FreeSpace /format:value`) do set FreeSpace=%%x
@theeye-io
theeye-io / WIN_checkDriveFreeSpace.js
Created November 23, 2016 13:59
WIN_checkDriveFreeSpace.js
var exec = require('child_process').exec;
var drive = process.argv[2];
var threshold = process.argv[3];
var cmd = 'fsutil volume diskfree ' + drive;
var defaultPercentage = 0.2; // 20%
console.log('checking drive ' + drive + ' free space. running => ' + cmd);
exec(cmd, function(err, stdout, stderr){
@theeye-io
theeye-io / checkResponseTime.bat
Created November 23, 2016 14:00
checkResponseTime.bat
echo off
set url=%1
shift
set threshold=%1
shift
set datetime=%date:~-4%_%date:~-7,2%_%date:~-10,2%_%time:~0,2%_%time:~3,2%_%time:~6,2%
set logname=..\tmp\responseTime%datetime%.txt
..\mingw64\bin\curl -o /dev/null -s -w %%{time_total} %url% > %logname%
@theeye-io
theeye-io / WIN_checkDirectoryFreeSpace.js
Created November 23, 2016 14:00
WIN_checkDirectoryFreeSpace.js
var exec = require('child_process').exec;
var dir = process.argv[2];
var limit = process.argv[3];
var cmd = 'powershell -noprofile -command "(ls -r ' + dir + ' |measure -s Length).Sum"';
exec(cmd,function(err,stdout,stderr){
if(err){
console.log(err);
console.log(stderr);
return console.log('failure');
@theeye-io
theeye-io / rotateLogFile.bat
Created November 23, 2016 14:01
rotateLogFile.bat
@echo off
set currentdir=%1
echo %currentdir%
shift
set targetdir=%1
echo %targetdir%
shift
set filename=%1
echo %filename%
@theeye-io
theeye-io / checkResponseTime.js
Created November 23, 2016 18:10
check response time with curl and nodejs
var exec = require('child_process').exec;
var url = process.argv[2];
var threshold = parseFloat(process.argv[3]);
var cmd = 'c:\\theeye\\theeyecore\\mingw64\\bin\\curl.exe -o /dev/null -s -w %{time_total} ' + url;
console.log('running ' + cmd);
console.log('checking response time for ' + url + ' is below => ' + threshold);
exec(cmd, function(err, stdout, stderr){
@theeye-io
theeye-io / TimeoutCheck.bat
Created November 25, 2016 17:33
batch script to check timeout using curl
echo off
set arg1=%1
set arg2=%2
shift
shift
..\mingw64\bin\curl -o /dev/null -s -w %%{time_total} %arg1% > ..\tmp\rtime2.txt
set /p VAR=<..\tmp\rtime2.txt
del ..\tmp\rtime2.txt
IF %VAR% GEQ %arg2% (
echo Response time alto! %VAR%, expected %arg2%
@theeye-io
theeye-io / F5_addAndEnableHost.sh
Last active December 1, 2016 20:17
Bash / Expect script for add And enable a node into an old F5 LoadBalancer's pool.
#!/bin/bash
which expect > /dev/null
if [ "$?" -eq "1" ];then echo FAILURE
else
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ];then echo FAILURE Some var is undefined set PASS $1 POOL $2 ipAndPort $3;exit;fi
PASS=$1
POOL=$2
ipAndPort=$3
tempFile=/tmp/resultado
#Variable
@theeye-io
theeye-io / F5_addHost.sh
Last active December 1, 2016 20:25
Bash / Expect script for add a node into an old F5 LoadBalancer's pool.
#!/bin/bash
which expect > /dev/null
if [ "$?" -eq "1" ];then echo FAILURE
else
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ];then echo FAILURE Some var is undefined set PASS $1 POOL $2 ipAndPort $3;exit;fi
PASS=$1
POOL=$2
ipAndPort=$3
tempFile=/tmp/resultado
#Variable