1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| echo off
tskill stunnel
set server=127.0.0.1:25
set login=xxxxx@xxxxxxx.com
set password=idmutuelle
set sender=xxxxx@xxxxxxx.com
set recipient=xxxxx@xxxxxxx.com
set recipient2=xxxxx@xxxxxxx.com
set recipient3=xxxxx@xxxxxxx.com
START stunnel
:loop
for /F %%i in (routeurs.txt) do call :ping %%i
goto loop
:ping
If %1==xxx.xxx.xxx.xxx set nom=ALES
If %1==xxx.xxx.xxx.xxx set nom=DOUAI
If %1==xxx.xxx.xxx.xxx set nom=FREYMING
If %1==xxx.xxx.xxx.xxx set nom=GARDANNE
If %1==xxx.xxx.xxx.xxx set nom=HENIN
If %1==xxx.xxx.xxx.xxx set nom=LENS
If %1==xxx.xxx.xxx.xxx set nom=FORBACH
If %1==xxx.xxx.xxx.xxx set nom=BETHUNE
If %1==xxx.xxx.xxx.xxx set nom=SARREGUEMINES
If %1==xxx.xxx.xxx.xxx set nom=MAELIA
If %1==xxx.xxx.xxx.xxxset nom=EOSA
If %1==xxx.xxx.xxx.xxx set nom=SOPRA
If %1==xxx.xxx.xxx.xxx set nom=NANTES
If %1==xxx.xxx.xxx.xxxset nom=IMA1
If %1==xxx.xxx.xxx.xxx5 set nom=IMA2
If %1==xxx.xxx.xxx.xxx set nom=ServeurEVOLAN
If %1==xxx.xxx.xxx.xxx set nom=ServeurASIMUT
If %1==xxx.xxx.xxx.xxx set nom=AS400
If %1==xxx.xxx.xxx.xxx set nom=ServeurFAX
If %1==xxx.xxx.xxx.xxx set nom=ServeurMICOM
If %1==xxx.xxx.xxx.xxx set nom=ServeurZEN
If %1==xxx.xxx.xxx.xxx set nom=Cardinet
If %1==xxx.xxx.xxx.xxx set nom=RouteurSFRCourcelles
REM If %1==192.168.255.38 set nom=CEGEDIM
If exist no_reponse/%nom%.txt goto no_reponse
ping -n 1 %1 | find /i "ttl=">NUL
If exist no_reponse/%nom%.txt goto no_reponse
if %errorlevel%==0 echo %nom% :OK
if %errorlevel%==1 echo %nom% :PANNE& Blat.exe -server %server% -f %sender% -to %recipient% -s "[PANNE] reseau sur %nom%!" -body "La connexion reseau avec %nom% a l'adresse %1 est perdue." -u %login% -pw %password% & echo %1 >> no_reponse/%nom%.txt & echo la connexion avec %nom% à été perdue le %date% à %time% >> no_reponse/LOGS/log%nom%.txt
if %errorlevel%==1 echo %nom% :PANNE& Blat.exe -server %server% -f %sender% -to %recipient2% -s "[PANNE] reseau sur %nom%!" -body "La connexion reseau avec %nom% a l'adresse %1 est perdue." -u %login% -pw %password%
REM if %errorlevel%==1 echo %nom% :PANNE& Blat.exe -server %server% -f %sender% -to %recipient3% -s "[PANNE] reseau sur %nom%!" -body "La connexion reseau avec %nom% a l'adresse %1 est perdue." -u %login% -pw %password%
goto fin
:no_reponse
ping -n 1 %1 | find /i "ttl=">NUL
if %errorlevel%==1 echo %nom% :PANNE
if %errorlevel%==0 echo %nom% :"CONNEXION RETABLIE" & Blat.exe -server %server% -f %sender% -to %recipient% -s "Connexion %nom% OK!" -body "La connexion reseau avec %nom% a l'adresse %1 est retablie." -u %login% -pw %password% & del no_reponse\%nom%.txt & echo la connexion avec %nom% à été rétablie le %date% à %time% >> no_reponse/LOGS/log%nom%.txt
if %errorlevel%==0 echo %nom% :"CONNEXION RETABLIE" & Blat.exe -server %server% -f %sender% -to %recipient2% -s "Connexion %nom% OK!" -body "La connexion reseau avec %nom% a l'adresse %1 est retablie." -u %login% -pw %password%
REM if %errorlevel%==0 echo %nom% :"CONNEXION RETABLIE" & Blat.exe -server %server% -f %sender% -to %recipient3% -s "Connexion %nom% OK!" -body "La connexion reseau avec %nom% a l'adresse %1 est retablie." -u %login% -pw %password%
:fin |
Partager