Access over 20 million homework & study documents

Assignment 3

Content type
User Generated
Type
Homework
Rating
Showing Page:
1/2
Awan
Usman Awan
ITEC 325
7/1/2016
ASSIGNMENT 3
1.
syslog: Contains system information
script function: get DHCP information
#!/bin/bash
[[ "$#" -ne 1 ]] && echo "Please check input" && exit -1
grep "NetworkManager" "$1" | awk -F' ' '{print $3}' | sed '/^\s*$/d'
2.
My sql
mysql_slow_query.log: Contains slow query
script function: how many queries were longer than X seconds
#!/bin/bash
[[ "$#" -ne 1 ]] && echo "Please check input" && exit -1
QUERYTIME=30.0
LINES=$(grep -n Query_time "$1" | awk -v time="$QUERYTIME" '$3 > time {print; }$
NUM=$(grep -n Query_time "$1" | awk -v time="$QUERYTIME" '$3 > time {print; }' $
echo "Number of long queries: $NUM"
echo
for i in $(echo "$LINES" | awk -F':' '{print $1}'); do
TIME=$(tail +${i} $1 | head -1 | awk -F' ' '{print $3}')
QUERY=$(tail +${i} $1 | head -3 | tail -1)
echo "Time: $TIME"
echo "Query: $QUERY"
echo
done
3.
Auth Log
auth.log: Contains system authorization information, including user logins and
authentication machinsm that were used

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/2

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
Awan Usman Awan ITEC 325 7/1/2016 ASSIGNMENT 3 1. syslog: Contains system information script function: get DHCP information #!/bin/bash [[ "$#" -ne 1 ]] && echo "Please check input" && exit -1 grep "NetworkManager" "$1" | awk -F' ' '{print $3}' | sed '/^\s*$/d' 2. My sql mysql_slow_query.log: Contains slow query script function: how many queries were longer than X seconds #!/bin/bash [[ "$#" -ne 1 ]] && echo "Please check input" && exit -1 QUERYTIME=30.0 LINES=$(grep -n Query_time "$1" | awk -v time="$QUERYTIME" '$3 > time {print; }$ NUM=$(grep -n Query_time "$1" | awk -v time="$QUERYTIME" ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Excellent! Definitely coming back for more study materials.

Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Similar Documents