mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
net-mgmt/snmp: product info read and interface cleanup changes
This commit is contained in:
parent
becb3d644d
commit
afd43c019e
3 changed files with 16 additions and 20 deletions
|
|
@ -1,5 +1,6 @@
|
|||
PLUGIN_NAME= snmp
|
||||
PLUGIN_VERSION= 1.3
|
||||
PLUGIN_REVISION= 2
|
||||
PLUGIN_DEPENDS= bsnmp-regex bsnmp-ucd
|
||||
PLUGIN_COMMENT= End of life, superseded by Net-SNMP plugin
|
||||
PLUGIN_MAINTAINER= franco@opnsense.org
|
||||
|
|
|
|||
|
|
@ -96,11 +96,14 @@ trap := "{$config['snmpd']['trapstring']}"
|
|||
EOD;
|
||||
}
|
||||
|
||||
$version = trim(file_get_contents('/usr/local/opnsense/version/opnsense'));
|
||||
$platform = $g['product_name'];
|
||||
$sysDescr = "{$g['product_name']} " . php_uname("n") .
|
||||
" {$version} {$platform} " . php_uname("s") .
|
||||
" " . php_uname("r") . " " . trim(shell_exec('uname -p'));
|
||||
$sysDescr = join(' ', array(
|
||||
$g['product_name'],
|
||||
$g['product_version'],
|
||||
php_uname('n'),
|
||||
php_uname('s'),
|
||||
php_uname('r'),
|
||||
$g['product_arch']
|
||||
));
|
||||
|
||||
$snmpdconf .= <<<EOD
|
||||
system := 1
|
||||
|
|
@ -128,14 +131,9 @@ EOD;
|
|||
|
||||
$bind_to_ip = '0.0.0.0';
|
||||
if (!empty($config['snmpd']['bindip'])) {
|
||||
if (is_ipaddr($config['snmpd']['bindip'])) {
|
||||
$bind_to_ip = $config['snmpd']['bindip'];
|
||||
} else {
|
||||
$if = get_real_interface($config['snmpd']['bindip']);
|
||||
$bind_to_ip_maybe = find_interface_ip($if);
|
||||
if (is_ipaddr($bind_to_ip_maybe)) {
|
||||
$bind_to_ip = $bind_to_ip_maybe;
|
||||
}
|
||||
$bind_to_ip_maybe = find_interface_ip(get_real_interface($config['snmpd']['bindip']));
|
||||
if (is_ipaddr($bind_to_ip_maybe)) {
|
||||
$bind_to_ip = $bind_to_ip_maybe;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -327,14 +327,11 @@ include("head.inc");
|
|||
<td>
|
||||
<select name="bindip" class="selectpicker">
|
||||
<option value=""><?= gettext('All') ?></option>
|
||||
<?php
|
||||
foreach (get_possible_listen_ips() as $lip):?>
|
||||
|
||||
<option value="<?=$lip['value'];?>" <?=$lip['value'] == $pconfig['bindip'] ? "selected=\"selected\"" : "";?>>
|
||||
<?=htmlspecialchars($lip['name']);?>
|
||||
<?php foreach (get_configured_interface_with_descr() as $ifname => $ifdescr): ?>
|
||||
<option value="<?= html_safe($ifname) ?>" <?= $ifname == $pconfig['bindip'] ? 'selected="selected"' : '' ?>>
|
||||
<?= htmlspecialchars($ifdescr) ?>
|
||||
</option>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Reference in a new issue