CC-2414: Add status info for show-recorder and media-monitor in airtime-check-system
-done
This commit is contained in:
parent
8dd0d4132d
commit
c4b291b8e8
|
@ -24,8 +24,7 @@ AirtimeCheck::CheckRabbitMqConnection($airtimeIni);
|
||||||
//AirtimeCheck::CheckApacheVHostFiles();
|
//AirtimeCheck::CheckApacheVHostFiles();
|
||||||
|
|
||||||
AirtimeCheck::GetAirtimeServerVersion($pypoCfg);
|
AirtimeCheck::GetAirtimeServerVersion($pypoCfg);
|
||||||
AirtimeCheck::CheckAirtimePlayoutRunning();
|
AirtimeCheck::CheckAirtimeDaemons();
|
||||||
AirtimeCheck::CheckLiquidsoapRunning();
|
|
||||||
AirtimeCheck::CheckIcecastRunning();
|
AirtimeCheck::CheckIcecastRunning();
|
||||||
|
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
|
@ -57,17 +56,8 @@ class AirtimeCheck {
|
||||||
|
|
||||||
public static $check_system_ok = true;
|
public static $check_system_ok = true;
|
||||||
|
|
||||||
public static function CheckAirtimePlayoutRunning()
|
private static function CheckAirtimeDaemonRunning($filename, $process_id_str, $process_running_str, $name, $logFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
//check if airtime-playout.pid exists
|
|
||||||
|
|
||||||
//if it exists we need to get the process id
|
|
||||||
//from the file as well as the time the process
|
|
||||||
//has been running. We can get the latter from
|
|
||||||
//the timestamp of the file
|
|
||||||
$filename = "/var/run/airtime-playout.pid";
|
|
||||||
|
|
||||||
$pid = false;
|
$pid = false;
|
||||||
$numSecondsRunning = 0;
|
$numSecondsRunning = 0;
|
||||||
|
|
||||||
|
@ -87,13 +77,13 @@ class AirtimeCheck {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output_status("PLAYOUT_ENGINE_PROCESS_ID", $pid);
|
output_status($process_id_str, $pid);
|
||||||
|
|
||||||
output_status("PLAYOUT_ENGINE_RUNNING_SECONDS", $numSecondsRunning);
|
output_status($process_running_str, $numSecondsRunning);
|
||||||
if (is_numeric($numSecondsRunning) && (int)$numSecondsRunning < 3) {
|
if (is_numeric($numSecondsRunning) && (int)$numSecondsRunning < 3) {
|
||||||
self::$check_system_ok = false;
|
self::$check_system_ok = false;
|
||||||
output_msg("WARNING! It looks like the playout engine is continually restarting.");
|
output_msg("WARNING! It looks like the $name engine is continually restarting.");
|
||||||
$command = "tail -10 /var/log/airtime/pypo/pypo.log";
|
$command = "tail -10 $logFile";
|
||||||
exec($command, $output, $result);
|
exec($command, $output, $result);
|
||||||
foreach ($output as $line) {
|
foreach ($output as $line) {
|
||||||
output_msg($line);
|
output_msg($line);
|
||||||
|
@ -101,48 +91,37 @@ class AirtimeCheck {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function CheckLiquidsoapRunning()
|
public static function CheckAirtimeDaemons()
|
||||||
{
|
{
|
||||||
//check if airtime-playout.pid exists
|
self::CheckAirtimeDaemonRunning("/var/run/airtime-playout.pid",
|
||||||
|
"PLAYOUT_ENGINE_PROCESS_ID",
|
||||||
|
"PLAYOUT_ENGINE_RUNNING_SECONDS",
|
||||||
|
"playout",
|
||||||
|
"/var/log/airtime/pypo/pypo.log"
|
||||||
|
);
|
||||||
|
|
||||||
//if it exists we need to get the process id
|
self::CheckAirtimeDaemonRunning("/var/run/airtime-liquidsoap.pid",
|
||||||
//from the file as well as the time the process
|
"LIQUIDSOAP_PROCESS_ID",
|
||||||
//has been running. We can get the latter from
|
"LIQUIDSOAP_RUNNING_SECONDS",
|
||||||
//the timestamp of the file
|
"Liquidsoap",
|
||||||
$filename = "/var/run/airtime-liquidsoap.pid";
|
"/var/log/airtime/pypo/ls_script.log"
|
||||||
|
);
|
||||||
|
|
||||||
$pid = false;
|
self::CheckAirtimeDaemonRunning("/var/run/airtime-media-monitor.pid",
|
||||||
$numSecondsRunning = 0;
|
"MEDIA_MONITOR_PROCESS_ID",
|
||||||
|
"MEDIA_MONITOR_RUNNING_SECONDS",
|
||||||
|
"Media Monitor",
|
||||||
|
"/var/log/airtime/media-monitor/media-monitor.log"
|
||||||
|
);
|
||||||
|
|
||||||
if (file_exists($filename)){
|
self::CheckAirtimeDaemonRunning("/var/run/airtime-show-recorder.pid",
|
||||||
//first get pid
|
"SHOW_RECORDER_PROCESS_ID",
|
||||||
$potential_pid = trim(file_get_contents($filename));
|
"SHOW_RECORDER_RUNNING_SECONDS",
|
||||||
|
"Show Recorder",
|
||||||
//check if the pid is actually live
|
"/var/log/airtime/media-monitor/show-recorder.log"
|
||||||
if (file_exists("/proc/$potential_pid")){
|
);
|
||||||
$pid = $potential_pid;
|
|
||||||
|
|
||||||
//now lets get the running time
|
|
||||||
$lastModified = filemtime($filename);
|
|
||||||
$currentTime = time();
|
|
||||||
|
|
||||||
$numSecondsRunning = $currentTime - $lastModified;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output_status("LIQUIDSOAP_PROCESS_ID", $pid);
|
|
||||||
|
|
||||||
output_status("LIQUIDSOAP_RUNNING_SECONDS", $numSecondsRunning);
|
|
||||||
if (is_numeric($numSecondsRunning) && (int)$numSecondsRunning < 3) {
|
|
||||||
self::$check_system_ok = false;
|
|
||||||
output_msg("WARNING! It looks like the playout engine is continually restarting.");
|
|
||||||
$command = "tail -10 /var/log/airtime/pypo-liquidsoap/ls_script.log";
|
|
||||||
exec($command, $output, $result);
|
|
||||||
foreach ($output as $line) {
|
|
||||||
output_msg($line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function CheckIcecastRunning()
|
public static function CheckIcecastRunning()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue