Hi,
Please use the script for monitoring the PST files creation.Need to provide the monitoring duration time(Min) in the Procedure parameter eg: 10
Note: Please run the below script as custom monitoring for the expected result.
Refer the below wiki topic that tells how to run it as a custom monitoring script.
https://wiki.comodo.com/frontend/web/topic/how-to-use-custom-script-procedure-monitoring
#To define a particular parameter, replace the 'parameterName' inside itsm.getParameter('parameterName') with that parameter's name
monitor_set_time = itsm.getParameter('MonitorSetTime') ## Provide the time(Minutes) in Integer.
import os
import re
import ctypes
from subprocess import PIPE, Popen
import time
import shutil
import subprocess
from subprocess import PIPE, Popen
import ctypes
import sys
from datetime import datetime, timedelta
def alert(arg):
sys.stderr.write("%d%d%d" % (arg, arg, arg))
def oscmd(command):
obj = os.popen(command).read()
return obj.strip()
def computername():
return os.environ['COMPUTERNAME']
def ipaddress():
return socket.gethostbyname(socket.gethostname())
gt=[]
gf=[]
try:
wdir=os.environ['PROGRAMDATA']+'\temp'
if not os.path.exists(workdir):
os.mkdir(workdir)
except:
wdir=os.environ['SYSTEMDRIVE']
gt = os.listdir("C:\Users")
count = 0
print gt
for i in filter(None, gt):
print i
if i not in ['All Users','Default', 'Default User', 'desktop.ini', 'Public']:
path = r'C:\Users\%s\Documents\Outlook Files'%(i)
if os.path.exists(path):
now = datetime.now() - timedelta(hours=0, minutes=monitor_set_time)
for f in os.listdir(path):
fpath=os.path.join(path,f)
fpath_time = datetime.fromtimestamp(os.stat(fpath).st_mtime).strftime('%Y-%m-%d-%H:%M:%S')
filename, file_extension = os.path.splitext(f)
if str(fpath_time) > str(now) and file_extension == '.pst':
count += 1
if count > 1:
print '.PST files created'
alert(1)
else:
alert(0)
Comments