Question: Overview In this assignment you will use BASH and various system utilities to construct a system monitor that periodically reports and alerts on system activities
Overview
In this assignment you will use BASH and various system utilities to construct a system
monitor that periodically reports and alerts on system activities such as Network Usage
number of connections, data sent, data received Disc I.O Running Processes including
their CPU, and Memory consumption System CPU and Memory consumption, the system
temperature, and system load.
To be successful you will need to create several bash functions, utilize and parse the output of
multiple commands this may require using parsing commands A helpful list of commands
to research:
top
vmstat
iostat
netstat
ifstat
uptime
ps
df
wc
grep
sed
cut
awk
date
cat
sort
head
If you need to find a way to get data and dont know the command apropos can help. For
some items you may need to get information from the sys system
iesysclassthermalthermal zone You can explore the various classes there for if
there are ones of use.
System Monitor Points
Your system monitor will be involved with the following command format:
systemmonitor.sh sysmonitor.log "cpu mem disk eno
sda sysclassthermalthermalzonetemp
line break for clarity where the arguments are as follows:
Interval eg seconds how often to check all parameters
Duration eg seconds how long to run for
Logfile egsys monitor.log where to log the data
Alerts egcpu mem disk What tests should trigger an alert
Network Interface eg eno what network interface to monitor
Drive eg sda what disc to monitor
Temperature Node egsysclassthermalthermal zonetemp what tempera
ture node to monitor
You should always monitor the following parameters:
cpu Current Total CPU usage, unit:
mem Current Total MEM usage, unit:
net tx Current Total Network Transmit, unit: packets
net rx Current Total Network Receive, unit: packets
net con Current Total Network Connections, unit: none
disk Current Total Disk usage, unit: kB
disk W Current Total Disk write, unit: kB
disk R Current Total Disk read, unit: kB
proc Current Total Number of Processes all users unit: none
proc cpu Current Process name with highest cpu usage, unit: none
proc mem Current Process name with highest memory usage, unit: none
temp Current system temperature, unit: C
load Current system minute load average, unit: none
Logging
Your monitor should output these parameters to a log file at each interval on a single line
with no units separated by a space preceeded by a timestamp in the format YYYYMMDDHHMM:
cpu mem nettx netrx netcon disk
diskW discR proc proccputmux procmemsystemd
temp load
Your log should follow exactly this format line breaks in this document for clarity
should not be in your output
Alerts
Your monitor should detect if a parameter matches an alert condition and report this to
both the logfile and stderr. The alert should report the timesamp and the condition broken.
If multiple conditions are broken report them on separate lines. ie:
ALERT: cpu
Your alerts should follow exactly this format
Bonus Points
Make your monitor run indefinitely when the duration is given as The command must be
terminated with a ctrlC and print a message that it is stopping to receive this bonus, a
simple infinite loop will not qualify. Hint: man trap
Testing Points
Testing system events can be difficult, but not impossible. First write a test plan of the
general proceedure for how you would test monitoring and alerting. ie test cpu usage
by increasing cpu usage and checking for evidence in the log For now keep this high level
without considering exactly how you will accomplish these tasks. Document as many of
these tests as you think you need, you should try to cover all of the different monitors, but
dont have to test only one at a time in somecases that might be very difficult or impossible
Call this file testplaninitial.txt
Now, for each test use man pages, apropos, and any other resources to develop an idea of
how to create the test condition. For each test case document a command that can create the
conditions you want ie for increasing cpu usage you might run a cpu intensive program
These commands should be usable on the lab machines. Add these to your test plan in a
new file testplancompleted.txt
Lastly execute your test plan, and document the results. Include snippets of the log or
command output which show your monitor passed the test.
Files to hand in
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
