Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
scripto
Explorer

Simple Script to monitor any signature updates through email

Hi

Everytime it was a painful job to login to the scalable platform and run commands to check the signature updates, here is a simple shell script using native sendmail to record and send a email update according to a schedule in cronjob. The script can be scaled up to monitor many parameters

OUTPUT

=============================================================================================================
BASE MACHINE
=============================================================================================================
-*- 14 blades: 1_01 1_02 1_03 1_04 1_05 1_06 1_07 2_01 2_02 2_03 2_04 2_05 2_06 2_07 -*-
AB Update status: up-to-date
AB Update description: Gateway is up to date. Database version: 2008111411.
AB Next update description: The next update will be run as scheduled.
AB DB version: 2008111411
AV Update status: new
AV Update description: Gateway was updated with database version: 2008130441.
AV Next update description: The next update will be run as scheduled.
AV DB version: 2008130441

=============================================================================================================
VS 2
=============================================================================================================
-*- 14 blades: 1_01 1_02 1_03 1_04 1_05 1_06 1_07 2_01 2_02 2_03 2_04 2_05 2_06 2_07 -*-
AB Update status: up-to-date
AB Update description: Gateway is up to date. Database version: 2008111411.
AB Next update description: The next update will be run as scheduled.
AB DB version: 2008111411
AV Update status: up-to-date
AV Update description: Gateway is up to date. Database version: 2008130037.
AV Next update description: The next update will be run as scheduled.
AV DB version: 2008130037

=============================================================================================================
VS 3
=============================================================================================================
-*- 14 blades: 1_01 1_02 1_03 1_04 1_05 1_06 1_07 2_01 2_02 2_03 2_04 2_05 2_06 2_07 -*-
AB Update status: up-to-date
AB Update description: Gateway is up to date. Database version: 2008111411.
AB Next update description: The next update will be run as scheduled.
AB DB version: 2008111411
AV Update status: new
AV Update description: Gateway was updated with database version: 2008130441.
AV Next update description: The next update will be run as scheduled.
AV DB version: 2008130441

 

SCRIPT

#!/bin/bash -f
source /opt/CPshrd-R76/CTX/CTX00002/tmp/.CPprofile.sh
source /etc/profile.d/vsenv.sh
rm /var/scripts/cpstat.txt #Removes the old files from gateway
outputlog=/var/scripts/cpstat.txt
echo ============================================================================================================= >> $outputlog
echo BASE MACHINE >> $outputlog
echo ============================================================================================================= >> $outputlog
vsenv 0
g_allc cpstat antimalware -f update_status >> $outputlog
echo ============================================================================================================= >> $outputlog
echo VSENV 2 >> $outputlog
echo ============================================================================================================= >> $outputlog

vsenv 2
g_allc cpstat antimalware -f update_status >> $outputlog
g_allc cpstat urlf -f update_status >> $outputlog
g_allc cpstat appi -f update_status >> $outputlog
echo ============================================================================================================= >> $outputlog
echo VSENV 3 >> $outputlog
echo ============================================================================================================= >> $outputlog

vsenv 3

g_allc cpstat antimalware -f update_status >> $outputlog
g_allc cpstat urlf -f update_status >> $outputlog
g_allc cpstat appi -f update_status >> $outputlog


vsenv 0
cd /opt/CPsuite-R76/fw1/bin/
./sendmail -s "FIREWALL <hostname> CHASSIS ANTIMALWARE UPDATE STATUS" -t 10.18.1.7 -f senderemail@domain.yyy recepientemail@domain.xxx < /var/scripts/cpstat.txt

 

 

1 Reply
_Val_
Admin
Admin

Nice!

0 Kudos