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
e1ff81c9
Commit
e1ff81c9
authored
Aug 24, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: get rid of spurious dir (1/2)
parent
70a2bcf6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
65 deletions
+38
-65
getstats.php
src/www/getstats.php
+1
-2
graph_cpu.php
src/www/graph_cpu.php
+3
-2
functions.inc.php
src/www/includes/functions.inc.php
+32
-55
stats.php
src/www/stats.php
+2
-6
No files found.
src/www/getstats.php
View file @
e1ff81c9
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2009 Bill Marquette
...
...
@@ -37,5 +38,3 @@ require_once("system.inc");
include_once
(
"includes/functions.inc.php"
);
echo
get_stats
();
?>
src/www/graph_cpu.php
View file @
e1ff81c9
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net>
and Jonathan Watt <jwatt@jwatt.org>.
All rights reserved.
...
...
@@ -39,7 +40,7 @@ header("Content-type: image/svg+xml");
/********* Other conf *******/
$nb_plot
=
120
;
// maximum number of data points to plot in the graph
$fetch_link
=
"stats.php?stats=cpu"
;
$fetch_link
=
'stats.php'
;
//SVG attributes
$attribs
[
'axis'
]
=
'fill="black" stroke="black"'
;
...
...
src/www/includes/functions.inc.php
View file @
e1ff81c9
...
...
@@ -177,17 +177,6 @@ function get_pfstate($percent=false) {
return
$curentries
.
"/"
.
$maxstates
;
}
function
has_temp
()
{
/* no known temp monitors available at present */
/* should only reach here if there is no hardware monitor */
return
false
;
}
function
get_hwtype
()
{
return
;
}
function
get_mbuf
(
$percent
=
false
)
{
$mbufs_output
=
trim
(
`/usr/bin/netstat -mb | /usr/bin/grep "mbuf clusters in use" | /usr/bin/awk '{ print $1 }'`
);
list
(
$mbufs_current
,
$mbufs_cache
,
$mbufs_total
,
$mbufs_max
)
=
explode
(
"/"
,
$mbufs_output
);
...
...
@@ -292,71 +281,59 @@ function get_load_average() {
return
$load_average
[
0
];
}
function
get_interfacestats
()
{
global
$config
;
//build interface list for widget use
function
get_interfacestats
()
{
$ifdescrs
=
get_configured_interface_list
();
$array_in_packets
=
array
();
$array_out_packets
=
array
();
$array_in_bytes
=
array
();
$array_out_bytes
=
array
();
$array_in_errors
=
array
();
$array_out_errors
=
array
();
$array_collisions
=
array
();
$array_interrupt
=
array
();
$new_data
=
""
;
$new_data
=
''
;
//build data arrays
foreach
(
$ifdescrs
as
$ifdescr
=>
$ifname
){
foreach
(
$ifdescrs
as
$ifdescr
=>
$ifname
)
{
$ifinfo
=
get_interface_info
(
$ifdescr
);
$new_data
.=
"
{
$ifinfo
[
'inpkts'
]
}
,"
;
$new_data
.=
"
{
$ifinfo
[
'outpkts'
]
}
,"
;
$new_data
.=
format_bytes
(
$ifinfo
[
'inbytes'
])
.
","
;
$new_data
.=
format_bytes
(
$ifinfo
[
'outbytes'
])
.
","
;
if
(
isset
(
$ifinfo
[
'inerrs'
])){
$new_data
.=
"
{
$ifinfo
[
'inerrs'
]
}
,"
;
$new_data
.=
"
{
$ifinfo
[
'outerrs'
]
}
,"
;
}
else
{
$new_data
.=
"0,"
;
$new_data
.=
"0,"
;
}
if
(
isset
(
$ifinfo
[
'collisions'
]))
$new_data
.=
htmlspecialchars
(
$ifinfo
[
'collisions'
])
.
","
;
else
$new_data
.=
"0,"
;
}
//end for
$new_data
.=
"
{
$ifinfo
[
'inpkts'
]
}
,"
;
$new_data
.=
"
{
$ifinfo
[
'outpkts'
]
}
,"
;
$new_data
.=
format_bytes
(
$ifinfo
[
'inbytes'
])
.
","
;
$new_data
.=
format_bytes
(
$ifinfo
[
'outbytes'
])
.
","
;
if
(
isset
(
$ifinfo
[
'inerrs'
])){
$new_data
.=
"
{
$ifinfo
[
'inerrs'
]
}
,"
;
$new_data
.=
"
{
$ifinfo
[
'outerrs'
]
}
,"
;
}
else
{
$new_data
.=
"0,"
;
$new_data
.=
"0,"
;
}
if
(
isset
(
$ifinfo
[
'collisions'
]))
{
$new_data
.=
htmlspecialchars
(
$ifinfo
[
'collisions'
])
.
","
;
}
else
{
$new_data
.=
"0,"
;
}
}
return
$new_data
;
}
function
get_interfacestatus
()
{
$data
=
""
;
global
$config
;
//build interface list for widget use
function
get_interfacestatus
()
{
$ifdescrs
=
get_configured_interface_with_descr
();
$data
=
''
;
foreach
(
$ifdescrs
as
$ifdescr
=>
$ifname
){
foreach
(
$ifdescrs
as
$ifdescr
=>
$ifname
)
{
$ifinfo
=
get_interface_info
(
$ifdescr
);
$data
.=
$ifname
.
","
;
if
(
$ifinfo
[
'status'
]
==
"up"
||
$ifinfo
[
'status'
]
==
"associated"
)
{
if
(
$ifinfo
[
'status'
]
==
"up"
||
$ifinfo
[
'status'
]
==
"associated"
)
{
$data
.=
"up"
;
}
else
if
(
$ifinfo
[
'status'
]
==
"no carrier"
)
{
}
else
if
(
$ifinfo
[
'status'
]
==
"no carrier"
)
{
$data
.=
"down"
;
}
else
if
(
$ifinfo
[
'status'
]
==
"down"
)
{
}
else
if
(
$ifinfo
[
'status'
]
==
"down"
)
{
$data
.=
"block"
;
}
$data
.=
","
;
if
(
$ifinfo
[
'ipaddr'
])
if
(
$ifinfo
[
'ipaddr'
])
{
$data
.=
htmlspecialchars
(
$ifinfo
[
'ipaddr'
]);
}
$data
.=
","
;
if
(
$ifinfo
[
'status'
]
!=
"down"
)
if
(
$ifinfo
[
'status'
]
!=
"down"
)
{
$data
.=
htmlspecialchars
(
$ifinfo
[
'media'
]);
}
$data
.=
"~"
;
}
return
$data
;
}
src/www/stats.php
View file @
e1ff81c9
<?php
/*
Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
All rights reserved.
...
...
@@ -28,9 +29,4 @@
require_once
(
"guiconfig.inc"
);
require_once
(
"includes/functions.inc.php"
);
$cpu
=
cpu_usage
();
echo
$cpu
;
exit
;
?>
echo
cpu_usage
();
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