-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetchDetails
331 lines (258 loc) · 8.61 KB
/
fetchDetails
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#! /bin/bash
# clear the screen
clear
unset tecreset os architecture kernelrelease internalip externalip nameserver loadaverage
systemName=$(dmidecode -s system-product-name)
echo -e '\E[32m'"System Name: "$systemName
isguest=$(ls -1 /dev/disk/by-id/ | grep QEMU | wc -l)
if [ $isguest -eq 0 ]; then
isguest="No"
else
isguest="Yes"
fi
echo -e '\E[32m'"Is Qemu Guest OS :" $isguest
# Define Variable tecreset
tecreset=$(tput sgr0)
# Check if connected to Internet or not
#ping -c 1 google.com &> /dev/null && echo -e '\E[32m'"Internet: $tecreset Connected" || echo -e '\E[32m'"Internet: $tecreset Disconnected"
# Check OS Type
os=$(uname -o)
echo -e '\E[32m'"Operating System Type :" $tecreset $os
# Check OS Release Version and Name
cat /etc/os-release | grep 'NAME\|VERSION' | grep -v 'VERSION_ID' | grep -v 'PRETTY_NAME' > /tmp/osrelease
echo -n -e '\E[32m'"OS Name :" $tecreset && cat /tmp/osrelease | grep -v "VERSION" | cut -f2 -d\"
echo -n -e '\E[32m'"OS Version :" $tecreset && cat /tmp/osrelease | grep -v "NAME" | cut -f2 -d\"
# Check Architecture
architecture=$(uname -m)
echo -e '\E[32m'"Architecture :" $tecreset $architecture
# Check Kernel Release
kernelrelease=$(uname -r)
echo -e '\E[32m'"Kernel Release :" $tecreset $kernelrelease
# Check hostname
echo -e '\E[32m'"Hostname :" $tecreset $HOSTNAME
# Check Internal IP
internalip=$(hostname -I)
echo -e '\E[32m'"Internal IP :" $tecreset $internalip
# Check External IP
#externalip=$(curl -s ipecho.net/plain;echo)
#echo -e '\E[32m'"External IP : $tecreset "$externalip
# Check DNS
nameservers=$(cat /etc/resolv.conf | sed '1 d' | awk '{print $2}')
echo -e '\E[32m'"Name Servers :" $tecreset $nameservers
# Check Logged In Users
who>/tmp/who
echo -e '\E[32m'"Logged In users :" $tecreset && cat /tmp/who
# Check RAM and SWAP Usages
free -h | grep -v + > /tmp/ramcache
echo -e '\E[32m'"Ram Usages :" $tecreset
cat /tmp/ramcache | grep -v "Swap"
echo -e '\E[32m'"Swap Usages :" $tecreset
cat /tmp/ramcache | grep -v "Mem"
# Check Disk Usages
df -h| grep 'Filesystem\|/dev/sda*' > /tmp/diskusage
echo -e '\E[32m'"Disk Usages :" $tecreset
cat /tmp/diskusage
# Check Load Average
loadaverage=$(top -n 1 -b | grep "load average:" | awk '{print $10 $11 $12}')
echo -e '\E[32m'"Load Average :" $tecreset $loadaverage
# Check System Uptime
tecuptime=$(uptime | awk '{print $3,$4}' | cut -f1 -d,)
echo -e '\E[32m'"System Uptime Days/(HH:MM) :" $tecreset $tecuptime
echo -e '\E[30m' "--------------------------"
# Check IPMI modules loaded
ipmiModulesLoaded=$(lsmod | grep ipmi)
if [ "$ipmiModulesLoaded" == "" ]; then
ipmiModulesLoaded="None"
fi
echo -e '\E[34m'"IPMI Modules :" $ipmiModulesLoaded
#IPv4 Forwarding status
ipv4Fwd=$(cat /proc/sys/net/ipv4/ip_forward)
echo -e '\E[34m'"IPv4 Forwarding :" $ipv4Fwd
#IRQ status
irqStatus=$(systemctl status irqbalance.service | grep inactive);
if [ "$irqStatus" == "" ]; then
irqStatus="Alive"
else
irqStatus="Dead"
fi
echo -e '\E[34m'"IRQ Status :"$irqStatus
#Firewall status
firewallStatus=$(systemctl status firewalld.service | grep inactive);
if [ "$firewallStatus" == "" ]; then
firewallStatus="Alive"
else
firewallStatus="Dead"
fi
echo -e '\E[34m'"Firewall Status :" $firewallStatus
#Iptables status
iptableStatus=$(systemctl status iptables.service | grep inactive);
if [ "$iptableStatus" == "" ]; then
iptableStatus="Alive"
else
iptableStatus="Dead"
fi
echo -e '\E[34m'"iptables Status :" $iptableStatus
if [ -f /etc/selinux/config ]; then
selinuState=$(cat /etc/selinux/config)
echo -e 'E\[34m'"SELINUX :"$selinuState
fi
# ASLR state
aslrStatus=$(cat /proc/sys/kernel/randomize_va_space)
echo -e '\E[34m'"ASLR :" $aslrStatus
# System Nodes
nodeCount=$(ls /sys/devices/system/node/ | grep node* | wc -l)
echo -e '\E[35m'"Node Count :" $nodeCount
# Bridge Show
bridgeShow=$(brctl show)
echo -e '\E[35m'"Bridge Show :" $bridgeShow
#Huge page Count
hugepageSize=$(ls /sys/devices/system/node/node0/hugepages/hugepages-* | grep hugepages-)
hugepageCount=$(cat /sys/devices/system/node/node0/hugepages/hugepages-*/nr_hugepages)
echo -e '\E[35m'"Huge Page details Nodes : "
echo $hugepageSize
echo $hugepageCount
#CPU map
cpumapCount=$(ls /sys/devices/system/node/node*/cpumap)
cpumapValue=$(cat /sys/devices/system/node/node*/cpumap)
echo -e '\E[35m'"CPU MAP :"
echo $cpumapCount
echo $cpumapValue
#lscpi for NIC
lspciDataIntel=$(lspci -nn | grep -i 'ethernet\|network' | grep -i intel)
lspciDataRedhat=$(lspci -nn | grep -i 'ethernet\|network' | grep -i red)
lspciDataOthers=$(lspci -nn | grep -i 'ethernet\|network' | egrep -vi 'red|intel')
echo -e '\E[35m'"LSPCI NIC Intel :" $lspciDataIntel
echo -e '\E[35m'"LSPCI NIC Red Hat :" $lspciDataRedhat
echo -e '\E[35m'"LSPCI NIC Others :" $lspciDataOthers
# VM statistics update interval - 10
vmstatinterval=$(cat /proc/sys/vm/stat_interval)
echo -e '\E[35m'"VM statistics update interval (10):" $vmstatinterval
# upper bound on the number of tasks that are checked - 1
hungtaskCheck=$(cat /proc/sys/kernel/hung_task_check_count)
echo -e '\E[35m'"Upper bound on the number of tasks checked (1):" $hungtaskCheck
echo -e '\E[30m' "--------------------------"
# soft lockup warnings
#softlockWarn=$(cat /proc/sys/kernel/softlockup_thresh)
#echo -e '\E[35m'"Soft Lock Up warn (-1):" $softlockWarn
echo -e '\E[36m'" -- Current Logins --"
w
echo -e '\E[36m'" -- Last Logins --"
last -a | head -5
echo -e '\E[38m'" -- Utilization and most expensive processes --"
top -b |head -3
echo
top -b |head -10 |tail -4
echo -e '\E[30m' "--------------------------"
echo
echo -e '\E[35m'" -- VM stat --"
vmstat -adw 1 1
echo -e '\E[35m'" -- NET DEV --"
cat /proc/net/dev
echo -e '\E[30m' "--------------------------"
echo
echo -e '\E[38m'" --- HUGE info ---"
grep -R '' /sys/kernel/mm/hugepages/ /proc/sys/vm/*huge*
echo -e '\E[38m'" --- HUGE Mount ---"
mount | grep -i huge
echo -e '\E[32m'" --- Transparent Huge Page (never) --- "
cat /sys/kernel/mm/transparent_hugepage/enabled
echo -e '\E[30m' "--------------------------"
if [ "$1" == "v" ]; then
echo
echo -e '\E[39m'" -- lshw --"
lshw -C cpu -C memory -C network
echo -e '\E[30m' "--------------------------"
echo
echo -e '\E[30m'" -- Link Capabilities --"
lspci -vvb | egrep 'Eth|LnkCap'
echo -e '\E[30m' "--------------------------"
fi
#IRQ BALANCE
echo
echo -e '\E[32m'" -- IRQ Balance INFO --"
cat /etc/default/irqbalance
if [ "$isguest" == "No" ]; then
echo
echo -e '\E[30m'".......... Details from Host!!"
#cat /sys/devices/system/cpu/cpu*/online
kernelCmdLine=$(cat /proc/cmdline)
echo -e '\E[31m'"Kernel CMD Line :" $kernelCmdLine
echo
qemuVersion=$(kvm --version)
echo -e '\E[31m'"Qemu Version :" $qemuVersion
ovsVersion=$(ovs-vsctl -V)
echo -e '\E[31m'"OVS version :" $ovsVersion
gccVersion=$(gcc --version)
echo -e '\E[31m'"GCC version :" $gccVersion
echo
echo -e '\E[31m'" -- qemu task --"
ps -aef | grep qemu | grep -v grep
echo
echo -e '\E[33m'" -- VSCTL SHOW -- "
ovs-vsctl show
echo
echo -e '\E[30m'" --- VIRSH Nodeinfo ---"
virsh nodeinfo
echo -e '\E[30m'" --- VIRSH LIST ---"
virsh list --all
virshDevices=$(virsh list --all | awk {'print $1'} | grep [0-9])
for dev in $virshDevices; do
virsh dominfo $dev
if [ "$1" == "v" ]; then
#virsh dumpxml $dev
virsh vcpuinfo $dev
fi
done
if [ "$1" == "v" ]; then
virsh domstats
fi
if [ "$1" == "v" ]; then
# CPU freq scaler
echo -e '\E[31m'"CPU Freq Scaler:"
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# CPU Freq
echo -e '\E[31m'"CPU Freq:"
grep MHz /proc/cpuinfo
# core and numa
echo -e '\E[32m'"Physical Core - NUMA :"
egrep "physical id|processor" /proc/cpuinfo
# IOMMU device
echo -e '\E[32m'"IOMMU devices"
find /sys/kernel/iommu_groups/ -type l
fi
echo
# NUMA Blanacing
numaBalMode=$(cat /proc/sys/kernel/numa_balancing)
echo -e '\E[32m'"Numa Balance Mode :" $numaBalMode
if [ "$1" == "v" ]; then
echo
echo -e '\E[32m'" --------- DMIDECODE details --------- "
echo
echo -e '\E[32m'" --- BIOS --- "
dmidecode -t 0 -t 13
echo
echo -e '\E[32m'" --- SYSTEM --- "
dmidecode -t 1 -t 12 -t 15 -t 23 -t 32
echo
echo -e '\E[32m'" -- Processor Cache -- "
dmidecode -t 4 -t 7
echo
echo -e '\E[32m'" -- MEMORY -- "
dmidecode -t 5 -t 6 -t 16 -t 17
echo
echo -e '\E[32m'" -- baseboard chassis -- "
dmidecode -t 2 -t 10 -t 3
#echo
#echo -e '\E[32m'" -- Connector -- "
#dmidecode -t 8
echo
echo -e '\E[32m'" -- Slot -- "
dmidecode -t 9
fi
echo -e '\E[30m' "--------------------------"
fi
# Remove Temporary Files
rm /tmp/osrelease /tmp/who /tmp/ramcache /tmp/diskusage
# Unset Variables
unset tecreset os architecture kernelrelease internalip externalip nameserver loadaverage
shift $(($OPTIND -1))