feature: Added functionality to support recording status info (#6628)

* feature: Added functionality to support recording status info

* updated phpdoc block
This commit is contained in:
Neil Lathwood
2017-05-13 12:55:38 +01:00
committed by Tony Murray
parent 0338734fe7
commit 1ce58cd33d
2 changed files with 6 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ $rrd_name = array('app', $name, $app_id);
$rrd_def = RrdDefinition::make()->addDataset('packages', 'GAUGE', 0); $rrd_def = RrdDefinition::make()->addDataset('packages', 'GAUGE', 0);
$osupdates = snmp_get($device, $oid, $options, $mib); $osupdates = snmp_get($device, $oid, $options, $mib);
update_application($app, $osupdates); update_application($app, $osupdates, $osupdates);
$fields = array('packages' => $osupdates,); $fields = array('packages' => $osupdates,);

View File

@@ -548,8 +548,9 @@ function location_to_latlng($device)
* *
* @param array $app app from the db, including app_id * @param array $app app from the db, including app_id
* @param string $response This should be the full output * @param string $response This should be the full output
* @param string $current This is the current value we store in rrd for graphing
*/ */
function update_application($app, $response) function update_application($app, $response, $current = '')
{ {
if (!is_numeric($app['app_id'])) { if (!is_numeric($app['app_id'])) {
d_echo('$app does not contain app_id, could not update'); d_echo('$app does not contain app_id, could not update');
@@ -557,8 +558,9 @@ function update_application($app, $response)
} }
$data = array( $data = array(
'app_state' => 'UNKNOWN', 'app_state' => 'UNKNOWN',
'timestamp' => array('NOW()'), 'app_status' => $current,
'timestamp' => array('NOW()'),
); );
if ($response != '' && $response !== false) { if ($response != '' && $response !== false) {