summaryrefslogtreecommitdiff
path: root/allstar/allstar-monitor
diff options
context:
space:
mode:
Diffstat (limited to 'allstar/allstar-monitor')
-rwxr-xr-xallstar/allstar-monitor13
1 files changed, 7 insertions, 6 deletions
diff --git a/allstar/allstar-monitor b/allstar/allstar-monitor
index f3be769..2e4be6a 100755
--- a/allstar/allstar-monitor
+++ b/allstar/allstar-monitor
@@ -3,6 +3,9 @@
use strict;
use File::Temp qw/tempfile/;
+use Sys::Hostname;
+
+my $host = hostname;
my $lastline = qx(/usr/bin/tail -n 1 /var/log/asterisk/messages);
chomp($lastline);
@@ -60,17 +63,17 @@ if(
sleep 1;
unlink "/var/run/asterisk.ctl";
unlink "/var/run/asterisk.pid";
- exec("/usr/local/sbin/astup.sh > /dev/null 2>&1");
+ system("/usr/local/sbin/astup.sh > /dev/null 2>&1");
}
my $msg;
$msg .= "From: Asterisk <root\@megalink.network>\n";
$msg .= "To: zabbix\@megalink.network\n";
- $msg .= "Subject: Restarted Asterisk on pi-echo39\n";
+ $msg .= "Subject: Restarted Asterisk on $host\n";
$msg .= "\n";
- $msg .= "This is the iax_monitor program on pi-echo39.\n";
+ $msg .= "This is the allstar-monitor program on $host.\n";
$msg .= "\n";
- $msg .= "Asterisk was cycled at " . qx(/usr/bin/date) . " due to the IAX Max Retries bug.\n";
+ $msg .= "Asterisk was cycled at " . qx(/usr/bin/date) . " due to a hang condition.\n";
$msg .= "\n";
$msg .= "Last Log:\n";
$msg .= " " . $lastline . "\n";
@@ -79,9 +82,7 @@ if(
(my $ofh , my $outfile ) = tempfile( UNLINK => 1 );
- print $ofh $msg;
system( sprintf("/usr/bin/cat %s | /usr/bin/ssmtp -oi -oem %s", $outfile, "zabbix\@megalink.network") );
-
}
}
exit 0;