Refactored monitoring page
* Allow easier addition of new crons to the monitor list * Make the data generation dynamic instead of hard to adjust lists Fixes #559 upon merge.
This commit is contained in:
parent
2cddc27130
commit
367f057e6d
@ -9,106 +9,30 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
|||||||
die("404 Page not found");
|
die("404 Page not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch settings to propagate to template
|
// Default crons to monitor
|
||||||
$aCronStatus = array(
|
$aCrons = array('statistics','auto_payout','manual_payout','archive_cleanup','blockupdate','findblock','notifications','tickerupdate');
|
||||||
'statistics' => array (
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('statistics_status') ),
|
// Special cases, only add them if activated
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('statistics_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('statistics_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('statistics_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('statistics_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('statistics_message') ),
|
|
||||||
),
|
|
||||||
'auto_payout' => array (
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('auto_payout_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('auto_payout_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('auto_payout_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('auto_payout_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('auto_payout_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('auto_payout_message') ),
|
|
||||||
),
|
|
||||||
'manual_payout' => array (
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('manual_payout_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('manual_payout_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('manual_payout_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('manual_payout_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('manual_payout_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('manual_payout_message') ),
|
|
||||||
),
|
|
||||||
'archive_cleanup' => array (
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('archive_cleanup_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('archive_cleanup_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('archive_cleanup_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('archive_cleanup_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('archive_cleanup_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('archive_cleanup_message') ),
|
|
||||||
),
|
|
||||||
'blockupdate' => array (
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('blockupdate_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('blockupdate_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('blockupdate_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('blockupdate_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('blockupdate_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('blockupdate_message') ),
|
|
||||||
),
|
|
||||||
'findblock' => array (
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('findblock_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('findblock_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('findblock_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('findblock_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('findblock_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('findblock_message') ),
|
|
||||||
),
|
|
||||||
'notifications' => array (
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('notifications_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('notifications_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('notifications_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('notifications_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('notifications_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('notifications_message') ),
|
|
||||||
),
|
|
||||||
'tickerupdate' => array (
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('tickerupdate_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('tickerupdate_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('tickerupdate_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('tickerupdate_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('tickerupdate_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('tickerupdate_message') ),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// Payout system specifics
|
|
||||||
switch ($config['payout_system']) {
|
switch ($config['payout_system']) {
|
||||||
case 'pplns':
|
case 'pplns'||'pps':
|
||||||
$aCronStatus['pplns_payout'] = array (
|
$aCrons[] = $config['payout_system'];
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('pplns_payout_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('pplns_payout_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('pplns_payout_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('pplns_payout_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('pplns_payout_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('pplns_payout_message') ),
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case 'pps':
|
|
||||||
$aCronStatus['pps_payout'] = array(
|
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('pps_payout_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('pps_payout_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('pps_payout_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('pps_payout_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('pps_payout_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('pps_payout_message') ),
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case 'prop':
|
case 'prop':
|
||||||
$aCronStatus['proportional_payout'] = array(
|
$aCrons[] = 'proportional';
|
||||||
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('proportional_payout_status') ),
|
|
||||||
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('proportional_payout_active') ),
|
|
||||||
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('proportional_payout_runtime') ),
|
|
||||||
array( 'NAME' => 'Start Time', 'STATUS' => $monitoring->getStatus('proportional_payout_starttime') ),
|
|
||||||
array( 'NAME' => 'End Time', 'STATUS' => $monitoring->getStatus('proportional_payout_endtime') ),
|
|
||||||
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('proportional_payout_message') ),
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Data array for template
|
||||||
|
foreach ($aCrons as $strCron) {
|
||||||
|
$aCronStatus[$strCron] = array(
|
||||||
|
'exit' => $monitoring->getStatus($strCron . '_status'),
|
||||||
|
'active' => $monitoring->getStatus($strCron . '_active'),
|
||||||
|
'runtime' => $monitoring->getStatus($strCron . '_runtime'),
|
||||||
|
'starttime' => $monitoring->getStatus($strCron . '_starttime'),
|
||||||
|
'endtime' => $monitoring->getStatus($strCron . '_endtime'),
|
||||||
|
'message' => $monitoring->getStatus($strCron . '_message'),
|
||||||
|
);
|
||||||
|
}
|
||||||
$smarty->assign("CRONSTATUS", $aCronStatus);
|
$smarty->assign("CRONSTATUS", $aCronStatus);
|
||||||
|
|
||||||
// Tempalte specifics
|
// Tempalte specifics
|
||||||
|
|||||||
@ -10,43 +10,43 @@
|
|||||||
<th>Message</th>
|
<th>Message</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{foreach $CRONSTATUS as $cron=>$v}
|
{foreach $CRONSTATUS as $cron => $data}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{$cron}</td>
|
<td>{$cron}</td>
|
||||||
{foreach $v as $event}
|
{foreach $data as $name => $event}
|
||||||
<td>
|
<td>
|
||||||
{if $event.STATUS.type == 'okerror'}
|
{if $event.type == 'okerror'}
|
||||||
{if $event.STATUS.value == 0}
|
{if $event.value == 0}
|
||||||
<font color="green">OK</font>
|
<font color="green">OK</font>
|
||||||
{else}
|
{else}
|
||||||
<font color="red">ERROR</font>
|
<font color="red">ERROR</font>
|
||||||
{/if}
|
{/if}
|
||||||
{else if $event.STATUS.type == 'message'}
|
{else if $event.type == 'message'}
|
||||||
<i>{$event.STATUS.value}</i>
|
<i>{$event.value}</i>
|
||||||
{else if $event.STATUS.type == 'yesno'}
|
{else if $event.type == 'yesno'}
|
||||||
<img src="{$PATH}/images/{if $event.STATUS.value == 1}success{else}error{/if}.gif" />
|
<img src="{$PATH}/images/{if $event.value == 1}success{else}error{/if}.gif" />
|
||||||
{else if $event.STATUS.type == 'time'}
|
{else if $event.type == 'time'}
|
||||||
{if $event.STATUS.value > 60}
|
{if $event.value > 60}
|
||||||
<font color="orange">
|
<font color="orange">
|
||||||
{else if $event.STATUS.value > 120}
|
{else if $event.value > 120}
|
||||||
<font color="red">
|
<font color="red">
|
||||||
{else}
|
{else}
|
||||||
<font color="green">
|
<font color="green">
|
||||||
{/if}
|
{/if}
|
||||||
{$event.STATUS.value|default:"0"|number_format:"2"} seconds
|
{$event.value|default:"0"|number_format:"2"} seconds
|
||||||
</font>
|
</font>
|
||||||
{else if $event.STATUS.type == 'date'}
|
{else if $event.type == 'date'}
|
||||||
{if ($smarty.now - 180) > $event.STATUS.value}
|
{if ($smarty.now - 180) > $event.value}
|
||||||
<font color="red">
|
<font color="red">
|
||||||
{else if ($smarty.now - 120) > $event.STATUS.value}
|
{else if ($smarty.now - 120) > $event.value}
|
||||||
<font color="orange">
|
<font color="orange">
|
||||||
{else}
|
{else}
|
||||||
<font color="green">
|
<font color="green">
|
||||||
{/if}
|
{/if}
|
||||||
{$event.STATUS.value|date_format:"%m/%d %H:%M:%S"}
|
{$event.value|date_format:"%m/%d %H:%M:%S"}
|
||||||
</font>
|
</font>
|
||||||
{else}
|
{else}
|
||||||
{$event.STATUS.value|default:""}
|
{$event.value|default:""}
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user