mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Fix coding style part 2
This commit is contained in:
@@ -10,49 +10,42 @@
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
*/
|
||||
|
||||
if($device['os_group'] == "cisco" && $device['os'] == "asa" && $device['type'] == "firewall")
|
||||
{
|
||||
if ($device['os_group'] == 'cisco' && $device['os'] == 'asa' && $device['type'] == 'firewall') {
|
||||
$oid_list = 'cfwConnectionStatValue.protoIp.currentInUse';
|
||||
$temp_data = snmpwalk_cache_double_oid($device, $oid_list, array(), 'CISCO-FIREWALL-MIB');
|
||||
foreach ($temp_data as $oid => $result) {
|
||||
$oid = substr(strchr($oid, '.'), 1);
|
||||
$data[$oid]['data'] = $result['cfwConnectionStatValue'];
|
||||
$asa_db = dbFetchCell('SELECT `ciscoASA_id` FROM `ciscoASA` WHERE `device_id` = ? AND `oid` = ?', array($device['device_id'], $oid));
|
||||
if (!is_numeric($asa_db)) {
|
||||
$asa_db = dbInsert(array('device_id' => $device['device_id'], 'oid' => $oid, 'data' => $result['cfwConnectionStatValue']), 'ciscoASA');
|
||||
}
|
||||
else {
|
||||
$asa_db = dbUpdate(array('data' => $result['cfwConnectionStatValue']), 'ciscoASA', 'device_id=?', array($device['device_id']));
|
||||
}
|
||||
|
||||
$oid_list = "cfwConnectionStatValue.protoIp.currentInUse";
|
||||
$temp_data = snmpwalk_cache_double_oid($device, $oid_list, array(), "CISCO-FIREWALL-MIB");
|
||||
foreach ($temp_data as $oid => $result)
|
||||
{
|
||||
$oid = substr(strchr($oid, '.'),1);
|
||||
$data[$oid]['data'] = $result['cfwConnectionStatValue'];
|
||||
$asa_db = dbFetchCell("SELECT `ciscoASA_id` FROM `ciscoASA` WHERE `device_id` = ? AND `oid` = ?", array($device['device_id'],$oid));
|
||||
if(!is_numeric($asa_db))
|
||||
{
|
||||
$asa_db = dbInsert(array('device_id' => $device['device_id'], 'oid' => $oid, 'data' => $result['cfwConnectionStatValue']), 'ciscoASA');
|
||||
}
|
||||
else
|
||||
{
|
||||
$asa_db = dbUpdate(array('data' => $result['cfwConnectionStatValue']), 'ciscoASA', 'device_id=?',array($device['device_id']));
|
||||
}
|
||||
$data[$oid]['db_id'] = $asa_db;
|
||||
}
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("asa_conns.rrd");
|
||||
|
||||
$rrd_create .= " DS:connections:GAUGE:600:0:U";
|
||||
$rrd_create .= $config['rrd_rra'];
|
||||
|
||||
if(is_file($rrd_filename) || $data['currentInUse'])
|
||||
{
|
||||
if (!file_exists($rrd_filename))
|
||||
{
|
||||
rrdtool_create($rrd_filename, $rrd_create);
|
||||
$data[$oid]['db_id'] = $asa_db;
|
||||
}
|
||||
|
||||
$rrd_update = "N";
|
||||
$rrd_update .= ":".$data['currentInUse']['data'];
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('asa_conns.rrd');
|
||||
|
||||
rrdtool_update($rrd_filename, $rrd_update);
|
||||
$graphs['asa_conns'] = TRUE;
|
||||
echo(" ASA Connections");
|
||||
}
|
||||
unset($data,$rrd_filename,$rrd_create,$rrd_update);
|
||||
}
|
||||
$rrd_create .= ' DS:connections:GAUGE:600:0:U';
|
||||
$rrd_create .= $config['rrd_rra'];
|
||||
|
||||
?>
|
||||
if (is_file($rrd_filename) || $data['currentInUse']) {
|
||||
if (!file_exists($rrd_filename)) {
|
||||
rrdtool_create($rrd_filename, $rrd_create);
|
||||
}
|
||||
|
||||
$rrd_update = 'N';
|
||||
$rrd_update .= ':'.$data['currentInUse']['data'];
|
||||
|
||||
rrdtool_update($rrd_filename, $rrd_update);
|
||||
$graphs['asa_conns'] = true;
|
||||
echo ' ASA Connections';
|
||||
}
|
||||
|
||||
unset($data,$rrd_filename,$rrd_create,$rrd_update);
|
||||
}//end if
|
||||
|
||||
Reference in New Issue
Block a user