This repository has been archived on 2024-12-17. You can view files and clone it, but cannot push or open issues or pull requests.
get-all-logs/node_info.sh

68 lines
2.5 KiB
Bash
Raw Normal View History

2023-04-25 00:30:41 +08:00
#!/bin/bash
# node collect
node_collect() {
# running commands on the node
fullcmd=$2;
logfile=$1;
echo $fullcmd;
echo -e "\n $fullcmd \n" >> ${logfile};
2023-04-25 00:34:39 +08:00
eval $fullcmd >> ${logfile};
2023-04-25 00:30:41 +08:00
}
declare -A cmd
cmd["0 hostnamectl"]="hostnamectl";
2023-04-25 00:43:17 +08:00
cmd["1 release"]="cat /etc/*release";
cmd["2 dmesg"]="dmesg | grep -i -E 'error|failed|critical|bug|panic'";
cmd["3 services"]="journalctl | grep -i -E 'error|failed|critical|bug|panic'";
cmd["4 services"]="systemctl status libvirtd -l";
cmd["5 services"]="systemctl status gomon -l";
cmd["6 services"]="systemctl show libvirtd";
cmd["7 sshd_config"]="cat /etc/ssh/sshd_config";
2023-04-25 00:30:41 +08:00
cmd["8 hwinfo"]="lscpu";
cmd["9 hwinfo"]="lscpu | grep -i -E 'socket|core|thread'";
cmd["10 hwinfo"]="dmidecode";
cmd["11 time"]="timedatectl";
cmd["12 time"]="uptime";
2023-04-25 00:43:17 +08:00
cmd["13 time"]="last reboot | head -10";
cmd["14 virsh"]="virsh list --all";
cmd["15 virsh"]="virsh pool-list --all";
cmd["16 virsh"]="virt-host-validate";
cmd["17 mem"]="free -m";
cmd["18 network"]="ip -br a";
cmd["19 network"]="brctl show;
cmd["20 network"]="curl -v download.ispsystem.com";
cmd["21 firewall"]="systemctl status nftables";
cmd["22 firewall"]="systemctl status firewalld";
cmd["23 firewall"]="firewall-cmd --list-ports";
cmd["24 firewall"]="nft list ruleset";
cmd["25 firewall"]="ss -tulpn | grep 16514";
cmd["26 firewall"]="ss -tulpn '( sport >= 49152 and sport <= 49215 )'";
cmd["27 firewall"]="ss -tulpn '( sport >= 5900 and sport <= 6900 )'";
cmd["28 firewall"]="ss -tulpn '( sport = 179 or sport = 4789 )'";
cmd["29 firewall"]="ss -tulpn | grep 16514";
cmd["30 firewall"]="ss -tulpn | grep -E ':179|:4789'";
cmd["31 disks"]="df -h --exclude tmpfs --exclude devtmpfs --exclude squashfs --exclude overlay";
cmd["32 disks"]="df -i";
2023-04-25 00:30:41 +08:00
cmd["33 disks"]="lsblk";
2023-04-25 00:43:17 +08:00
cmd["34 virsh"]="lvdisplay";
cmd["35 virsh"]="pvdisplay";
cmd["36 virsh"]="vgdisplay";
cmd["37 packages"]="yum repolist";
cmd["38 packages"]="yum history list";
cmd["39 mem"]="ps -eo pmem,pcpu,pid,ppid,user,stat,args | sort -k 1 -r | head -6";
cmd["40 hwinfo"]="ps -eo pcpu,pmem,pid,ppid,user,stat,args | sort -k 1 -r | head -6";
cmd["41 services"]="systemctl status libvirtd-ro.socket -l";
cmd["42 services"]="systemctl status libvirtd-admin.socket -l";
cmd["43 services"]="systemctl status libvirtd.socket -l";
cmd["44 services"]="systemctl status libvirtd.service -l";
cmd["44 services"]="systemctl list-units";
cmd["45 hwinfo"]="sestatus";
2023-04-25 00:30:41 +08:00
for k in "${!cmd[@]}";do
# echo "${cmd[$k]}";
typelog=$(echo $k | cut -d ' ' -f2);
node_collect "node.log" "${cmd[$k]}";
done