______________________________________________________________________________________________________
Script examples written by Travis Hutchings
thutch901@gmail.com
971.226.6732
_______________________________________________________
Bash shell script examples for eps by log source as csv:
#Version: 1.5
#Owner: TravisH Corporation
#Document Purpose: EPS storage metric script
clientName="TravisH"
emailFrom="qradar.activ@travishcorp.com"
emailTo="Travis.H@travishcorp.com"
listFile="/store/scripts/eps_storage_raw.csv"
bodyFile="/store/scripts/eps_storage.csv
cd /store/scripts/results/
/opt/qradar/support/deployment_info.sh -A
echo "" >> $listFile
echo "" >> $listFile
echo "Log Source:" >> $listFile
psql -A -F"," -U qradar -c "select sensordevice.hostname as LogSource, peakeps60s as EPS, to_timestamp(round(sensordevice.creationdate/1000)) as created, to_timestamp(sensordevice.timestamp_last_seen/1000)as LastReportdate, managedhost.hostname as QradarServer from sensordevice, deployed_component, managedhost where deployed_component.id = sensordevice.eccomponentid and deployed_component.managed_host_id = managedhost.id and deviceenabled='t' and to_timestamp(round(sensordevice.creationdate/1000)) > now() - interval '52 week' order by QradarServer" >> /store/scripts/results/csvlistFile.txt
psql -A -F"," -U qradar -c "select sensordevicetype.devicetypedescription as DeviceDescription, count(*) from sensordevicetype, sensordevice where sensordevice.deviceenabled = 't' and sensordevicetype.id = sensordevice.devicetypeid group by sensordevicetype.devicetypedescription order by count(*) desc" >> $listFile
echo -n "" >> $listFile
echo -n "EPS Report Version 1.5" >> $listFile
echo -n "" >> $listFile
date >> $bodyFile
cat qradar_deployment_info-*.csv >>$bodyFile
cat /store/scripts/results/csvlistFile.txt >>$bodyFile
cat $listFile >> $bodyFile
/bin/mail -s " EPS Log Source-CSV" -r "$emailFrom" -a "$bodyFile" $emailTo < /store/scripts/eps_.csv
rm /store/scripts/eps_storage_raw.csv
rm /store/scripts/eps_storage.csv
rm /store/scripts/results/csvlistFile.txt
rm /store/scripts/results/qradar_deployment_info-*.csv
Comments
Post a Comment