Outils pour utilisateurs

Outils du site


Writing /app/www/public/data/meta/centreon/scripts-windows.meta failed
centreon:scripts-windows

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
centreon:scripts-windows [2023/07/05 12:42] – créée michelcentreon:scripts-windows [2024/12/27 06:28] (Version actuelle) – modification externe 127.0.0.1
Ligne 1: Ligne 1:
 ==== check_file.vbs ==== ==== check_file.vbs ====
 <code> <code>
-' 
-' 
 ' Check files under a given path ' Check files under a given path
 ' ============================== ' ==============================
Ligne 2218: Ligne 2216:
 # attention une charge trop importante peu faire planter la machine. # attention une charge trop importante peu faire planter la machine.
 # à vos risques est périle. # à vos risques est périle.
 +</code>
 +==== remote_ping.bat ====
 +<code>
 +@ECHO OFF
 +SETLOCAL
 +
 +REM ####### ENSURE ALL REQUIRED INFO IS PRESENT --UNIX VAR--######
 +@ECHO %1%2%3%4%5%6|FIND "ARG"
 +IF NOT ERRORLEVEL 1 GOTO MSEOF
 +
 +REM ####### ENSURE ALL REQUIRED INFO IS PRESENT --WIN VAR--######
 +IF "%1"=="" GOTO MSEOF
 +IF "%2"=="" GOTO MSEOF
 +IF "%3"=="" GOTO MSEOF
 +IF "%4"=="" GOTO MSEOF
 +IF "%5"=="" GOTO MSEOF
 +IF "%6"=="" GOTO MSEOF
 +
 +REM PAUSE
 +
 +@ECHO %4 |FIND "%%%"
 +IF NOT ERRORLEVEL 1 GOTO MSEOF
 +@ECHO %6 |FIND "%%%"
 +IF NOT ERRORLEVEL 1 GOTO MSEOF
 +
 +REM ####### ASSIGN EACH TO A VARIABLE TO REFERENCE IT LATER..######
 +SET IP=%1
 +SET PKT=%2
 +SET WRTA=%3
 +SET WPL=%4
 +SET CRTA=%5
 +SET CPL=%6
 +
 +REM ######## CAPTURE FRESH DATA TO A FILE #######
 +REM 20120920 TO AVOID COLLISIONS DURING CONCURRENT CALLS CREATE A SEMI-RANDOM FILE NAME
 +SET RANDOMFILENAME=%RANDOM%-%1-TMP
 +@ECHO ->%RANDOMFILENAME%
 +
 +PING %IP% -n %PKT% >>%RANDOMFILENAME%
 +
 +REM ######## PICKOUT THE DATA WE NEED FROM THE FILE #######
 +FOR /F "TOKENS=11 DELIMS= " %%K IN ('findstr /c:"Lost" %RANDOMFILENAME%') DO SET LST=%%K
 +
 +IF ERRORLEVEL 1 GOTO TIMEOUT
 +FOR /F "TOKENS=9 DELIMS= " %%K IN ('findstr /c:"Average" %RANDOMFILENAME%') DO SET AVG=%%K
 +
 +
 +REM PAUSE
 +DEL /Q %RANDOMFILENAME%
 +
 +
 +REM ######## TRIM THE VARIABLES...####
 +SET AVG=%AVG:M=%
 +SET AVG=%AVG:S=%
 +
 +:TIMEOUT
 +SET LST=%LST:(=%
 +SET LST=%LST:~0,-1%
 +
 +
 +REM ######## NOW THE FUN STUFF, COMPARE THE WARNING, CRITICAL VALUES..####
 +
 +IF %LST% GEQ %CPL% GOTO CPL-2
 +IF %AVG% GEQ %CRTA% GOTO CRTA-2
 +IF %LST% GEQ %WPL% GOTO WPL-1
 +IF %AVG% GEQ %WRTA% GOTO WRTA-1
 +
 +REM PAUSE
 +
 +GOTO OK-0
 +
 +:CPL-2
 +@ECHO REMOTE CONNECTION TO %IP% IS DOWN: LOSS=%LST%%% (%PKT% PKTS)^|rta=%CRTA%;%WRTA% pl=%LST%%%;%WPL%;%CPL%
 +REM GOTO EOF
 +@EXIT 2
 +
 +:CRTA-2
 +@ECHO REMOTE CONNECTION TO %IP% IS DOWN: LOSS=%LST%%%, AVE=%AVG%ms (%PKT% PKTS)^|rta=%AVG%ms;%WRTA%;%CRTA% pl=%LST%%%;%WPL%;%CPL%
 +REM GOTO EOF
 +@EXIT 2
 +
 +:WPL-1
 +@ECHO REMOTE CONNECTION TO %IP% IS SLOW: LOSS=%LST%%%, AVE=%AVG%ms (%PKT% PKTS)^|rta=%WRTA%;%CRTA% pl=%LST%%%;%WPL%;%CPL%
 +REM GOTO EOF
 +@EXIT 1
 +
 +:WRTA-1
 +@ECHO REMOTE CONNECTION TO %IP% IS SLOW: LOSS=%LST%%%, AVE=%AVG%ms (%PKT% PKTS)^|rta=%AVG%ms;%WRTA%;%CRTA% pl=%LST%%%;%WPL%;%CPL%
 +REM GOTO EOF
 +@EXIT 1
 +
 +:OK-0
 +@ECHO REMOTE CONNECTION TO %IP% IS UP: LOSS=%LST%%%, AVE=%AVG%ms (%PKT% PKTS)^|rta=%AVG%ms;%WRTA%;%CRTA% pl=%LST%%%;%WPL%;%CPL%
 +REM GOTO EOF
 +@EXIT 0
 +
 +:MSEOF
 +@ECHO USAGE:PING_REMOTE ^ ^^,^ ^,^
 +@ECHO EXAMPLE: /USR/LOCAL/NAGIOS/LIBEXEC/CHECK_NRPE -H 172.19.48.139 -C PING_REMOTE -T 90 -A 172.19.88.30 65 450,1 700,5 (FROM NAGIOS SVR.)
 +@ECHO : PING_REMOTE 192.168.0.1 5 200,1 400,10 (FROM A LOCAL WIN WKS WHERE PING_REMOTE.BAT RESIDES)
 +@ECHO : (WPL\CPL ARE IN PERCENT, WITHOUT THE "%%%" SYMBOL!!)
 +
 +REM GOTO EOF
 +@EXIT 0
 +
 +:EOF 
 +</code>
 +==== Exchange ====
 +- Exchange-serverCertificate
 +<code>
 +# Exchange 2013 Server Certificat
 +
 +
 +
 +$status = 0
 +$descr=""
 +$date= Get-Date
 +add-pssnapin Microsoft.Exchange.Management.PowerShell.SnapIn
 +
 +
 +$GetCrt = Get-ExchangeCertificate | Where-Object {$_.Status -ne "Valid"}
 +foreach ( $item in $GetCrt ){
 + $status = 2
 + #$NameCrt = $item.DnsNameList
 +    $NameCrt = $item.Subject
 + $NameCrt2 = $NameCrt.Punycode
 + $DateCrt = $item.NotAfter
 + $ValidCrt = $item.Status
 + $descr = "$descr Certificat: $NameCrt (Due Date: $DateCrt) ,`n"
 +    if ($DateCrt -lt $date ){
 + $status = 1
 + }
 + }
 +
 +switch ($status)
 + {
 + 0 {"OK: Tous les certificats sont valides."}
 + 1 {"CRITICAL: Certificat expire: `n $descr"; $status =2}
 + 2 {"CRTICIAL: Certificat '$NameCrt' invalide "}
 + }
 +
 +exit $status
 +</code>
 +- Exchange-serverComponentHealth
 +<code>
 +# Exchange 2013 Server Component Health Check
 +
 +
 +Param(
 +  [string]$ExchServ
 +)
 +
 +$status = 0
 +
 +add-pssnapin Microsoft.Exchange.Management.PowerShell.SnapIn
 +
 +
 +#Get-ServerComponentState -Identity $ExchServ | Where-Object { $_.State -ne "Active" } | Where-Object { $_.Component -ne  "ForwardSyncDaemon"  } | Where-Object { $_.Component -ne  "ProvisioningRps"  }
 +$SSE2 = Get-ServerComponentState -Identity $ExchServ | Where-Object { $_.State -ne "Active" } | Where-Object { $_.Component -ne  "ForwardSyncDaemon"  } | Where-Object { $_.Component -ne  "ProvisioningRps"  }
 +Get-ServerComponentState -Identity $ExchServ | Where-Object { $_.State -ne "Active" } | Where-Object { $_.Component -ne  "ForwardSyncDaemon"  } | Where-Object { $_.Component -ne  "ProvisioningRps"  } | Export-Csv -Path C:\Temp\LogExch\TempSRVC.csv -Delimiter ";"
 +$SSE223 = $SSE2.State
 +$ImptpsCSV = Import-Csv -Path C:\Temp\LogExch\TempSRVC.csv -Delimiter ";"
 +if ( $SSE223 -eq "Inactive" ) {
 + # At least one health check is inactive
 + $status=2
 + foreach ( $Srvc in $ImptpsCSV ){
 + $Name = $Srvc.Component}
 + $desc = "$Name checks is KO"
 + }
 +if ($status -eq "2") {
 + Write-Host "CRITICAL: $desc"
 +} elseif ($status -eq "0") {
 + Write-Host "All Service Active for $ExchServ"
 +     
 +
 +
 +exit $status
 +</code>
 +- Exchange-serverDB
 +<code>
 +# Exchange 2013 Server DB
 +
 +
 +<#Param(
 +  [string]$ServerExch
 +)
 +#>
 +
 +$status = 0
 +$descr = ""
 +add-pssnapin Microsoft.Exchange.Management.PowerShell.SnapIn
 +
 +$GetDB = Get-MailboxDatabase | Where-Object {$_.IsValid -ne "True"}
 +foreach ( $item in $GetDB ){
 + $status = 2
 + $ID = $Item.Name
 + $descr = "$descr DB: $ID is not Valid ,"
 + }
 +
 +if ( $status -ne 0 ) { 
 + Write-Host "CRITICAL: $descr"
 + }
 +else { 
 + Write-Host "OK: Toutes les bases sont valides."
 + }
 +
 +exit $status
 +</code>
 +- Exchange-serverPoolIIS
 +<code>
 +# Exchange 2013 Server Pool IIS
 +
 +
 +Param(
 +  [string]$ExchServ
 +)
 +
 +$status = 0
 +add-pssnapin Microsoft.Exchange.Management.PowerShell.SnapIn
 +
 +
 +Invoke-Command -ComputerName $ExchServ -ScriptBlock { 
 +$POOL = Get-WebAppPoolState | select ItemXPath,Value | Where-Object { $_.Value -ne "Started" } | Where-Object { $_.ItemXPath -ne "/system.applicationHost/applicationPools/add[@name='.NET v4.5']" } | Where-Object { $_.ItemXPath -ne "/system.applicationHost/applicationPools/add[@name='.NET v4.5 Classic']" }
 +Clear-Content c:\temp\ResultPoolIIS.txt -ErrorAction SilentlyContinue
 +if ( $POOL -ne $Null ){
 + Add-Content -Path c:\temp\ResultPoolIIS.txt -Value "Nom du pool:" }
 +foreach ( $item in $POOL ) {
 + $item1 = $item.ItemXPath
 + $Name = ($item1.split("'")[1])
 + Add-Content -Path c:\temp\ResultPoolIIS.txt -Value "$Name"
 +
 +
 +
 +$PoolLog = Get-Content -Path "\\$ExchServ\C$\temp\ResultPoolIIS.txt" -ErrorAction SilentlyContinue
 +if ( $PoolLog -ne $Null ) { 
 + $status =2
 + Write-Host "CRITICAL: Pool problematique sur le serveur $ExchServ : $PoolLog"
 + }
 +else { 
 + Write-Host "OK: Pas de Pool problematique sur le serveur $ExchServ"
 + }
 +
 +exit $status
 </code> </code>
centreon/scripts-windows.1688560931.txt.gz · Dernière modification : 2024/12/27 06:28 (modification externe)