Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##!/bin/bash
- #######################################
- # This script is designed to retrieve #
- # total system info for techincal #
- # discoveries. will retrieve cores, #
- # ram, amount of calls per day, and #
- # average load #
- # Creator: jamie charlton #
- #######################################
- echo cpu info: > ~/sysinfo.txt
- echo ---------------------------------------------------- >> ~/sysinfo.txt
- echo >> ~/sysinfo.txt
- uptime >> ~/sysinfo.txt
- lscpu >> ~/sysinfo.txt
- echo >> ~/sysinfo.txt
- echo Storage: >> ~/sysinfo.txt
- echo ---------------------------------------------------- >> ~/sysinfo.txt
- df -H --output=source,size,used,avail >> ~/sysinfo.txt
- echo >> ~/sysinfo.txt
- echo psql entries: >> ~/sysinfo.txt
- echo ---------------------------------------------------- >> ~/sysinfo.txt
- psql -U callrec -c "SELECT schemaname,relname,n_live_tup
- FROM pg_stat_user_tables
- ORDER BY n_live_tup DESC;" >> ~/sysinfo.txt
- echo Database Size: >> ~/sysinfo.txt
- du -ch /opt/callrec/data/psql | tail -n 1 >> ~/sysinfo.txt
- echo >> ~/sysinfo.txt
- echo Memory: >> ~/sysinfo.txt
- echo ----------------------------------------------------- >> ~/sysinfo.txt
- free -m | awk {'print $2 " " $3'} | head -n 2 >> ~/sysinfo.txt
- echo >> ~/sysinfo.txt
- echo license info: >> ~/sysinfo.txt
- echo ----------------------------------------------------- >> ~/sysinfo.txt
- /opt/callrec/bin/callrec-status -state all -name remoteJTAPI1 -verbosity 5 | grep Licensed | awk {'print $11'} | sed -e 's/(.*//g' >> ~/sysinfo.txt
- echo >> ~/sysinfo.txt
- echo Average Day: >> ~/sysinfo.txt
- echo ----------------------------------------------------- >> ~/sysinfo.txt
- cd /opt/callrec/data/calls
- largestday="$(du | sort -n -k1 | tail -n 2 | head -n 1 | awk {'print $2'})"
- cd $largestday
- echo Calls for day: >> ~/sysinfo.txt
- ls -l | wc -l >> ~/sysinfo.txt
- cd
- mkdir ~/techInfo
- mv ~/sysinfo.txt ~/techInfo/sysinfo.txt
- /opt/callrec/bin/scripts/cmdb.sh -d ~/techInfo
- while getopts "bf:" OPTION
- do
- case $OPTION in
- s)
- echo Uploading To SFTP
- read -p "Enter Your Name: " username
- read -p "Enter Server Url eg. file.zoomint.com" fileUrl
- sftp $username@$fileUrl
- exit
- ;;
- \?)
- echo The only current flag is -s
- echo -s is used to upload outputs to sftp
- exit
- ;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement