Adding last runtime to monitoring page

Displays the date/time of the last successful run.

Fixes #431
This commit is contained in:
Sebastian Grewe 2013-07-11 13:25:22 +02:00
parent 4b684ac45a
commit 875572813b
3 changed files with 12 additions and 1 deletions

View File

@ -22,7 +22,7 @@ limitations under the License.
$monitoring->setStatus($cron_name . "_message", "message", "OK");
$monitoring->setStatus($cron_name . "_status", "okerror", 0);
$monitoring->setStatus($cron_name . "_runtime", "time", microtime(true) - $cron_start[$cron_name]);
$monitoring->setStatus($cron_name . "_lastrun", "date", time());
// Mark cron as running for monitoring
$monitoring->setStatus($cron_name . '_active', "yesno", 0);
?>

View File

@ -15,30 +15,35 @@ $aCronStatus = array(
array( 'NAME' => 'Exit Code', 'STATUS' => $monitoring->getStatus('statistics_status') ),
array( 'NAME' => 'Active', 'STATUS' => $monitoring->getStatus('statistics_active') ),
array( 'NAME' => 'Runtime', 'STATUS' => $monitoring->getStatus('statistics_runtime') ),
array( 'NAME' => 'Last Run', 'STATUS' => $monitoring->getStatus('statistics_lastrun') ),
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' => 'Last Run', 'STATUS' => $monitoring->getStatus('auto_payout_lastrun') ),
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('auto_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' => 'Last Run', 'STATUS' => $monitoring->getStatus('archive_cleanup_lastrun') ),
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' => 'Last Run', 'STATUS' => $monitoring->getStatus('blockupdate_lastrun') ),
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' => 'Last Run', 'STATUS' => $monitoring->getStatus('findblock_lastrun') ),
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('findblock_message') ),
)
);
@ -49,6 +54,7 @@ case 'pplns':
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' => 'Last Run', 'STATUS' => $monitoring->getStatus('pplns_payout_lastrun') ),
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('pplns_payout_message') ),
);
break;
@ -57,6 +63,7 @@ case 'pps':
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' => 'Last Run', 'STATUS' => $monitoring->getStatus('pps_payout_lastrun') ),
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('pps_payout_message') ),
);
break;
@ -65,6 +72,7 @@ case 'prop':
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' => 'Last Run', 'STATUS' => $monitoring->getStatus('proportional_payout_lastrun') ),
array( 'NAME' => 'Last Message', 'STATUS' => $monitoring->getStatus('proportional_payout_message') ),
);
break;

View File

@ -5,6 +5,7 @@
<th>Exit Code</th>
<th>Active</th>
<th>Runtime</th>
<th>Last Run</th>
<th>Message</th>
</thead>
<tbody>
@ -29,6 +30,8 @@
{/if}
{else if $event.STATUS.type == 'time'}
{$event.STATUS.value|default:"0"|number_format:"2"} seconds
{else if $event.STATUS.type == 'date'}
{$event.STATUS.value|date_format:"%m/%d %H:%M:%S"}
{else}
{$event.STATUS.value|default:""}
{/if}