Files
nagios/auto_nagvis.sh
2024-08-24 09:37:58 -04:00

18 lines
354 B
Bash

#!/bin/bash
#
# Assuming the notes field of a host.cfg file is "notes\s<lat> <lon>" then print them out
files=""
while [ -n "$1" ]; do
case "$1" in
-f|--file) files="$2"; shift 2;;
*) shift 1;;
esac
done
for file in `egrep -l notes $files`; do
awk '/host_name/ {host=$2}; /notes/ {lat=$2; lon=$3} END {print host, lat, lon}' $file
done