Monitor Enterprise Vault Vault cache syncronization

Hi Readers,

We are having some issues with Vault sync for clients & these issues always get resolved by restarting of EnterpriseVault services.

Although we are working on a permanent fix but in the mean while we have created a script that will monitor folder if the new files are getting

created for the day. If files are not getting created than it will send us email alert.

Script can be downloaded from below link:

https://github.com/VikasSukhija/Downloads/blob/master/MonitorVaultCache.zip

Define the Variables inside the .ps1 file:

$email1 = “Vikassukhija@labtest.com”

$fromadd = “VaultCacheMonitoring@labtest.com”

$smtpserver =”smtpserver”

$EvMbx = @(“Server1″,”Server2″,”Server3″,”Server4″,”Server5”) # Define the servers## 

$path = “\\$_\e$\Cache\VCBuilds”  ##### Define Remote path, In our case ###folder to be monitored on the server was in E: drive   (e:\cache\vcbuilds)###################

After this schedule the batch file or to run manully just execute it.

You can moddify the condition accordingly, We are monitoring for a day(you can do for hours or mins.

$items=Get-ChildItem $path  | where {($_.LastWriteTime -le $date1) -and ($_.LastWriteTime -gt $date2)}

################################################################################## 
#       Author:Vikas Sukhija 
#       Reviewer:  
#       Date: 09/30/2014 
#       Description: Monitor vault cache 
################################################################################## 
 
$date = get-date -format d 
# replace \ by - 
$time = get-date -format t 
$month = get-date  
$month1 = $month.month 
$year1 = $month.year 
 
$date = $date.ToString().Replace(“/”, “-”) 
 
$time = $time.ToString().Replace(":""-"$time = $time.ToString().Replace(" """) 
 
$log1 = ".\Logs" + "\" + "JNLCount_" + $date + "_" + $time + "_.log" 
 
################Define Variables############ 
$email1 = "Vikassukhija@labtest.com" 
$fromadd = "VaultCacheMonitoring@labtest.com" 
$smtpserver ="smtpserver" 
 
$date1 = get-date 
$date2 = get-date -Hour 0 -Minute 0 -Second 0 
 
$EvMbx = @("Server1","Server2","Server3","Server4","Server5"# Define the servers##  
###############that needs folder monitoring############################ 
 
########################################################################## 
 
$EvMbx | foreach-object { 
 
$path = "\\$_\e$\Cache\VCBuilds"  ##### Define Remote path in our case folder to be monitored######### 
##############on the server was in E: drive (e:\cache\vcbuilds)################### 
 
$items=Get-ChildItem $path  | where {($_.LastWriteTime -le $date1-and ($_.LastWriteTime -gt $date2)} 
 
if($items -eq $null) 
{ 
Write-host "Vcbuild folder is not updating for $_ server EV services need restart" -foregroundcolor red 
 
#SMTP Relay address 
$msg = new-object Net.Mail.MailMessage 
$smtp = new-object Net.Mail.SmtpClient($smtpServer) 
 
#Mail sender 
$msg.From = $fromadd 
#mail recipient 
$msg.To.Add($email1$msg.Subject = "WARNING : Vault cache Sync not working server $_ :ACtion: Restart Vault Enterprise Vault Admin Service" 
$smtp.Send($msg) 
 
} 
else  
{ 
Write-host "$_ Count: "$items.count"" -foregroundcolor Green 
} 
 
} 
 
################################################################################## 
###############################################error reprting###################### 
if ($error -ne $null) 
      { 
#SMTP Relay address 
$msg = new-object Net.Mail.MailMessage 
$smtp = new-object Net.Mail.SmtpClient($smtpServer) 
 
#Mail sender 
$msg.From = $fromadd 
#mail recipient 
$msg.To.Add($email1$msg.Subject = "vault cache rebuild Mon Script error" 
$msg.Body = $error 
$smtp.Send($msg) 
       } 
  else 
 
      { 
    Write-host "no errors till now" -foregroundcolor Green 
      } 
######################################################################################
 Apart from this script, we are checking the vault cache  by creating a batch file:

On running the batch file we see the result about Vault Cache status on servers.

Capture

 

Tech Wizard

https://techwizard.cloud

https://syscloudpro.com/

 

 

Leave a comment