miércoles, 20 de junio de 2018

Script VBS, para PRTG - time

Se necesita tomar la diferencia de tiempo entre un servidor windows y su controlador de dominio.
sensor exe-script
_____________________________________________________
VBScript Script File(.vbs)
_____________________________________________________

hor=Hour(time)
min= minute(time)
seg= second(time)

time1=(hor*3600)+(min*60)+seg
Wscript.Echo time1&":ok"


_____________________________________________________
PRTG - factory sensor
_____________________________________________________

#1:Controlador de Domino                                    
Channel(12471,2)

#2:servidor                              
Channel(12473,2)

#3:diferencia tiempo                                 
Channel(12471,2)-Channel(12473,2) 

Script para comparar hora local con servidor NTP, LINUX


#!/bin/bash
let var1=10#$(ntpdate -q ntp.shoa.cl |grep -o "..:..:.."| sed -e 's/://g')
let var2=10#$(date |grep -o "..:..:.."|sed -e 's/://g')
let var3=($var1-$var2)
if [[ $var3 -eq 0 ]]; then
# success
echo 0:$var3:time ok
else
# failure
echo 1:0:revisar time
fi