-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperformance_checker.sh
More file actions
executable file
·36 lines (26 loc) · 1.01 KB
/
performance_checker.sh
File metadata and controls
executable file
·36 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Author: Priyanshi Sarad
# Date Created: 11-10-2022
# Date Last Modified: 11-10-2022
# Description:
# This script logs the performance of the server in the performance.log file.
# Usage: ./performance_checker.sh
# Logging the timestamp with date command
echo -e "1 -- This is the current timestamp of this server -->> $(date) \n" >> ~/performance.log
# Logging whether internet is connected or not
ping -c 1 google.com &> /dev/null
if [ "$?" -eq 0 ]; then
echo -e "2 -- Connectiviy -->> Internet Connected \n" >> ~/performance.log
else
echo -e "2 -- Connectiviy -->> Internet not Connected \n" >> ~/performance.log
fi
# Logging the Memory Usage of the server
echo "3 -- Memory Usage:: " >> ~/performance.log
free -h | grep "Mem" >> ~/performance.log
# Logging the Swap Usage of the server
echo -e "\n4 -- Swap Usage:: " >> ~/performance.log
free -h | grep "Swap" >> ~/performance.log
# Logging the Disk Usage of the server
echo -e "\n5 -- Disk Usage:: " >> ~/performance.log
df -h >> ~/performance.log
exit 0