090600
This commit is contained in:
26
roles/graylog_collector/files/collect_info.sh
Normal file
26
roles/graylog_collector/files/collect_info.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
OUTPUT_DIR="${OUTPUT_DIR:-/var/log}"
|
||||
filename="$OUTPUT_DIR/command_results_$(date +%F_%H-%M-%S).log"
|
||||
|
||||
commands=(
|
||||
"hostnamectl"
|
||||
"ip a"
|
||||
"ip route"
|
||||
"cat /etc/resolv.conf"
|
||||
"uptime"
|
||||
"who"
|
||||
"df -h"
|
||||
"free -m"
|
||||
"netstat -tuln"
|
||||
"systemctl list-units --type=service --state=running"
|
||||
)
|
||||
|
||||
{
|
||||
echo "== Сбор информации начат: $(date) =="
|
||||
for cmd in "${commands[@]}"; do
|
||||
echo "Команда: $cmd"
|
||||
eval "$cmd" 2>&1
|
||||
echo "--------------------------------------------------"
|
||||
done
|
||||
echo "== Завершено: $(date) =="
|
||||
} > "$filename"
|
||||
Reference in New Issue
Block a user