#!/usr/bin/perl -w
our $VERSION = '0.3.1-beta1';
#    Devmon: An SNMP data collecteor & page generator for the BigBrother &
#    Hobbit network monitoring systems
#    Copyright (C) 2005-2006  Eric Schwimmer
#
#    $URL: https://devmon.svn.sourceforge.net/svnroot/devmon/trunk/devmon $
#    $Revision
#    $Id: devmon 123 2009-01-23 15:36:41Z buchanmilne $
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.  Please see the file named
#    'COPYING' that was included with the distrubition for more details.

 # Global Modules
  use strict;

 # Devmon specific modules
  use FindBin;
  use lib "$FindBin::Bin/modules";
  use dm_config;
  use dm_templates;
  use dm_snmp;
  use dm_tests;
  use dm_msg;

 # Do start-up housekeeping
  initialize($VERSION);

 # Enter main loop
  do_log("Entering poll loop", 0);
  while (1) {

   # Read in template data
    read_templates();

   # Load/reload test data & do failover recover
    sync_servers();

   # Now collect SNMP data
    poll_devices();

   # Now do tests
    tests(); 
    
   # Now send messages
    send_msgs(); 

   # Do time tests and then sleep
    time_test();

  }

