Implement time stamp and improve reporter syntax.
The directory access time used so far is modified on every ansible run and independent of the ansible module/playbook.
This commit is contained in:
parent
5ed4c2a135
commit
aa8bc09ce6
4 changed files with 25 additions and 13 deletions
|
@ -7,19 +7,27 @@
|
|||
set -eu
|
||||
|
||||
sendto="collector.steinbeis.schule 1234"
|
||||
n=0
|
||||
|
||||
cmds=(
|
||||
'uname -a'
|
||||
'ls -d --full-time /home/ansible/.ansible/tmp/'
|
||||
'ip link | sed -nE -e "s/^[2-9]: (\S+): .+/\1/p" -e "s/.+ether ([0-9a-f:]+) .+/\1/p" | paste -d " " - -'
|
||||
'tail -1 /home/ansible/.ansible/stamps'
|
||||
'ip route list default'
|
||||
'ip link show | \
|
||||
sed -nE -e "s/^[2-9]: (\S+): .+/\1/p" -e "s/.+ether ([0-9a-f:]+) .+/\1/p" | \
|
||||
paste -d " " - -'
|
||||
)
|
||||
# 'w'
|
||||
# 'uptime'
|
||||
# 'ls -d --full-time /home/ansible/.ansible/tmp/'
|
||||
# 'ip addr show'
|
||||
# 'apt list --upgradeable -o Apt::Cmd::Disable-Script-Warning=true'
|
||||
|
||||
r="$HOSTNAME: ------- $(date --rfc-3339=seconds) -------
|
||||
$(for c in "${cmds[@]}" ; do echo "$c"; eval "$c" | sed 's/^/ /' ; done | sed "s/^/$HOSTNAME: /")
|
||||
r="$HOSTNAME ------- $(date --rfc-3339=seconds) -------
|
||||
$(for c in "${cmds[@]}" ; do
|
||||
n=$(( n + 1 ))
|
||||
echo -n "$n"
|
||||
eval "$c" | sed 's/^/\t/'
|
||||
done | sed "s/^/$HOSTNAME /")
|
||||
## -------------------------------------------------"
|
||||
echo "$r" | nc -w 1 -u $sendto
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue