# Get our hostname for logging and notifications our $host = hostname(); # Subroutine to append a new MRTG entry to the daemon log sub write_mrtg_log{ my( $arg1, $arg2 ) = @_; my $log_entry = defined $arg1 ? $arg1 : 'Empty Log Entry'; my $log_entry_category = defined $arg2 ? $arg2 : 'SCHEDULER'; my $daemon_log_timestamp = localtime()->strftime('%b %d %H:%M:%S'); open(my $fd, ">>/var/log/daemon"); print $fd $daemon_log_timestamp.' '.our $host.' mrtg[]: ['.$log_entry_category.']: '.$log_entry.'.'."\n"; close $fd; }