Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
a4882df9
Commit
a4882df9
authored
Nov 14, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snmp: corrections for #1256
parent
d0206619
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
82 deletions
+73
-82
services.inc
src/etc/inc/services.inc
+72
-81
rc.bootup
src/etc/rc.bootup
+1
-1
No files found.
src/etc/inc/services.inc
View file @
a4882df9
...
@@ -1796,7 +1796,7 @@ function services_dnsmasq_configure($verbose = false)
...
@@ -1796,7 +1796,7 @@ function services_dnsmasq_configure($verbose = false)
}
}
if
(
$verbose
)
{
if
(
$verbose
)
{
echo
'Starting DNS
f
orwarder...'
;
echo
'Starting DNS
F
orwarder...'
;
flush
();
flush
();
}
}
...
@@ -1917,7 +1917,7 @@ function services_unbound_configure($verbose = false)
...
@@ -1917,7 +1917,7 @@ function services_unbound_configure($verbose = false)
}
}
if
(
$verbose
)
{
if
(
$verbose
)
{
echo
"Starting DNS Resolver..."
;
echo
'Starting DNS Resolver...'
;
flush
();
flush
();
}
}
...
@@ -1928,31 +1928,28 @@ function services_unbound_configure($verbose = false)
...
@@ -1928,31 +1928,28 @@ function services_unbound_configure($verbose = false)
}
}
}
}
function
services_snmpd_configure
()
function
services_snmpd_configure
(
$verbose
=
false
)
{
{
global
$config
,
$g
;
global
$config
,
$g
;
/* kill any running snmpd */
killbypid
(
'/var/run/snmpd.pid'
,
'TERM'
,
true
);
killbypid
(
'/var/run/snmpd.pid'
);
sleep
(
2
);
if
(
is_process_running
(
'bsnmpd'
))
{
if
(
!
isset
(
$config
[
'snmpd'
][
'enable'
]
))
{
mwexec
(
'/usr/bin/killall bsnmpd'
,
true
)
;
return
;
}
}
if
(
isset
(
$config
[
'snmpd'
][
'enable'
])
)
{
if
(
$verbose
)
{
if
(
file_exists
(
"/var/run/booting"
))
{
echo
'Starting SNMP daemon....'
;
echo
gettext
(
"Starting SNMP daemon... "
);
flush
(
);
}
}
/* generate snmpd.conf */
/* generate snmpd.conf */
$fd
=
fopen
(
"/var/etc/snmpd.conf"
,
"w"
);
$fd
=
fopen
(
"/var/etc/snmpd.conf"
,
"w"
);
if
(
!
$fd
)
{
if
(
!
$fd
)
{
log_error
(
'Cannot open snmpd.conf in services_snmpd_configure()'
);
log_error
(
'Cannot open snmpd.conf in services_snmpd_configure()'
);
return
1
;
return
;
}
}
$snmpdconf
=
<<<EOD
$snmpdconf
=
<<<EOD
location := "{$config['snmpd']['syslocation']}"
location := "{$config['snmpd']['syslocation']}"
contact := "{$config['snmpd']['syscontact']}"
contact := "{$config['snmpd']['syscontact']}"
...
@@ -1960,7 +1957,6 @@ read := "{$config['snmpd']['rocommunity']}"
...
@@ -1960,7 +1957,6 @@ read := "{$config['snmpd']['rocommunity']}"
EOD;
EOD;
if
(
isset
(
$config
[
'snmpd'
][
'trapenable'
])
&&
preg_match
(
'/^\S+$/'
,
$config
[
'snmpd'
][
'trapserver'
])){
if
(
isset
(
$config
[
'snmpd'
][
'trapenable'
])
&&
preg_match
(
'/^\S+$/'
,
$config
[
'snmpd'
][
'trapserver'
])){
$snmpdconf
.=
<<<EOD
$snmpdconf
.=
<<<EOD
# SNMP Trap support.
# SNMP Trap support.
...
@@ -1997,7 +1993,6 @@ begemotTrapSinkComm.[$(traphost)].$(trapport) = $(trap)
...
@@ -1997,7 +1993,6 @@ begemotTrapSinkComm.[$(traphost)].$(trapport) = $(trap)
EOD;
EOD;
}
}
$snmpdconf
.=
<<<EOD
$snmpdconf
.=
<<<EOD
begemotSnmpdCommunityDisable = 1
begemotSnmpdCommunityDisable = 1
...
@@ -2091,16 +2086,12 @@ EOD;
...
@@ -2091,16 +2086,12 @@ EOD;
fclose
(
$fd
);
fclose
(
$fd
);
unset
(
$snmpdconf
);
unset
(
$snmpdconf
);
/* run bsnmpd */
/* run bsnmpd */
mwexec
(
"/usr/sbin/bsnmpd -c /var/etc/snmpd.conf -p /var/run/snmpd.pid"
);
mwexec
(
"/usr/sbin/bsnmpd -c /var/etc/snmpd.conf -p /var/run/snmpd.pid"
);
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
$verbose
)
{
echo
gettext
(
"done."
)
.
"
\n
"
;
echo
"done.
\n
"
;
}
}
}
return
0
;
}
}
function
services_dnsupdate_process
(
$int
=
''
,
$updatehost
=
''
,
$forced
=
false
)
function
services_dnsupdate_process
(
$int
=
''
,
$updatehost
=
''
,
$forced
=
false
)
...
...
src/etc/rc.bootup
View file @
a4882df9
...
@@ -223,7 +223,7 @@ if (function_exists('plugins_configure')) {
...
@@ -223,7 +223,7 @@ if (function_exists('plugins_configure')) {
$ipsec_dynamic_hosts
=
ipsec_configure
();
$ipsec_dynamic_hosts
=
ipsec_configure
();
/* start SNMP service */
/* start SNMP service */
services_snmpd_configure
();
services_snmpd_configure
(
true
);
/* load graphing functions */
/* load graphing functions */
enable_rrd_graphing
(
true
);
enable_rrd_graphing
(
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment