diff --git a/auto_nagvis.sh b/auto_nagvis.sh new file mode 100644 index 0000000..d3fbd5f --- /dev/null +++ b/auto_nagvis.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Assuming the notes field of a host.cfg file is "notes\s " 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 +