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
8e823ef0
Commit
8e823ef0
authored
Feb 08, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) spaces and curly braces in rrd.inc
parent
ababecf8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
567 additions
and
575 deletions
+567
-575
rrd.inc
src/etc/inc/rrd.inc
+567
-575
No files found.
src/etc/inc/rrd.inc
View file @
8e823ef0
...
@@ -41,7 +41,7 @@ function restore_rrd()
...
@@ -41,7 +41,7 @@ function restore_rrd()
}
}
$_gb
=
exec
(
'cd /;LANG=C /usr/bin/tar -xzf /conf/rrd.tgz 2>&1'
,
$rrdrestore
,
$rrdreturn
);
$_gb
=
exec
(
'cd /;LANG=C /usr/bin/tar -xzf /conf/rrd.tgz 2>&1'
,
$rrdrestore
,
$rrdreturn
);
$rrdrestore
=
implode
(
" "
,
$rrdrestore
);
$rrdrestore
=
implode
(
" "
,
$rrdrestore
);
if
(
$rrdreturn
!=
0
)
{
if
(
$rrdreturn
!=
0
)
{
log_error
(
"RRD restore failed exited with
$rrdreturn
, the error is:
$rrdrestore
\n
"
);
log_error
(
"RRD restore failed exited with
$rrdreturn
, the error is:
$rrdrestore
\n
"
);
}
}
unset
(
$rrdrestore
);
unset
(
$rrdrestore
);
...
@@ -82,8 +82,9 @@ function enable_rrd_graphing()
...
@@ -82,8 +82,9 @@ function enable_rrd_graphing()
{
{
global
$config
;
global
$config
;
if
(
file_exists
(
"/var/run/booting"
))
if
(
file_exists
(
"/var/run/booting"
))
{
echo
gettext
(
"Generating RRD graphs..."
);
echo
gettext
(
"Generating RRD graphs..."
);
}
$rrddbpath
=
"/var/db/rrd/"
;
$rrddbpath
=
"/var/db/rrd/"
;
$rrdgraphpath
=
"/usr/local/www/rrd"
;
$rrdgraphpath
=
"/usr/local/www/rrd"
;
...
@@ -139,7 +140,6 @@ function enable_rrd_graphing()
...
@@ -139,7 +140,6 @@ function enable_rrd_graphing()
$upstream
=
2500000000
;
$upstream
=
2500000000
;
if
(
isset
(
$config
[
'rrd'
][
'enable'
]))
{
if
(
isset
(
$config
[
'rrd'
][
'enable'
]))
{
/* create directory if needed */
/* create directory if needed */
if
(
!
is_dir
(
$rrddbpath
))
{
if
(
!
is_dir
(
$rrddbpath
))
{
mkdir
(
$rrddbpath
,
0775
);
mkdir
(
$rrddbpath
,
0775
);
...
@@ -167,7 +167,7 @@ function enable_rrd_graphing()
...
@@ -167,7 +167,7 @@ function enable_rrd_graphing()
/* IPsec counters */
/* IPsec counters */
$ifdescrs
[
'ipsec'
]
=
"IPsec"
;
$ifdescrs
[
'ipsec'
]
=
"IPsec"
;
/* OpenVPN server counters */
/* OpenVPN server counters */
if
(
isset
(
$config
[
'openvpn'
][
'openvpn-server'
]))
{
if
(
isset
(
$config
[
'openvpn'
][
'openvpn-server'
]))
{
foreach
(
$config
[
'openvpn'
][
'openvpn-server'
]
as
$server
)
{
foreach
(
$config
[
'openvpn'
][
'openvpn-server'
]
as
$server
)
{
$serverid
=
"ovpns"
.
$server
[
'vpnid'
];
$serverid
=
"ovpns"
.
$server
[
'vpnid'
];
$ifdescrs
[
$serverid
]
=
"
{
$server
[
'description'
]
}
"
;
$ifdescrs
[
$serverid
]
=
"
{
$server
[
'description'
]
}
"
;
...
@@ -177,7 +177,7 @@ function enable_rrd_graphing()
...
@@ -177,7 +177,7 @@ function enable_rrd_graphing()
/* process all real and pseudo interfaces */
/* process all real and pseudo interfaces */
foreach
(
$ifdescrs
as
$ifname
=>
$ifdescr
)
{
foreach
(
$ifdescrs
as
$ifname
=>
$ifdescr
)
{
$temp
=
get_real_interface
(
$ifname
);
$temp
=
get_real_interface
(
$ifname
);
if
(
$temp
<>
""
)
{
if
(
$temp
<>
""
)
{
$realif
=
$temp
;
$realif
=
$temp
;
}
}
...
@@ -202,7 +202,7 @@ function enable_rrd_graphing()
...
@@ -202,7 +202,7 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$traffic
N:U:U:U:U:U:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$traffic
N:U:U:U:U:U:U:U:U"
);
}
}
...
@@ -235,7 +235,7 @@ function enable_rrd_graphing()
...
@@ -235,7 +235,7 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$packets
N:U:U:U:U:U:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$packets
N:U:U:U:U:U:U:U:U"
);
}
}
...
@@ -248,7 +248,7 @@ function enable_rrd_graphing()
...
@@ -248,7 +248,7 @@ function enable_rrd_graphing()
$rrdupdatesh
.=
"END {print b4pi
\"
:
\"
b4po
\"
:
\"
b4bi
\"
:
\"
b4bo
\"
:
\"
b6pi
\"
:
\"
b6po
\"
:
\"
b6bi
\"
:
\"
b6bo};'`
\n
"
;
$rrdupdatesh
.=
"END {print b4pi
\"
:
\"
b4po
\"
:
\"
b4bi
\"
:
\"
b4bo
\"
:
\"
b6pi
\"
:
\"
b6po
\"
:
\"
b6bi
\"
:
\"
b6bo};'`
\n
"
;
/* WIRELESS, set up the rrd file */
/* WIRELESS, set up the rrd file */
if
(
isset
(
$config
[
'interfaces'
][
$ifname
][
'wireless'
][
'mode'
])
&&
$config
[
'interfaces'
][
$ifname
][
'wireless'
][
'mode'
]
==
"bss"
)
{
if
(
isset
(
$config
[
'interfaces'
][
$ifname
][
'wireless'
][
'mode'
])
&&
$config
[
'interfaces'
][
$ifname
][
'wireless'
][
'mode'
]
==
"bss"
)
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$wireless
"
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$wireless
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$wireless
--step
$rrdwirelessinterval
"
;
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$wireless
--step
$rrdwirelessinterval
"
;
$rrdcreate
.=
"DS:snr:GAUGE:
$wirelessvalid
:0:1000 "
;
$rrdcreate
.=
"DS:snr:GAUGE:
$wirelessvalid
:0:1000 "
;
...
@@ -264,7 +264,7 @@ function enable_rrd_graphing()
...
@@ -264,7 +264,7 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$wireless
N:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$wireless
N:U:U:U"
);
}
}
...
@@ -275,7 +275,7 @@ function enable_rrd_graphing()
...
@@ -275,7 +275,7 @@ function enable_rrd_graphing()
}
}
/* OpenVPN, set up the rrd file */
/* OpenVPN, set up the rrd file */
if
(
stristr
(
$ifname
,
"ovpns"
))
{
if
(
stristr
(
$ifname
,
"ovpns"
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$vpnusers
"
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$vpnusers
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$vpnusers
--step
$rrdvpninterval
"
;
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$vpnusers
--step
$rrdvpninterval
"
;
$rrdcreate
.=
"DS:users:GAUGE:
$vpnvalid
:0:10000 "
;
$rrdcreate
.=
"DS:users:GAUGE:
$vpnvalid
:0:10000 "
;
...
@@ -289,13 +289,13 @@ function enable_rrd_graphing()
...
@@ -289,13 +289,13 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$vpnusers
N:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$vpnusers
N:U"
);
}
}
if
(
is_array
(
$config
[
'openvpn'
][
'openvpn-server'
]))
{
if
(
is_array
(
$config
[
'openvpn'
][
'openvpn-server'
]))
{
foreach
(
$config
[
'openvpn'
][
'openvpn-server'
]
as
$server
)
{
foreach
(
$config
[
'openvpn'
][
'openvpn-server'
]
as
$server
)
{
if
(
"ovpns
{
$server
[
'vpnid'
]
}
"
==
$ifname
)
{
if
(
"ovpns
{
$server
[
'vpnid'
]
}
"
==
$ifname
)
{
$port
=
$server
[
'local_port'
];
$port
=
$server
[
'local_port'
];
$vpnid
=
$server
[
'vpnid'
];
$vpnid
=
$server
[
'vpnid'
];
}
}
...
@@ -314,7 +314,7 @@ function enable_rrd_graphing()
...
@@ -314,7 +314,7 @@ function enable_rrd_graphing()
}
}
/* 3G interfaces */
/* 3G interfaces */
if
(
preg_match
(
"/ppp[0-9]+/i"
,
$realif
))
{
if
(
preg_match
(
"/ppp[0-9]+/i"
,
$realif
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$cellular
"
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$cellular
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$cellular
--step
$rrdcellularinterval
"
;
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$cellular
--step
$rrdcellularinterval
"
;
$rrdcreate
.=
"DS:rssi:GAUGE:
$cellularvalid
:0:100 "
;
$rrdcreate
.=
"DS:rssi:GAUGE:
$cellularvalid
:0:100 "
;
...
@@ -329,7 +329,7 @@ function enable_rrd_graphing()
...
@@ -329,7 +329,7 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$cellular
N:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$cellular
N:U:U:U"
);
}
}
...
@@ -338,7 +338,6 @@ function enable_rrd_graphing()
...
@@ -338,7 +338,6 @@ function enable_rrd_graphing()
$rrdupdatesh
.=
"GSTATS=`awk -F, 'getline 2 {print
\$
2
\"
:
\"
\$
8
\"
:
\"
\$
9}' < /tmp/3gstats.
$ifname
`
\n
"
;
$rrdupdatesh
.=
"GSTATS=`awk -F, 'getline 2 {print
\$
2
\"
:
\"
\$
8
\"
:
\"
\$
9}' < /tmp/3gstats.
$ifname
`
\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$cellular
N:
\"\$
GSTATS
\"
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$cellular
N:
\"\$
GSTATS
\"
"
;
}
}
}
}
$i
++
;
$i
++
;
...
@@ -346,7 +345,7 @@ function enable_rrd_graphing()
...
@@ -346,7 +345,7 @@ function enable_rrd_graphing()
$ifname
=
"system"
;
$ifname
=
"system"
;
/* STATES, create pf states database */
/* STATES, create pf states database */
if
(
!
file_exists
(
"
$rrddbpath$ifname$states
"
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$states
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$states
--step
$rrdstatesinterval
"
;
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$states
--step
$rrdstatesinterval
"
;
$rrdcreate
.=
"DS:pfrate:GAUGE:
$statesvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:pfrate:GAUGE:
$statesvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:pfstates:GAUGE:
$statesvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:pfstates:GAUGE:
$statesvalid
:0:10000000 "
;
...
@@ -363,7 +362,7 @@ function enable_rrd_graphing()
...
@@ -363,7 +362,7 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$states
N:U:U:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$states
N:U:U:U:U:U"
);
}
}
...
@@ -377,11 +376,10 @@ function enable_rrd_graphing()
...
@@ -377,11 +376,10 @@ function enable_rrd_graphing()
$rrdupdatesh
.=
"srcip=
\"
` cat /tmp/pfctl_ss_out | egrep -v '<
\\
-.*?<
\\
-|
\\
->.*?
\\
->' | grep '
\\
->' | awk '{print
\$
3}' | awk -F: '{print
\$
1}' | sort -u|wc -l|sed 's/ //g' `
\"\n
"
;
$rrdupdatesh
.=
"srcip=
\"
` cat /tmp/pfctl_ss_out | egrep -v '<
\\
-.*?<
\\
-|
\\
->.*?
\\
->' | grep '
\\
->' | awk '{print
\$
3}' | awk -F: '{print
\$
1}' | sort -u|wc -l|sed 's/ //g' `
\"\n
"
;
$rrdupdatesh
.=
"dstip=
\"
` cat /tmp/pfctl_ss_out | egrep -v '<
\\
-.*?<
\\
-|
\\
->.*?
\\
->' | grep '<
\\
-' | awk '{print
\$
3}' | awk -F: '{print
\$
1}' | sort -u|wc -l|sed 's/ //g' `
\"\n
"
;
$rrdupdatesh
.=
"dstip=
\"
` cat /tmp/pfctl_ss_out | egrep -v '<
\\
-.*?<
\\
-|
\\
->.*?
\\
->' | grep '<
\\
-' | awk '{print
\$
3}' | awk -F: '{print
\$
1}' | sort -u|wc -l|sed 's/ //g' `
\"\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$states
N:
\$
pfrate:
\$
pfstates:
\$
pfnat:
\$
srcip:
\$
dstip
\n\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$states
N:
\$
pfrate:
\$
pfstates:
\$
pfnat:
\$
srcip:
\$
dstip
\n\n
"
;
/* End pf states statistics */
/* End pf states statistics */
/* CPU, create CPU statistics database */
/* CPU, create CPU statistics database */
if
(
!
file_exists
(
"
$rrddbpath$ifname$proc
"
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$proc
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$proc
--step
$rrdprocinterval
"
;
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$proc
--step
$rrdprocinterval
"
;
$rrdcreate
.=
"DS:user:GAUGE:
$procvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:user:GAUGE:
$procvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:nice:GAUGE:
$procvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:nice:GAUGE:
$procvalid
:0:10000000 "
;
...
@@ -398,7 +396,7 @@ function enable_rrd_graphing()
...
@@ -398,7 +396,7 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$proc
N:U:U:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$proc
N:U:U:U:U:U"
);
}
}
...
@@ -407,11 +405,10 @@ function enable_rrd_graphing()
...
@@ -407,11 +405,10 @@ function enable_rrd_graphing()
/* Using ps uxaH will count all processes including system threads. Top was undercounting. */
/* Using ps uxaH will count all processes including system threads. Top was undercounting. */
$rrdupdatesh
.=
"PROCS=`ps uxaH | wc -l | awk '{print
\$
1;}'`
\n
"
;
$rrdupdatesh
.=
"PROCS=`ps uxaH | wc -l | awk '{print
\$
1;}'`
\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$proc
N:
\$
{
CPU}:\${PROCS
}
\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$proc
N:
\$
{
CPU}:\${PROCS
}
\n
"
;
/* End CPU statistics */
/* End CPU statistics */
/* Memory, create Memory statistics database */
/* Memory, create Memory statistics database */
if
(
!
file_exists
(
"
$rrddbpath$ifname$mem
"
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$mem
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$mem
--step
$rrdmeminterval
"
;
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$mem
--step
$rrdmeminterval
"
;
$rrdcreate
.=
"DS:active:GAUGE:
$memvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:active:GAUGE:
$memvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:inactive:GAUGE:
$memvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:inactive:GAUGE:
$memvalid
:0:10000000 "
;
...
@@ -436,7 +433,7 @@ function enable_rrd_graphing()
...
@@ -436,7 +433,7 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$mem
N:U:U:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$mem
N:U:U:U:U:U"
);
}
}
...
@@ -445,11 +442,10 @@ function enable_rrd_graphing()
...
@@ -445,11 +442,10 @@ function enable_rrd_graphing()
$rrdupdatesh
.=
"
$awk
'{getline active;getline inactive;getline free;getline cache;getline wire;printf "
;
$rrdupdatesh
.=
"
$awk
'{getline active;getline inactive;getline free;getline cache;getline wire;printf "
;
$rrdupdatesh
.=
"((active/$0) * 100)
\"
:
\"
((inactive/$0) * 100)
\"
:
\"
((free/$0) * 100)
\"
:
\"
((cache/$0) * 100)
\"
:
\"
(wire/$0 * 100)}'`
\n
"
;
$rrdupdatesh
.=
"((active/$0) * 100)
\"
:
\"
((inactive/$0) * 100)
\"
:
\"
((free/$0) * 100)
\"
:
\"
((cache/$0) * 100)
\"
:
\"
(wire/$0 * 100)}'`
\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$mem
N:
\$
{
MEM
}
\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$mem
N:
\$
{
MEM
}
\n
"
;
/* End Memory statistics */
/* End Memory statistics */
/* mbuf, create mbuf statistics database */
/* mbuf, create mbuf statistics database */
if
(
!
file_exists
(
"
$rrddbpath$ifname$mbuf
"
))
{
if
(
!
file_exists
(
"
$rrddbpath$ifname$mbuf
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$mbuf
--step
$rrdmbufinterval
"
;
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$mbuf
--step
$rrdmbufinterval
"
;
$rrdcreate
.=
"DS:current:GAUGE:
$mbufvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:current:GAUGE:
$mbufvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:cache:GAUGE:
$mbufvalid
:0:10000000 "
;
$rrdcreate
.=
"DS:cache:GAUGE:
$mbufvalid
:0:10000000 "
;
...
@@ -473,7 +469,7 @@ function enable_rrd_graphing()
...
@@ -473,7 +469,7 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$mbuf
N:U:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$mbuf
N:U:U:U:U"
);
}
}
...
@@ -514,10 +510,9 @@ function enable_rrd_graphing()
...
@@ -514,10 +510,9 @@ function enable_rrd_graphing()
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ntpd
N:U:U:U:U:U:U"
);
mwexec
(
"
$rrdtool
update
$rrddbpath$ntpd
N:U:U:U:U:U:U"
);
}
}
/* the ntp stats gathering function. */
/* the ntp stats gathering function. */
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
"
$ntpq
-c rv |
$awk
'BEGIN{ RS=
\"
,
\"
}{ print }' >> /tmp/ntp-rrdstats.$$\n"
;
$rrdupdatesh
.=
"
$ntpq
-c rv |
$awk
'BEGIN{ RS=
\"
,
\"
}{ print }' >> /tmp/ntp-rrdstats.$$\n"
;
...
@@ -530,10 +525,8 @@ function enable_rrd_graphing()
...
@@ -530,10 +525,8 @@ function enable_rrd_graphing()
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ntpd
\N:
\$
{
NOFFSET}:\${NSJIT}:\${NCJIT}:\${NWANDER}:\${NFREQ}:\${NDISPER
}
\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ntpd
\N:
\$
{
NOFFSET}:\${NSJIT}:\${NCJIT}:\${NWANDER}:\${NFREQ}:\${NDISPER
}
\n
"
;
$rrdupdatesh
.=
"rm /tmp/ntp-rrdstats.$$\n"
;
$rrdupdatesh
.=
"rm /tmp/ntp-rrdstats.$$\n"
;
$rrdupdatesh
.=
"
\n
"
;
$rrdupdatesh
.=
"
\n
"
;
}
}
/* End NTP statistics */
/* End NTP statistics */
$rrdupdatesh
.=
"sleep 60
\n
"
;
$rrdupdatesh
.=
"sleep 60
\n
"
;
$rrdupdatesh
.=
"done
\n
"
;
$rrdupdatesh
.=
"done
\n
"
;
log_error
(
gettext
(
"Creating rrd update script"
));
log_error
(
gettext
(
"Creating rrd update script"
));
...
@@ -550,7 +543,6 @@ function enable_rrd_graphing()
...
@@ -550,7 +543,6 @@ function enable_rrd_graphing()
/* start traffic collector */
/* start traffic collector */
mwexec_bg
(
"/bin/sh
$updaterrdscript
"
);
mwexec_bg
(
"/bin/sh
$updaterrdscript
"
);
}
else
{
}
else
{
/* kill off traffic collectors */
/* kill off traffic collectors */
kill_traffic_collector
();
kill_traffic_collector
();
...
@@ -561,9 +553,9 @@ function enable_rrd_graphing()
...
@@ -561,9 +553,9 @@ function enable_rrd_graphing()
chown
(
$database
,
"nobody"
);
chown
(
$database
,
"nobody"
);
}
}
if
(
file_exists
(
"/var/run/booting"
))
if
(
file_exists
(
"/var/run/booting"
))
{
echo
gettext
(
"done."
)
.
"
\n
"
;
echo
gettext
(
"done."
)
.
"
\n
"
;
}
}
}
function
create_gateway_quality_rrd
(
$rrd_file
)
function
create_gateway_quality_rrd
(
$rrd_file
)
...
@@ -587,7 +579,7 @@ function create_gateway_quality_rrd($rrd_file)
...
@@ -587,7 +579,7 @@ function create_gateway_quality_rrd($rrd_file)
}
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrd_file
N:U:U"
);
mwexec
(
"
$rrdtool
update
$rrd_file
N:U:U"
);
}
}
unset
(
$rrdtool
,
$rrdinterval
,
$valid
,
$rrd_file
);
unset
(
$rrdtool
,
$rrdinterval
,
$valid
,
$rrd_file
);
...
...
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