#!/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 host must have snmpd running and snmpd.conf should"
  echo "have the following line:"
  echo "view    systemview    included   .1.3.6.1"
else
mkdir -p `dirname $0`/$1

#                               --global 'Options[$]: growright' \


/usr/local/mrtg-2/bin/cfgmaker --global "WorkDir: `dirname $(pwd)/$0`/$1" \
                               --global 'Options[_]: bits,growright' \
                               --show-op-down --zero-speed=10000 \
                               --host-template=host-generic.htp \
                               --ifdesc=descr \
                               public@$1 > `dirname $0`/$1/mrtg.cfg
fi

