logo

Computer Systems and Networks - Shell Script for Monitoring System Changes

   

Added on  2023-05-29

15 Pages4230 Words150 Views
 | 
 | 
 | 
Running head: COMPUTER SYSTEMS AND NETWORKS
IMAT5122 – Computer Systems and Networks
Name of the Student
Name of the University
Author’s Note
Computer Systems and Networks - Shell Script for Monitoring System Changes_1
1
COMPUTER SYSTEMS AND NETWORKS
Table of Contents
Introduction................................................................................................................................2
Specification for the installation and using the script................................................................2
Design Consideration.................................................................................................................2
Extensive test results with exemplary log and screen output...................................................11
Conclusion................................................................................................................................12
Bibliography.............................................................................................................................13
Computer Systems and Networks - Shell Script for Monitoring System Changes_2
2
COMPUTER SYSTEMS AND NETWORKS
Introduction
The report is prepared for the demonstration of the usage of shell script for monitoring
the changes in the computer system and generating a HTML page for displaying the details of
the processes running on the system. The specification for the installation of the script is
attached with the report that would help to understand the procedure followed for the
development of the shell script. An extensive test is done on the prepared shell script and the
screen shot of the result is attached with the report. In the last section the advantages and
disadvantage of the of the techniques are discussed with the details of the configurable logs
that can be used by the network administrator for finding the changes in the system.
Specification for the installation and using the script
For the development of the shell program an Ubuntu system is used and the nano
editor is used for the creation of the file named “mySysMonitor.sh”. The commands that are
needed for displaying the current processes, users currently logged in, Devices plugged in,
disk usage, network interface and other key information are used for the development of the
shell script. After adding the command in the shell script root permission is needed to be
added using the command “chmod +x mySysMonitor.sh” to the file for running the script.
The command used for running the shell program is “./mySysMonitor.sh”.
Design Consideration
For designing the shell script and generating the output local variables are declared
and it is called for generating the output. The output for each of the function is defined under
a menu and added to the html script for generating the output. The output of the command is
stored in a log file named as “MySysMonitor.log”, and it is result and the program is given
below:
Computer Systems and Networks - Shell Script for Monitoring System Changes_3
3
COMPUTER SYSTEMS AND NETWORKS
#! /bin/bash
#Author : - Ubaidnazir
#Declaring variables
#set -x
#1) Current Processes:
echo "**********List of Current Process**********
$(ps -aux | sort -rk 3,3 | head -n 6)" >>mySysMonitor.log
current_processes_pid=`ps -ef | awk {'print$2'} | cut -f2 -d'-'`
current_processes_time=`ps -ef | awk {'print$5'} | cut -f2 -d'-'`
current_processes_process=`ps -ef | awk {'print$8'} | cut -f2 -d'-'`
#2) Users Currently Logged in:
echo " **********Users Currently Logged in*********
$(who)" >>mySysMonitor.log
Username_of_Current_logged_in_users=`who | awk {'print$1'} | cut -f1 -d','`
Date_of_Current_logged_in_users=`who | awk {'print$3'} | cut -f1 -d','`
Time_of_Current_logged_in_users=`who | awk {'print$4'} | cut -f1 -d','`
#3) Devices Plugged in
echo " **********Devices Plugged in**********
$(ls -l)" >>mySysMonitor.log
Plugged_in_Device_Permission=`ls -l /dev/ | awk {'print$1'}`
Plugged_in_Device_UID=`ls -l /dev/ | awk {'print$3'}`
Plugged_in_Device_Number=`ls -l /dev/ | awk {'print$6'}`
Plugged_in_Device_Month=`ls -l /dev/ | awk {'print$7'}`
Plugged_in_Device_Date=`ls -l /dev/ | awk {'print$8'}`
Plugged_in_Device_Time=`ls -l /dev/ | awk {'print$9'}`
Plugged_in_Device_Disk=`ls -l /dev/ | awk {'print$10'}`
#4) Disk Usage
echo "**********Disk Usage**********
Computer Systems and Networks - Shell Script for Monitoring System Changes_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Linux System Change Logger Script
|26
|4743
|96

Operating Systems .
|9
|1488
|371

Linux System Change Logger Script
|12
|2750
|201

Network and System Monitoring Report 2022
|16
|2229
|46

IMAT5122 – Computer Systems and Networks Case Study 2022
|5
|902
|18