#!/bin/bash

set -e

if [ $# -ne 1 ]; then
  echo "Usage: $0 <hostname>"
  echo "This script creates the directory hostname and populates it with"
  echo "mrtg files. The UPS host must snmp activated allowing public to read."
else
mkdir -p `dirname $0`/$1
cd `dirname $0`/$1
ln -sf ../battery.png folder.png
cd -



/usr/local/mrtg-2/bin/cfgmaker --global "WorkDir: `dirname $(pwd)/$0`/$1" \
                               --global 'Options[_]: bits,growright' \
                               --global 'NoMib2: Yes' \
                               --host-template=ietf-ups.htp \
                               --nointerfaces \
                               public@$1 > `dirname $0`/$1/mrtg.cfg
fi

