/
perfsystemmonitor.sh
295 lines (242 loc) · 6.98 KB
/
perfsystemmonitor.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#!/bin/bash
##############################
# Dr.redfish #
# 20 Juillet 2022 #
# #
# Perf System Monitor #
# Version : 0.0.0 #
##############################
#####################################intro ##############################
# Ce script analyse votre system,aux moyens des paquets disponible #
# sur les distributions basée sur debian. #
# #
# Il est possible qu'il soit installer certains paquets manquant #
# au démarrage #
# #
# #
# Chaques commandes fait a peu pret ce que son nom indique #
#########################################################################
# cheching installation of notify-send packages
notify="/usr/bin/notify-send"
if [ -f $notify ] ; then # if the path exist we do nothing
echo "notify is already installed"
else
sudo apt install libnotify-bin -y # else we install it
fi
# checking installation of zenity packages
zenity="/usr/bin/zenity"
if [ -f $zenity ] ; then # if the path exist we do nothing
echo "zenity is already installed"
else
sudo apt install zenity -y # else we install it
fi
# checking installation of figlet packages
figlet1="/usr/bin/figlet"
figlet2="/usr/bin/X11/figlet"
figlet3="/usr/share/figlet"
figlet4="/usr/share/man/man6/figlet.6.gz"
figlet5="figlet"
if [ -f $figlet1 ] || [ -f $figlet2 ] || [ -f $figlet3 ] || [ -f $figlet3 ] || [ -f $figlet4 ] || [ -f $figlet5 ] ; then # if the path exist we do nothing
echo "figlet is already installed"
else
sudo apt install figlet -y # else we install it
fi
# checking installation of toilet packages
toilet="/usr/bin/toilet"
if [ -f $toilet ] ; then # if the path exist we do nothing
echo "toilet is already installed"
else
sudo apt install toilet toilet-fonts -y # else install it
fi
notify-send " Perf System Monitor" # cool simply notice on desktop
# here is many functions for analyse your hardware configuration like his name he do the same
NbProc(){
echo "Quelle est la marque du processeur et nb de cœur ?"
sleep 0.5
toilet -f smblock -F metal NbProc
zenity --width=500 --height=500 --list \
--title="Nombre de processeur" \
--column="NbProc" \
`lscpu | grep Processeur`
}
CPUPower(){
echo "Quelle est la puissance du processeur ?"
sleep 0.5
toilet -f future -F gay CpuPower
zenity --width=500 --height=500 --list \
--title="Speed of Proc" \
--column="SpeedCPU" \
`lscpu | grep Vitesse`
}
Virtual(){
echo "la virtualisation est t'elle activer ?"
sleep 0.5
toilet -f pagga -F border Virtualisation
zenity --width=500 --height=500 --list \
--title="Virt is active?" \
--column="Active or not" \
`lscpu | grep Virtualisation`
}
Memory(){
echo "la taille de la mémoire vive ?"
sleep 0.5
toilet -f future -F metal Memory
zenity --width=500 --height=500 --list \
--title="Memory" \
--column="Total of Mem" \
`cat /proc/meminfo | grep MemTotal`
# free -l
}
SetVirt(){
echo "Comment activer la virtualisation ?"
sleep 0.5
zenity --width=500 --height=500 --info --title="Activer la virtualisation" --text "Au démarrage de l’ordi appuyer sur la touch « hotkey » differentes en fonction des machines
pour ma part « del » puis activer la virtualisation AMD-v"
toilet -f smmono9 -F border Activer le bios
}
Graph(){
echo "Qui est le constructeur graphique ?"
sleep 0.5
toilet -f future -F gay Constructeur graphique
zenity --width=500 --height=500 --list \
--title="GPU" \
--column="graphical" \
`lspci | grep VGA`
}
PeriphUSB(){
echo "Lister les périphériques USB ?"
sleep 0.5
toilet -f pagga -F metal USB
zenity --width=500 --height=500 --list \
--title="USBdevices" \
--column="Nb" \
`ls -l /dev/usb/`
#`sudo ls -l /dev/vboxusb/``
}
Partition(){
echo "Lister les partitions ?"
sleep 0.5
toilet -f smmono9 -F gay Partitions
zenity --width=500 --height=500 --list \
--title="Partitions" \
--column="Nb" \
`lsblk | grep sda`
`ls -l /dev/disk/by-uuid`
}
USBdev(){
sleep 0.5
toilet -f smmono9 -F border USBdevice
echo "monitorer les clés usb !"
zenity --width=500 --height=500 --list \
--title="USBmon" \
--column="nb" \
`lsblk`
`sudo dmesg`
}
ListHW(){
sleep 0.5
toilet -f smmono9 -F border ListHW
echo "extraire votre configuration !"
sudo lshw -html > config.html
# FILE="config.html"
FILE=`dirname $0`/config.html
# zenity --text-info --html "Config.html as been created with success" \
# --title="ListHW" \
zenity --text-info \
--html \
--title="License" \
--filename=$FILE \
zenity --question \
--title "ouvrir ?" \
--text "Ouvrir dans firefox ??"
if [ $? = 0 ]
then
echo "OUI ! merci"
/opt/bin/firefox/firefox config.html
sleep 0.5
else
echo "NON ! ca ira ..."
sleep 0.5
fi
}
# /_!_\ work in progress /_!_\
# TODO get all VM and take control on it
GetMachineVirtuel(){
sleep 0.5
sudo virsh list --all > vmlist.txt
FILE="vmlist.txt"
toilet -f smmono9 -F gay Virtual machine
zenity --text-info \
--title "Hostname Information" \
--filename $FILE
}
# here is starting of zenity interface with
# # loading bar
(
echo "10" ; sleep 1
echo "# logiciel PerfSystemMonitoring" ; sleep 1
echo "20" ; sleep 1
echo "# Vérification des dépendances" ; sleep 1
echo "50" ; sleep 1
echo "# ------------------------------------------------------->" ; sleep 1
echo "75" ; sleep 1
echo "# cliquez sur valider pour commencer" ; sleep 1
echo "100" ; sleep 1
) |
zenity --progress \
--title="Démarrage de zenity" \
--text="Lancement de PerfSystemMonitoring" \
--percentage=0
if [ "$?" = -1 ] ; then
zenity --error \
--text="Démarrage stoppé."
fi
# menu
while true; do
choice="$(zenity --width=500 --height=500 --title="PerfSystemMonitoring" --list --column "fonction" --column "description" \
"Nbprocesseurs" \
"Affiche Nombre de processeur" \
"CPUPower" \
"Affiche La puissance en MHz" \
"Memory" \
"Affiche la capacité de la mémoire disponible" \
"SetVirtualisation" \
"Affiche un conseil pour activer la virtualisation" \
"Graphic" \
"Affiche des informations sur le GPU" \
"USBdevices" \
"Affiche des informations sur les périphériques USB" \
"Partitions" \
"Affiche les partitions" \
"ExportConfig" \
"Export HTML de la configuration globale avec possible ouverture dans firefox" \
"GetMachineVirtuel" \
"_!_ Bientot Disponible Ne fonctionne pas _!_" \
"Quit" \
"Quittez le programme")"
case ${choice} in
Nbprocesseurs)
NbProc;;
CPUPower)
CPUPower;;
Virtualisation)
Virtual;;
Memory)
Memory;;
SetVirtualisation)
SetVirt;;
Graphic)
Graph;;
USBdevices)
PeriphUSB;;
Partitions)
Partition;;
ExportConfig)
ListHW;;
GetMachineVirtuel)
GetMachineVirtuel;;
Quit)
break
exit;;
esac
done