#!/usr/bin/perl -w

use strict;
use vars qw($line $used);

sub usage {
  die "Usage: bayonne-mrtg.pl\n";
}

#if(! defined $ARGV[0]) {
#  usage;
#}

my @in = `bayonne_status`;

foreach(@in) {
  if($_ =~ /127.0.0.1/) {
    $line = $_;
    last;
  }
}

my @cols = split / +/, $line;
chomp $cols[3];
#print $cols[3] . "\n";

my @chnls = split //, $cols[3];

$used = 0;

foreach(@chnls) {
  if($_ !~ /-/) {
    $used++;
  }
}

print "$used\n";
print "0\n";
print `hostname`;
print `uptime`;

# I see the following states when I watch a call go through:
# r ring?
# p ?
# i idle?
# - clear?
