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
6c25d63c
Commit
6c25d63c
authored
Feb 09, 2016
by
Ad Schellevis
Committed by
Franco Fichtner
Feb 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy/rrd) add cpu temp collector, closes
https://github.com/opnsense/core/issues/246
(cherry picked from commit
5e2a99f6
)
parent
b9067fe7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
rrd.inc
src/etc/inc/rrd.inc
+40
-0
No files found.
src/etc/inc/rrd.inc
View file @
6c25d63c
...
...
@@ -99,6 +99,7 @@ function enable_rrd_graphing()
$cellular
=
"-cellular.rrd"
;
$vpnusers
=
"-vpnusers.rrd"
;
$ntpd
=
"ntpd.rrd"
;
$cputemp
=
"-cputemp.rrd"
;
$rrdtool
=
"/usr/local/bin/rrdtool"
;
$netstat
=
"/usr/bin/netstat"
;
...
...
@@ -122,6 +123,7 @@ function enable_rrd_graphing()
$rrdcellularinterval
=
60
;
$rrdvpninterval
=
60
;
$rrdntpdinterval
=
60
;
$rrdcputempinterval
=
60
;
$trafficvalid
=
$rrdtrafficinterval
*
2
;
$wirelessvalid
=
$rrdwirelessinterval
*
2
;
...
...
@@ -134,6 +136,7 @@ function enable_rrd_graphing()
$cellularvalid
=
$rrdcellularinterval
*
2
;
$vpnvalid
=
$rrdvpninterval
*
2
;
$ntpdvalid
=
$rrdntpdinterval
*
2
;
$cputempvalid
=
$rrdcputempinterval
*
2
;
/* Assume 2*10GigE for now */
$downstream
=
2500000000
;
...
...
@@ -527,6 +530,43 @@ function enable_rrd_graphing()
$rrdupdatesh
.=
"
\n
"
;
}
/* End NTP statistics */
/* CPU Temperature */
/* the CPU Temperature gathering Function. */
/* Cpu Temp, create CPU Temperature database */
if
(
!
file_exists
(
"
$rrddbpath$ifname$cputemp
"
))
{
$rrdcreate
=
"
$rrdtool
create
$rrddbpath$ifname$cputemp
--step
$rrdcputempinterval
"
;
$rrdcreate
.=
"DS:cpu0temp:GAUGE:
$cputempvalid
:-273:5000 "
;
$rrdcreate
.=
"RRA:MIN:0.5:1:1000 "
;
$rrdcreate
.=
"RRA:MIN:0.5:5:1000 "
;
$rrdcreate
.=
"RRA:MIN:0.5:60:1000 "
;
$rrdcreate
.=
"RRA:MIN:0.5:720:3000 "
;
$rrdcreate
.=
"RRA:AVERAGE:0.5:1:1000 "
;
$rrdcreate
.=
"RRA:AVERAGE:0.5:5:1000 "
;
$rrdcreate
.=
"RRA:AVERAGE:0.5:60:1000 "
;
$rrdcreate
.=
"RRA:AVERAGE:0.5:720:3000 "
;
$rrdcreate
.=
"RRA:MAX:0.5:1:1000 "
;
$rrdcreate
.=
"RRA:MAX:0.5:5:1000 "
;
$rrdcreate
.=
"RRA:MAX:0.5:60:1000 "
;
$rrdcreate
.=
"RRA:MAX:0.5:720:3000 "
;
$rrdcreate
.=
"RRA:LAST:0.5:1:1000 "
;
$rrdcreate
.=
"RRA:LAST:0.5:5:1000 "
;
$rrdcreate
.=
"RRA:LAST:0.5:60:1000 "
;
$rrdcreate
.=
"RRA:LAST:0.5:720:3000 "
;
create_new_rrd
(
$rrdcreate
);
}
/* enter UNKNOWN values in the RRD so it knows we rebooted. */
if
(
file_exists
(
"/var/run/booting"
))
{
mwexec
(
"
$rrdtool
update
$rrddbpath$ifname$cputemp
N:U:U:U:U:U"
);
}
/* the CPU Temperature gathering function */
$rrdupdatesh
.=
"CPUTEMP=`
$sysctl
-n dev.cpu.0.temperature | sed 's/C//g'`
\n
"
;
$rrdupdatesh
.=
"
$rrdtool
update
$rrddbpath$ifname$cputemp
N:
\$
{
CPUTEMP
}
\n
"
;
/* end CPU Temp gathering */
$rrdupdatesh
.=
"sleep 60
\n
"
;
$rrdupdatesh
.=
"done
\n
"
;
log_error
(
gettext
(
"Creating rrd update script"
));
...
...
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