refactor: Update all applications to store metrics (#7853)

* Update all applications to store metrics

* fix db schema

* Add glue test
This commit is contained in:
Tony Murray
2017-12-06 16:13:10 -06:00
committed by Neil Lathwood
parent 0dd3ec25d3
commit b620692426
44 changed files with 181 additions and 74 deletions

View File

@@ -6,13 +6,11 @@ $name = 'freeswitch';
$app_id = $app['app_id'];
if (!empty($agent_data[$name])) {
$rawdata = $agent_data[$name];
update_application($app, $rawdata);
} else {
$options = '-O qv';
$oid = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.10.102.114.101.101.115.119.105.116.99.104';
$rawdata = snmp_walk($device, $oid, $options);
$rawdata = str_replace("<<<freeswitch>>>\n", '', $rawdata);
update_application($app, $rawdata);
}
# Format Data
$lines = explode("\n", $rawdata);
@@ -31,15 +29,17 @@ $rrd_def = RrdDefinition::make()
->addDataset('in_okay', 'COUNTER', 0, 4294967295)
->addDataset('out_failed', 'COUNTER', 0, 4294967295)
->addDataset('out_okay', 'COUNTER', 0, 4294967295);
$fields = array (
'calls' => $freeswitch['Calls'],
'channels' => $freeswitch['Channels'],
'peak' => $freeswitch['Peak'],
$fields = array(
'calls' => $freeswitch['Calls'],
'channels' => $freeswitch['Channels'],
'peak' => $freeswitch['Peak'],
'in_failed' => $freeswitch['InFailed'],
'in_okay' => $freeswitch['InTotal']-$freeswitch['InFailed'],
'in_okay' => $freeswitch['InTotal'] - $freeswitch['InFailed'],
'out_failed' => $freeswitch['OutFailed'],
'out_okay' => $freeswitch['OutTotal']-$freeswitch['OutFailed']
);
'out_okay' => $freeswitch['OutTotal'] - $freeswitch['OutFailed']
);
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
update_application($app, $rawdata, $fields);
unset($lines, $freeswitch, $rrd_name, $rrd_def, $fields, $tags);