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
df81ae81
Commit
df81ae81
authored
Oct 05, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rrd: purge the old frontend, move settings to settings
parent
af8f5ab0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
3 additions
and
1850 deletions
+3
-1850
Menu.xml
src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml
+1
-3
ACL_Legacy_Page_Map.json
...nse/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json
+0
-8
status_rrd_graph.php
src/www/status_rrd_graph.php
+0
-687
status_rrd_graph_img.php
src/www/status_rrd_graph_img.php
+0
-1113
status_rrd_graph_settings.php
src/www/status_rrd_graph_settings.php
+2
-3
status_rrd_graph_tabs.inc
src/www/status_rrd_graph_tabs.inc
+0
-36
No files found.
src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml
View file @
df81ae81
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
<Miscellaneous
url=
"/system_advanced_misc.php"
/>
<Miscellaneous
url=
"/system_advanced_misc.php"
/>
<Tunables
VisibleName=
"Tunables"
url=
"/system_advanced_sysctl.php"
/>
<Tunables
VisibleName=
"Tunables"
url=
"/system_advanced_sysctl.php"
/>
<Notifications
url=
"/system_advanced_notifications.php"
/>
<Notifications
url=
"/system_advanced_notifications.php"
/>
<RRDGraphs
VisibleName=
"RRD Graphs"
url=
"/status_rrd_graph_settings.php"
/>
</Settings>
</Settings>
<Wizard
url=
"/wizard.php"
cssClass=
"fa fa-magic"
>
<Wizard
url=
"/wizard.php"
cssClass=
"fa fa-magic"
>
<Step
url=
"/wizard.php*"
/>
<Step
url=
"/wizard.php*"
/>
...
@@ -247,9 +248,6 @@
...
@@ -247,9 +248,6 @@
</LoadBalancer>
</LoadBalancer>
<NTP
url=
"/status_ntpd.php"
/>
<NTP
url=
"/status_ntpd.php"
/>
<OpenVPN
url=
"/status_openvpn.php"
/>
<OpenVPN
url=
"/status_openvpn.php"
/>
<RRDGraphs
VisibleName=
"RRD Graphs"
url=
"/status_rrd_graph.php"
>
<Settings
url=
"/status_rrd_graph_settings.php"
/>
</RRDGraphs>
<Services
url=
"/status_services.php"
>
<Services
url=
"/status_services.php"
>
<ServicesActions
url=
"/status_services.php?*"
/>
<ServicesActions
url=
"/status_services.php?*"
/>
</Services>
</Services>
...
...
src/opnsense/mvc/app/models/OPNsense/Core/ACL_Legacy_Page_Map.json
View file @
df81ae81
...
@@ -1129,14 +1129,6 @@
...
@@ -1129,14 +1129,6 @@
"status_openvpn.php*"
"status_openvpn.php*"
]
]
},
},
"page-status-rrdgraphs"
:
{
"name"
:
"WebCfg - Status: RRD Graphs page"
,
"descr"
:
"Allow access to the 'Status: RRD Graphs' page."
,
"match"
:
[
"status_rrd_graph.php*"
,
"status_rrd_graph_img.php*"
]
},
"page-status-rrdgraph-settings"
:
{
"page-status-rrdgraph-settings"
:
{
"name"
:
"WebCfg - Status: RRD Graphs settings page"
,
"name"
:
"WebCfg - Status: RRD Graphs settings page"
,
"descr"
:
"Allow access to the 'Status: RRD Graphs: settings' page."
,
"descr"
:
"Allow access to the 'Status: RRD Graphs: settings' page."
,
...
...
src/www/status_rrd_graph.php
deleted
100644 → 0
View file @
af8f5ab0
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2007 Seth Mos <seth.mos@dds.nl>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require_once
(
"guiconfig.inc"
);
require_once
(
"rrd.inc"
);
require_once
(
"interfaces.inc"
);
unset
(
$input_errors
);
/* if the rrd graphs are not enabled redirect to settings page */
if
(
!
isset
(
$config
[
'rrd'
][
'enable'
]))
{
header
(
"Location: status_rrd_graph_settings.php"
);
}
$rrddbpath
=
"/var/db/rrd/"
;
chdir
(
$rrddbpath
);
$databases
=
glob
(
"*.rrd"
);
if
(
$_GET
[
'cat'
])
{
$curcat
=
htmlspecialchars
(
$_GET
[
'cat'
]);
}
else
{
if
(
!
empty
(
$config
[
'rrd'
][
'category'
]))
{
$curcat
=
$config
[
'rrd'
][
'category'
];
}
else
{
$curcat
=
"system"
;
}
}
if
(
$_GET
[
'zone'
])
$curzone
=
$_GET
[
'zone'
];
else
$curzone
=
''
;
if
(
$_GET
[
'period'
])
{
$curperiod
=
$_GET
[
'period'
];
}
else
{
if
(
!
empty
(
$config
[
'rrd'
][
'period'
]))
{
$curperiod
=
$config
[
'rrd'
][
'period'
];
}
else
{
$curperiod
=
"absolute"
;
}
}
if
(
$_GET
[
'option'
])
{
$curoption
=
$_GET
[
'option'
];
}
else
{
switch
(
$curcat
)
{
case
"system"
:
$curoption
=
"processor"
;
break
;
case
"quality"
:
foreach
(
$databases
as
$database
)
{
if
(
preg_match
(
"/[-]quality\.rrd/i"
,
$database
))
{
/* pick off the 1st database we find that matches the quality graph */
$name
=
explode
(
"-"
,
$database
);
$curoption
=
"
$name[0]
"
;
continue
2
;
}
}
case
"wireless"
:
foreach
(
$databases
as
$database
)
{
if
(
preg_match
(
"/[-]wireless\.rrd/i"
,
$database
))
{
/* pick off the 1st database we find that matches the wireless graph */
$name
=
explode
(
"-"
,
$database
);
$curoption
=
"
$name[0]
"
;
continue
2
;
}
}
case
"cellular"
:
foreach
(
$databases
as
$database
)
{
if
(
preg_match
(
"/[-]cellular\.rrd/i"
,
$database
))
{
/* pick off the 1st database we find that matches the celullar graph */
$name
=
explode
(
"-"
,
$database
);
$curoption
=
"
$name[0]
"
;
continue
2
;
}
}
case
"vpnusers"
:
foreach
(
$databases
as
$database
)
{
if
(
preg_match
(
"/[-]vpnusers\.rrd/i"
,
$database
))
{
/* pick off the 1st database we find that matches the VPN graphs */
$name
=
explode
(
"-"
,
$database
);
$curoption
=
"
$name[0]
"
;
continue
2
;
}
}
case
"captiveportal"
:
$curoption
=
"allgraphs"
;
break
;
case
"ntpd"
:
if
(
isset
(
$config
[
'ntpd'
][
'statsgraph'
]))
{
$curoption
=
"allgraphs"
;
}
else
{
$curoption
=
"processor"
;
$curcat
=
"system"
;
}
break
;
default
:
$curoption
=
"wan"
;
break
;
}
}
$now
=
time
();
if
(
$curcat
==
"custom"
)
{
if
(
is_numeric
(
$_GET
[
'start'
]))
{
if
(
$start
<
(
$now
-
(
3600
*
24
*
365
*
5
)))
{
$start
=
$now
-
(
8
*
3600
);
}
$start
=
$_GET
[
'start'
];
}
else
if
(
$_GET
[
'start'
])
{
$start
=
strtotime
(
$_GET
[
'start'
]);
if
(
$start
===
FALSE
||
$start
===
-
1
)
{
$input_errors
[]
=
gettext
(
"Invalid start date/time:"
)
.
" '
{
$_GET
[
'start'
]
}
'"
;
$start
=
$now
-
(
8
*
3600
);
}
}
else
{
$start
=
$now
-
(
8
*
3600
);
}
}
if
(
is_numeric
(
$_GET
[
'end'
]))
{
$end
=
$_GET
[
'end'
];
}
else
if
(
$_GET
[
'end'
])
{
$end
=
strtotime
(
$_GET
[
'end'
]);
if
(
$end
===
FALSE
||
$end
===
-
1
)
{
$input_errors
[]
=
gettext
(
"Invalid end date/time:"
)
.
" '
{
$_GET
[
'end'
]
}
'"
;
$end
=
$now
;
}
}
else
{
$end
=
$now
;
}
/* this should never happen */
if
(
$end
<
$start
)
{
log_error
(
"start
$start
is smaller than end
$end
"
);
$end
=
$now
;
}
$seconds
=
$end
-
$start
;
$styles
=
array
(
'inverse'
=>
gettext
(
'Inverse'
),
'absolute'
=>
gettext
(
'Absolute'
));
// Set default and override later
$curstyle
=
"inverse"
;
if
(
$_GET
[
'style'
])
{
foreach
(
$styles
as
$style
)
if
(
strtoupper
(
$style
)
==
strtoupper
(
$_GET
[
'style'
]))
$curstyle
=
$_GET
[
'style'
];
}
else
{
if
(
!
empty
(
$config
[
'rrd'
][
'style'
]))
{
$curstyle
=
$config
[
'rrd'
][
'style'
];
}
else
{
$curstyle
=
"inverse"
;
}
}
/* sort names reverse so WAN comes first */
rsort
(
$databases
);
/* these boilerplate databases are required for the other menu choices */
$dbheader
=
array
(
"allgraphs-traffic.rrd"
,
"allgraphs-quality.rrd"
,
"allgraphs-wireless.rrd"
,
"allgraphs-cellular.rrd"
,
"allgraphs-vpnusers.rrd"
,
"allgraphs-packets.rrd"
,
"system-allgraphs.rrd"
,
"system-throughput.rrd"
,
"outbound-quality.rrd"
,
"outbound-packets.rrd"
,
"outbound-traffic.rrd"
);
/* additional menu choices for the custom tab */
$dbheader_custom
=
array
(
"system-throughput.rrd"
);
foreach
(
$databases
as
$database
)
{
if
(
stristr
(
$database
,
"-wireless"
))
{
$wireless
=
true
;
}
if
(
stristr
(
$database
,
"-cellular"
)
&&
!
empty
(
$config
[
'ppps'
]))
{
$cellular
=
true
;
}
if
(
stristr
(
$database
,
"-vpnusers"
))
{
$vpnusers
=
true
;
}
if
(
stristr
(
$database
,
"captiveportal-"
)
&&
is_array
(
$config
[
'captiveportal'
]))
{
$captiveportal
=
true
;
}
if
(
stristr
(
$database
,
"ntpd"
)
&&
isset
(
$config
[
'ntpd'
][
'statsgraph'
]))
{
$ntpd
=
true
;
}
}
/* append the existing array to the header */
$ui_databases
=
array_merge
(
$dbheader
,
$databases
);
$custom_databases
=
array_merge
(
$dbheader_custom
,
$databases
);
$graphs
=
array
(
"eighthour"
,
"day"
,
"week"
,
"month"
,
"quarter"
,
"year"
,
"fouryear"
);
$periods
=
array
(
"absolute"
=>
gettext
(
"Absolute Timespans"
),
"current"
=>
gettext
(
"Current Period"
),
"previous"
=>
gettext
(
"Previous Period"
));
$graph_length
=
array
(
"eighthour"
=>
28800
,
"day"
=>
86400
,
"week"
=>
604800
,
"month"
=>
2678400
,
"quarter"
=>
7948800
,
"year"
=>
31622400
,
"fouryear"
=>
126230400
);
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"RRD Graphs"
));
$closehead
=
false
;
/* Load all CP zones */
if
(
$captiveportal
&&
is_array
(
$config
[
'captiveportal'
]))
{
$cp_zones_tab_array
=
array
();
foreach
(
$config
[
'captiveportal'
]
as
$cpkey
=>
$cp
)
{
if
(
!
isset
(
$cp
[
'enable'
]))
continue
;
if
(
$curzone
==
''
)
{
$tabactive
=
true
;
$curzone
=
$cpkey
;
}
elseif
(
$curzone
==
$cpkey
)
{
$tabactive
=
true
;
}
else
{
$tabactive
=
false
;
}
$cp_zones_tab_array
[]
=
array
(
$cp
[
'zone'
],
$tabactive
,
"status_rrd_graph.php?cat=captiveportal&zone=
$cpkey
"
);
}
}
include
(
"head.inc"
);
?>
<body>
<?php
function
get_dates
(
$curperiod
,
$graph
)
{
global
$graph_length
;
$now
=
time
();
$end
=
$now
;
if
(
$curperiod
==
"absolute"
)
{
$start
=
$end
-
$graph_length
[
$graph
];
}
else
{
$curyear
=
date
(
'Y'
,
$now
);
$curmonth
=
date
(
'm'
,
$now
);
$curweek
=
date
(
'W'
,
$now
);
$curweekday
=
date
(
'N'
,
$now
)
-
1
;
// We want to start on monday
$curday
=
date
(
'd'
,
$now
);
$curhour
=
date
(
'G'
,
$now
);
switch
(
$curperiod
)
{
case
"previous"
:
$offset
=
-
1
;
break
;
default
:
$offset
=
0
;
}
switch
(
$graph
)
{
case
"eighthour"
:
if
(
$curhour
<
24
)
$starthour
=
16
;
if
(
$curhour
<
16
)
$starthour
=
8
;
if
(
$curhour
<
8
)
$starthour
=
0
;
switch
(
$offset
)
{
case
0
:
$houroffset
=
$starthour
;
break
;
default
:
$houroffset
=
$starthour
+
(
$offset
*
8
);
break
;
}
$start
=
mktime
(
$houroffset
,
0
,
0
,
$curmonth
,
$curday
,
$curyear
);
if
(
$offset
!=
0
)
{
$end
=
mktime
((
$houroffset
+
8
),
0
,
0
,
$curmonth
,
$curday
,
$curyear
);
}
break
;
case
"day"
:
$start
=
mktime
(
0
,
0
,
0
,
$curmonth
,
(
$curday
+
$offset
),
$curyear
);
if
(
$offset
!=
0
)
$end
=
mktime
(
0
,
0
,
0
,
$curmonth
,
((
$curday
+
$offset
)
+
1
),
$curyear
);
break
;
case
"week"
:
switch
(
$offset
)
{
case
0
:
$weekoffset
=
0
;
break
;
default
:
$weekoffset
=
(
$offset
*
7
)
-
7
;
break
;
}
$start
=
mktime
(
0
,
0
,
0
,
$curmonth
,
((
$curday
-
$curweekday
)
+
$weekoffset
),
$curyear
);
if
(
$offset
!=
0
)
$end
=
mktime
(
0
,
0
,
0
,
$curmonth
,
((
$curday
-
$curweekday
)
+
$weekoffset
+
7
),
$curyear
);
break
;
case
"month"
:
$start
=
mktime
(
0
,
0
,
0
,
(
$curmonth
+
$offset
),
0
,
$curyear
);
if
(
$offset
!=
0
)
$end
=
mktime
(
0
,
0
,
0
,
((
$curmonth
+
$offset
)
+
1
),
0
,
$curyear
);
break
;
case
"quarter"
:
$start
=
mktime
(
0
,
0
,
0
,
((
$curmonth
-
2
)
+
$offset
),
0
,
$curyear
);
if
(
$offset
!=
0
)
$end
=
mktime
(
0
,
0
,
0
,
((
$curmonth
+
$offset
)
+
1
),
0
,
$curyear
);
break
;
case
"year"
:
$start
=
mktime
(
0
,
0
,
0
,
1
,
0
,
(
$curyear
+
$offset
));
if
(
$offset
!=
0
)
$end
=
mktime
(
0
,
0
,
0
,
1
,
0
,
((
$curyear
+
$offset
)
+
1
));
break
;
case
"fouryear"
:
$start
=
mktime
(
0
,
0
,
0
,
1
,
0
,
((
$curyear
-
3
)
+
$offset
));
if
(
$offset
!=
0
)
$end
=
mktime
(
0
,
0
,
0
,
1
,
0
,
((
$curyear
+
$offset
)
+
1
));
break
;
}
}
// echo "start $start ". date('l jS \of F Y h:i:s A', $start) .", end $end ". date('l jS \of F Y h:i:s A', $end) ."<br />";
$dates
=
array
();
$dates
[
'start'
]
=
$start
;
$dates
[
'end'
]
=
$end
;
return
$dates
;
}
?>
<?php
include
(
"fbegin.inc"
);
?>
<section
class=
"page-content-main"
>
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<?php
if
(
$input_errors
&&
count
(
$input_errors
))
print_input_errors
(
$input_errors
);
?>
<section
class=
"col-xs-12"
>
<?
include
(
"status_rrd_graph_tabs.inc"
);
?>
<div
class=
"tab-content content-box col-xs-12"
>
<?php
if
(
$curcat
==
"captiveportal"
)
:
?>
<?php
display_top_tabs
(
$cp_zones_tab_array
);
?>
<?php
endif
;
?>
<form
name=
"form1"
action=
"status_rrd_graph.php"
method=
"get"
>
<input
type=
"hidden"
name=
"cat"
value=
"
<?php
echo
"
$curcat
"
;
?>
"
/>
<div
class=
"container-fluid"
>
<p><b>
<?=
gettext
(
"Note: Change of color and/or style may not take effect until the next refresh"
);
?>
</b></p>
</div>
<div
id=
"responsive-table"
>
<table
class=
"table table-striped table-sort __nomb"
>
<tr>
<td>
<?=
gettext
(
"Graphs:"
);
?>
</td>
<td>
<?php
if
(
!
empty
(
$curzone
))
:
?>
<input
type=
"hidden"
name=
"zone"
value=
"
<?=
htmlspecialchars
(
$curzone
)
?>
"
/>
<?php
endif
;
?>
<select
name=
"option"
class=
"form-control"
style=
"z-index: -10;"
onchange=
"document.form1.submit()"
>
<?php
if
(
$curcat
==
"custom"
)
{
foreach
(
$custom_databases
as
$db
=>
$database
)
{
$optionc
=
explode
(
"-"
,
$database
);
$search
=
array
(
"-"
,
".rrd"
,
$optionc
);
$replace
=
array
(
" :: "
,
""
,
$friendly
);
echo
"<option value=
\"
{
$database
}
\"
"
;
$prettyprint
=
ucwords
(
str_replace
(
$search
,
$replace
,
$database
));
if
(
$curoption
==
$database
)
{
echo
" selected=
\"
selected
\"
"
;
}
echo
">"
.
htmlspecialchars
(
$prettyprint
)
.
"</option>
\n
"
;
}
}
foreach
(
$ui_databases
as
$db
=>
$database
)
{
if
(
!
preg_match
(
"/(
$curcat
)/i"
,
$database
))
continue
;
if
((
$curcat
==
"captiveportal"
)
&&
!
empty
(
$curzone
)
&&
!
preg_match
(
"/captiveportal-
{
$curzone
}
/i"
,
$database
))
continue
;
$optionc
=
explode
(
"-"
,
$database
);
$search
=
array
(
"-"
,
".rrd"
,
$optionc
);
$replace
=
array
(
" :: "
,
""
,
$friendly
);
switch
(
$curcat
)
{
case
"captiveportal"
:
$optionc
=
str_replace
(
$search
,
$replace
,
$optionc
[
2
]);
echo
"<option value=
\"
$optionc
\"
"
;
$prettyprint
=
ucwords
(
str_replace
(
$search
,
$replace
,
$optionc
));
break
;
case
"system"
:
$optionc
=
str_replace
(
$search
,
$replace
,
$optionc
[
1
]);
echo
"<option value=
\"
$optionc
\"
"
;
$prettyprint
=
ucwords
(
str_replace
(
$search
,
$replace
,
$optionc
));
break
;
default
:
/* Deduce a interface if possible and use the description */
$optionc
=
"
$optionc[0]
"
;
$friendly
=
convert_friendly_interface_to_friendly_descr
(
strtolower
(
$optionc
));
if
(
empty
(
$friendly
))
{
$friendly
=
$optionc
;
}
$search
=
array
(
"-"
,
".rrd"
,
$optionc
);
$replace
=
array
(
" :: "
,
""
,
$friendly
);
echo
"<option value=
\"
$optionc
\"
"
;
$prettyprint
=
ucwords
(
str_replace
(
$search
,
$replace
,
$friendly
));
}
if
(
$curoption
==
$optionc
)
{
echo
" selected=
\"
selected
\"
"
;
}
echo
">"
.
htmlspecialchars
(
$prettyprint
)
.
"</option>
\n
"
;
}
?>
</select>
</td>
<td>
<?=
gettext
(
"Style:"
);
?>
</td>
<td>
<select
name=
"style"
class=
"form-control"
style=
"z-index: -10;"
onchange=
"document.form1.submit()"
>
<?php
foreach
(
$styles
as
$style
=>
$styled
)
{
echo
"<option value=
\"
$style
\"
"
;
if
(
$style
==
$curstyle
)
echo
" selected=
\"
selected
\"
"
;
echo
">"
.
htmlspecialchars
(
$styled
)
.
"</option>
\n
"
;
}
?>
</select>
</td>
<?php
if
(
$curcat
<>
"custom"
)
{
?>
<td>
<?=
gettext
(
"Period:"
);
?>
</td>
<td><select
name=
"period"
class=
"form-control"
style=
"z-index: -10;"
onchange=
"document.form1.submit()"
>
<?php
foreach
(
$periods
as
$period
=>
$value
)
{
echo
"<option value=
\"
$period
\"
"
;
if
(
$period
==
$curperiod
)
echo
" selected=
\"
selected
\"
"
;
echo
">"
.
htmlspecialchars
(
$value
)
.
"</option>
\n
"
;
}
echo
"</select>
\n
"
;
echo
"</td></tr>
\n
"
;
}
?>
<?php
if
(
$curcat
==
"custom"
)
{
$tz
=
date_default_timezone_get
();
$tz_msg
=
gettext
(
"Enter date and/or time. Current timezone:"
)
.
"
$tz
"
;
$start_fmt
=
strftime
(
"%m/%d/%Y %H:%M:%S"
,
$start
);
$end_fmt
=
strftime
(
"%m/%d/%Y %H:%M:%S"
,
$end
);
?>
<td>
<?=
gettext
(
"Start:"
);
?>
</td>
<td>
<input
id=
"startDateTime"
title=
"
<?=
htmlentities
(
$tz_msg
);
?>
."
type=
"text"
name=
"start"
class=
"form-control"
size=
"24"
value=
"
<?=
htmlentities
(
$start_fmt
);
?>
"
/>
</td>
<td>
<?=
gettext
(
"End:"
);
?>
</td>
<td>
<input
id=
"endDateTime"
title=
"
<?=
htmlentities
(
$tz_msg
);
?>
."
type=
"text"
name=
"end"
class=
"form-control"
size=
"24"
value=
"
<?=
htmlentities
(
$end_fmt
);
?>
"
/>
</td>
<td>
<input
type=
"submit"
name=
"Submit"
class=
"btn btn-primary value="
<?=
gettext
(
"Go"
);
?>
"
/>
</td></tr>
<?php
$curdatabase
=
$curoption
;
$graph
=
"custom-
$curdatabase
"
;
if
(
in_array
(
$curdatabase
,
$custom_databases
))
{
$id
=
"
{
$graph
}
-
{
$curoption
}
-
{
$curdatabase
}
"
;
$id
=
preg_replace
(
'/\./'
,
'_'
,
$id
);
$img_date
=
date
(
'YmdGis'
);
/* Add a way to let the browser know we have refreshed the image */
echo
"<tr><td colspan=
\"
100%
\"
class=
\"
list
\"
>
\n
"
;
echo
"<img border=
\"
0
\"
style=
\"
max-width:100%; height:auto
\"
name=
\"
{
$id
}
\"
"
;
echo
"id=
\"
{
$id
}
\"
alt=
\"
$prettydb
Graph
\"
"
;
echo
"src=
\"
status_rrd_graph_img.php?start=
{
$start
}
&end=
{
$end
}
&database=
{
$curdatabase
}
&style=
{
$curstyle
}
&graph=
{
$graph
}
-
{
$img_date
}
\"
/>
\n
"
;
echo
"<br /><hr /><br />
\n
"
;
echo
"</td></tr>
\n
"
;
}
}
else
{
foreach
(
$graphs
as
$graph
)
{
/* check which databases are valid for our category */
foreach
(
$ui_databases
as
$curdatabase
)
{
if
(
!
preg_match
(
"/(
$curcat
)/i"
,
$curdatabase
))
continue
;
if
((
$curcat
==
"captiveportal"
)
&&
!
empty
(
$curzone
)
&&
!
preg_match
(
"/captiveportal-
{
$curzone
}
/i"
,
$curdatabase
))
continue
;
$optionc
=
explode
(
"-"
,
$curdatabase
);
$search
=
array
(
"-"
,
".rrd"
,
$optionc
);
$replace
=
array
(
" :: "
,
""
,
$friendly
);
switch
(
$curoption
)
{
case
"outbound"
:
/* make sure we do not show the placeholder databases in the outbound view */
if
((
stristr
(
$curdatabase
,
"outbound"
))
||
(
stristr
(
$curdatabase
,
"allgraphs"
)))
{
continue
2
;
}
/* only show interfaces with a gateway */
$optionc
=
"
$optionc[0]
"
;
if
(
!
interface_has_gateway
(
$optionc
))
{
if
(
!
isset
(
$gateways_arr
))
{
if
(
preg_match
(
"/quality/i"
,
$curdatabase
))
$gateways_arr
=
return_gateways_array
();
else
$gateways_arr
=
array
();
}
$found_gateway
=
false
;
foreach
(
$gateways_arr
as
$gw
)
{
if
(
$gw
[
'name'
]
==
$optionc
)
{
$found_gateway
=
true
;
break
;
}
}
if
(
!
$found_gateway
)
{
continue
2
;
}
}
if
(
!
preg_match
(
"/(^
$optionc
-|-
$optionc
\\
.)/i"
,
$curdatabase
))
{
continue
2
;
}
break
;
case
"allgraphs"
:
/* make sure we do not show the placeholder databases in the all view */
if
((
stristr
(
$curdatabase
,
"outbound"
))
||
(
stristr
(
$curdatabase
,
"allgraphs"
)))
{
continue
2
;
}
break
;
default
:
/* just use the name here */
if
(
!
preg_match
(
"/(^
$curoption
-|-
$curoption
\\
.)/i"
,
$curdatabase
))
{
continue
2
;
}
}
if
(
in_array
(
$curdatabase
,
$ui_databases
))
{
$id
=
"
{
$graph
}
-
{
$curoption
}
-
{
$curdatabase
}
"
;
$id
=
preg_replace
(
'/\./'
,
'_'
,
$id
);
$img_date
=
date
(
'YmdGis'
);
/* Add a way to let the browser know we have refreshed the image */
$dates
=
get_dates
(
$curperiod
,
$graph
);
$start
=
$dates
[
'start'
];
$end
=
$dates
[
'end'
];
echo
"<tr><td colspan=
\"
100%
\"
class=
\"
list
\"
>
\n
"
;
echo
"<img border=
\"
0
\"
style=
\"
max-width:100%; height:auto
\"
name=
\"
{
$id
}
\"
"
;
echo
"id=
\"
{
$id
}
\"
alt=
\"
$prettydb
Graph
\"
"
;
echo
"src=
\"
status_rrd_graph_img.php?start=
{
$start
}
&end=
{
$end
}
&database=
{
$curdatabase
}
&style=
{
$curstyle
}
&graph=
{
$graph
}
-
{
$img_date
}
\"
/>
\n
"
;
echo
"<br /><hr /><br />
\n
"
;
echo
"</td></tr>
\n
"
;
}
}
}
}
?>
</table>
</form>
</div>
</div>
</section>
<section
class=
"col-xs-12"
>
<div
class=
"content-box"
>
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
function
update_graph_images
()
{
//alert('updating');
var
randomid
=
Math
.
floor
(
Math
.
random
()
*
11
);
<?php
foreach
(
$graphs
as
$graph
)
{
/* check which databases are valid for our category */
foreach
(
$ui_databases
as
$curdatabase
)
{
if
(
!
stristr
(
$curdatabase
,
$curcat
))
{
continue
;
}
$optionc
=
explode
(
"-"
,
$curdatabase
);
$search
=
array
(
"-"
,
".rrd"
,
$optionc
);
$replace
=
array
(
" :: "
,
""
,
$friendly
);
switch
(
$curoption
)
{
case
"outbound"
:
/* make sure we do not show the placeholder databases in the outbound view */
if
((
stristr
(
$curdatabase
,
"outbound"
))
||
(
stristr
(
$curdatabase
,
"allgraphs"
)))
{
continue
2
;
}
/* only show interfaces with a gateway */
$optionc
=
"
$optionc[0]
"
;
if
(
!
interface_has_gateway
(
$optionc
))
{
if
(
!
isset
(
$gateways_arr
))
if
(
preg_match
(
"/quality/i"
,
$curdatabase
))
$gateways_arr
=
return_gateways_array
();
else
$gateways_arr
=
array
();
$found_gateway
=
false
;
foreach
(
$gateways_arr
as
$gw
)
{
if
(
$gw
[
'name'
]
==
$optionc
)
{
$found_gateway
=
true
;
break
;
}
}
if
(
!
$found_gateway
)
{
continue
2
;
}
}
if
(
!
preg_match
(
"/(^
$optionc
-|-
$optionc
\\
.)/i"
,
$curdatabase
))
{
continue
2
;
}
break
;
case
"allgraphs"
:
/* make sure we do not show the placeholder databases in the all view */
if
((
stristr
(
$curdatabase
,
"outbound"
))
||
(
stristr
(
$curdatabase
,
"allgraphs"
)))
{
continue
2
;
}
break
;
default
:
/* just use the name here */
if
(
!
preg_match
(
"/(^
$curoption
-|-
$curoption
\\
.)/i"
,
$curdatabase
))
{
continue
2
;
}
}
$dates
=
get_dates
(
$curperiod
,
$graph
);
$start
=
$dates
[
'start'
];
if
(
$curperiod
==
"current"
)
{
$end
=
$dates
[
'end'
];
}
/* generate update events utilizing jQuery('') feature */
$id
=
"
{
$graph
}
-
{
$curoption
}
-
{
$curdatabase
}
"
;
$id
=
preg_replace
(
'/\./'
,
'_'
,
$id
);
echo
"
\n
"
;
echo
"
\t\t
jQuery('#
{
$id
}
').attr('src','status_rrd_graph_img.php?start=
{
$start
}
&graph=
{
$graph
}
&database=
{
$curdatabase
}
&style=
{
$curstyle
}
&tmp=' + randomid);
\n
"
;
}
}
?>
window
.
setTimeout
(
'
update_graph_images()
'
,
355000
);
}
window
.
setTimeout
(
'
update_graph_images()
'
,
355000
);
//]]>
</script>
</div>
</section>
</div>
</div>
</section>
<?php
include
(
"foot.inc"
);
?>
src/www/status_rrd_graph_img.php
deleted
100644 → 0
View file @
af8f5ab0
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2009 Seth Mos <seth.mos@dds.nl>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require_once
(
"guiconfig.inc"
);
require_once
(
"rrd.inc"
);
require_once
(
"interfaces.inc"
);
global
$g
;
$pgtitle
=
array
(
gettext
(
"System"
),
gettext
(
"RRD Graphs"
),
gettext
(
"Image viewer"
));
if
(
$_GET
[
'database'
])
{
$curdatabase
=
basename
(
$_GET
[
'database'
]);
$curdatabase
=
str_replace
(
array
(
"<"
,
">"
,
";"
,
"&"
,
"'"
,
'"'
),
""
,
htmlspecialchars_decode
(
$curdatabase
,
ENT_QUOTES
|
ENT_HTML401
));
}
else
{
$curdatabase
=
"wan-traffic.rrd"
;
}
if
(
$_GET
[
'style'
])
{
$curstyle
=
$_GET
[
'style'
];
}
else
{
$curstyle
=
"inverse"
;
}
/* this is used for temp name */
if
(
$_GET
[
'graph'
])
{
$curgraph
=
str_replace
(
array
(
"<"
,
">"
,
";"
,
"&"
,
"'"
,
'"'
,
'.'
,
'/'
),
""
,
htmlspecialchars_decode
(
$_GET
[
'graph'
],
ENT_QUOTES
|
ENT_HTML401
));
}
else
{
$curgraph
=
"custom"
;
}
$now
=
time
();
if
(
is_numeric
(
$_GET
[
'start'
]))
{
$start
=
$_GET
[
'start'
];
}
else
{
$start
=
$now
-
(
8
*
3600
);
}
if
(
is_numeric
(
$_GET
[
'end'
]))
{
$end
=
$_GET
[
'end'
];
}
else
{
$end
=
$now
;
}
/* this should never happen */
if
(
$end
<
$start
)
{
log_error
(
"start
$start
is smaller than end
$end
"
);
$end
=
$now
;
}
$seconds
=
$end
-
$start
;
$scales
=
array
();
$scales
[
14400
]
=
"MINUTE:5:MINUTE:10:MINUTE:30:0:%H%:%M"
;
$scales
[
57600
]
=
"MINUTE:30:HOUR:1:HOUR:1:0:%H"
;
$scales
[
172800
]
=
"HOUR:1:HOUR:6:HOUR:2:0:%H"
;
$scales
[
691200
]
=
"HOUR:2:HOUR:12:DAY:1:0:%D %d"
;
$scales
[
2764800
]
=
"DAY:1:WEEK:1:WEEK:1:0:Week %W"
;
$scales
[
16070400
]
=
"WEEK:1:MONTH:1:MONTH:1:0:%b"
;
$scales
[
42854400
]
=
"MONTH:1:MONTH:1:MONTH:1:0:%b"
;
$archives
=
array
();
$archives
[
1
]
=
1200
;
$archives
[
5
]
=
720
;
$archives
[
60
]
=
1860
;
$archives
[
1440
]
=
2284
;
$defOptions
=
array
(
'to'
=>
1
,
'parts'
=>
1
,
'precision'
=>
'minute'
,
'distance'
=>
FALSE
,
'separator'
=>
', '
);
/* always set the average to the highest value as a fallback */
$average
=
1440
*
60
;
foreach
(
$archives
as
$rra
=>
$value
)
{
$archivestart
=
$now
-
(
$rra
*
60
*
$value
);
if
(
$archivestart
<=
$start
)
{
$average
=
$rra
*
60
;
break
;
}
}
foreach
(
$scales
as
$scalelength
=>
$value
)
{
if
(
$scalelength
>=
$seconds
)
{
$scale
=
$value
;
break
;
}
}
// log_error("start $start, end $end, archivestart $archivestart, average $average, scale $scale, seconds $seconds");
/* Deduce a interface if possible and use the description */
$curif
=
explode
(
"-"
,
$curdatabase
);
$curif
=
"
$curif[0]
"
;
$friendly
=
convert_friendly_interface_to_friendly_descr
(
strtolower
(
$curif
));
if
(
$friendly
==
""
)
{
$friendly
=
$curif
;
}
$search
=
array
(
"-"
,
".rrd"
,
$curif
);
$replace
=
array
(
" :: "
,
""
,
$friendly
);
$prettydb
=
ucwords
(
str_replace
(
$search
,
$replace
,
$curdatabase
));
$rrddbpath
=
"/var/db/rrd/"
;
$rrdtmppath
=
"/tmp/"
;
$rrdtool
=
"/usr/local/bin/rrdtool"
;
$uptime
=
"/usr/bin/uptime"
;
$sed
=
"/usr/bin/sed"
;
$havg
=
timeDiff
(
$average
,
$defOptions
);
$hperiod
=
timeDiff
(
$seconds
,
$defOptions
);
$data
=
true
;
/* Don't leave it up to RRD Tool to select the RRA and resolution to use. */
/* Specify the RRA and resolution to use per the graph havg value. */
switch
(
$havg
)
{
case
"1 minute"
:
$step
=
60
;
break
;
case
"5 minutes"
:
$step
=
300
;
break
;
case
"1 hour"
:
$step
=
3600
;
break
;
case
"1 day"
:
$step
=
86400
;
break
;
default
:
$step
=
0
;
break
;
}
$rrddbpath
=
"/var/db/rrd/"
;
chdir
(
$rrddbpath
);
$databases
=
glob
(
"*.rrd"
);
rsort
(
$databases
);
/* ALTQ remnants? */
$downstream
=
12500000
;
$upstream
=
12500000
;
$speedlimit
=
(
$upstream
+
$downstream
);
/* Set default colors explicitly, the theme can then override them below.
This prevents missing colors in themes from crashing the graphs. */
/* Traffic Outbound Out-P-4, Out-B-4, Out-P-6, Out-B-6 */
$colortrafficup
=
array
(
'666666'
,
'CCCCCC'
,
'2217AA'
,
'625AE7'
);
/* Traffic Inbound In-P-4, In-B-4, In-P-6, In-B-6 */
$colortrafficdown
=
array
(
'990000'
,
'CC0000'
,
'FFC875'
,
'FF9900'
);
/* Packets Outbound Out-P-4, Out-B-4, Out-P-6, Out-B-6 */
$colorpacketsup
=
array
(
'666666'
,
'CCCCCC'
,
'2217AA'
,
'625AE7'
);
/* Packets Inbound In-P-4, In-B-4, In-P-6, In-B-6 */
$colorpacketsdown
=
array
(
'990000'
,
'CC0000'
,
'FFC875'
,
'FF9900'
);
/* 95th Percentile Lines Out, In */
$colortraffic95
=
array
(
'660000'
,
'FF0000'
);
/* State Table pfrate, pfstates, pfnat, srcip, dstip */
$colorstates
=
array
(
'00AA00'
,
'990000'
,
'0000FF'
,
'000000'
,
'DD9B00'
);
/* Processor Usage user, nice, system, int, processes */
$colorprocessor
=
array
(
'00AA00'
,
'990000'
,
'0000FF'
,
'DD9B00'
,
'000000'
);
/* Memory Usage active, inact, free, cache, wire */
$colormemory
=
array
(
'00AA00'
,
'990000'
,
'0000FF'
,
'666666'
,
'DD9B00'
);
/* MBUF Usage current, cache, total, max */
$colormbuf
=
array
(
'0080FF'
,
'00E344'
,
'FF0000'
,
'000000'
);
/* Quality Graph Delay >420, 180-420, 60-180, 20-60, <20, Delay Avg */
$colorqualityrtt
=
array
(
'990000'
,
'a83c3c'
,
'b36666'
,
'bd9090'
,
'cccccc'
,
'000000'
);
/* Quality Graph Loss */
$colorqualityloss
=
'ee0000'
;
/* Wireless Graph SNR, Rate, Channel*/
/* Cellular Graph RSSI, */
$colorwireless
=
array
(
'333333'
,
'a83c3c'
,
'999999'
);
/* OpenVPN Users Online Users */
$colorvpnusers
=
array
(
'990000'
);
/* NTPD stats offset, clk jit, sys jit, wander */
$colorntpd
=
array
(
'0080FF'
,
'00E344'
,
'FF0000'
,
'000000'
);
/* Captive Portal Total Users Total Users */
/* Captive Portal Concurrent Concurrent Users */
$colorcaptiveportalusers
=
array
(
'990000'
);
switch
(
$curstyle
)
{
case
"absolute"
:
$multiplier
=
1
;
$AREA
=
"LINE1"
;
break
;
default
:
$multiplier
=
-
1
;
$AREA
=
"AREA"
;
break
;
}
function
timeDiff
(
$time
,
$opt
=
array
())
{
// The default values
$defOptions
=
array
(
'to'
=>
0
,
'parts'
=>
1
,
'precision'
=>
'second'
,
'distance'
=>
TRUE
,
'separator'
=>
', '
);
$opt
=
array_merge
(
$defOptions
,
$opt
);
// Default to current time if no to point is given
(
!
$opt
[
'to'
])
&&
(
$opt
[
'to'
]
=
time
());
// Init an empty string
$str
=
''
;
// To or From computation
$diff
=
(
$opt
[
'to'
]
>
$time
)
?
$opt
[
'to'
]
-
$time
:
$time
-
$opt
[
'to'
];
// An array of label => periods of seconds;
$periods
=
array
(
'decade'
=>
315569260
,
'year'
=>
31539600
,
'month'
=>
2629744
,
'week'
=>
604800
,
'day'
=>
86400
,
'hour'
=>
3600
,
'minute'
=>
60
,
'second'
=>
1
);
// 31539600, 31556926, 31622400
// Round to precision
if
(
$opt
[
'precision'
]
!=
'second'
)
$diff
=
round
((
$diff
/
$periods
[
$opt
[
'precision'
]]))
*
$periods
[
$opt
[
'precision'
]];
// Report the value is 'less than 1 ' precision period away
(
0
==
$diff
)
&&
(
$str
=
'less than 1 '
.
$opt
[
'precision'
]);
// Loop over each period
foreach
(
$periods
as
$label
=>
$value
)
{
// Stitch together the time difference string
((
$x
=
round
(
$diff
/
$value
))
&&
$opt
[
'parts'
]
--
)
&&
$str
.=
(
$str
?
$opt
[
'separator'
]
:
''
)
.
(
$x
.
' '
.
$label
.
(
$x
>
1
?
's'
:
''
));
// Stop processing if no more parts are going to be reported.
if
(
$opt
[
'parts'
]
==
0
||
$label
==
$opt
[
'precision'
])
break
;
// Get ready for the next pass
$diff
-=
$x
*
$value
;
}
$opt
[
'distance'
]
&&
$str
.=
(
$str
&&
$opt
[
'to'
]
>=
$time
)
?
' ago'
:
' away'
;
return
$str
;
}
if
((
strstr
(
$curdatabase
,
"-traffic.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for traffic stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
--vertical-label
\"
bits/sec
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
$curif
-in_bytes_pass=
$rrddbpath$curdatabase
:inpass:AVERAGE:step=
$step
"
;
$graphcmd
.=
"DEF:
$curif
-out_bytes_pass=
$rrddbpath$curdatabase
:outpass:AVERAGE:step=
$step
"
;
$graphcmd
.=
"DEF:
$curif
-in_bytes_block=
$rrddbpath$curdatabase
:inblock:AVERAGE:step=
$step
"
;
$graphcmd
.=
"DEF:
$curif
-out_bytes_block=
$rrddbpath$curdatabase
:outblock:AVERAGE:step=
$step
"
;
$graphcmd
.=
"DEF:
$curif
-in6_bytes_pass=
$rrddbpath$curdatabase
:inpass6:AVERAGE:step=
$step
"
;
$graphcmd
.=
"DEF:
$curif
-out6_bytes_pass=
$rrddbpath$curdatabase
:outpass6:AVERAGE:step=
$step
"
;
$graphcmd
.=
"DEF:
$curif
-in6_bytes_block=
$rrddbpath$curdatabase
:inblock6:AVERAGE:step=
$step
"
;
$graphcmd
.=
"DEF:
$curif
-out6_bytes_block=
$rrddbpath$curdatabase
:outblock6:AVERAGE:step=
$step
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in_bits_pass=
$curif
-in_bytes_pass,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_bits_pass=
$curif
-out_bytes_pass,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in_bits_block=
$curif
-in_bytes_block,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_bits_block=
$curif
-out_bytes_block,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in6_bits_pass=
$curif
-in6_bytes_pass,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_bits_pass=
$curif
-out6_bytes_pass,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in6_bits_block=
$curif
-in6_bytes_block,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_bits_block=
$curif
-out6_bytes_block,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in_bytes=
$curif
-in_bytes_pass,
$curif
-in_bytes_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_bytes=
$curif
-out_bytes_pass,
$curif
-out_bytes_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in_bits=
$curif
-in_bits_pass,
$curif
-in_bits_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_bits=
$curif
-out_bits_pass,
$curif
-out_bits_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in6_bytes=
$curif
-in6_bytes_pass,
$curif
-in6_bytes_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_bytes=
$curif
-out6_bytes_pass,
$curif
-out6_bytes_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in6_bits=
$curif
-in6_bits_pass,
$curif
-in6_bits_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_bits=
$curif
-out6_bits_pass,
$curif
-out6_bits_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bits_io=
$curif
-in_bits,
$curif
-out_bits,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_bits_block_neg=
$curif
-out_bits_block,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_bits_pass_neg=
$curif
-out_bits_pass,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bits6_io=
$curif
-in6_bits,
$curif
-out6_bits,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_bits_block_neg=
$curif
-out6_bits_block,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_bits_pass_neg=
$curif
-out6_bits_pass,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_in_pass=
$curif
-in_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
$curif
-in_bytes_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_out_pass=
$curif
-out_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
$curif
-out_bytes_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_in_block=
$curif
-in_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
$curif
-in_bytes_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_out_block=
$curif
-out_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
$curif
-out_bytes_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_in6_pass=
$curif
-in6_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
$curif
-in6_bytes_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_out6_pass=
$curif
-out6_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
$curif
-out6_bytes_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_in6_block=
$curif
-in6_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
$curif
-in6_bytes_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_out6_block=
$curif
-out6_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
$curif
-out6_bytes_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_pass=
$curif
-bytes_in_pass,
$curif
-bytes_out_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_block=
$curif
-bytes_in_block,
$curif
-bytes_out_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_pass6=
$curif
-bytes_in6_pass,
$curif
-bytes_out6_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_block6=
$curif
-bytes_in6_block,
$curif
-bytes_out6_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_in_t_pass=
$curif
-in_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
$curif
-in_bytes_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_out_t_pass=
$curif
-out_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
$curif
-out_bytes_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_in_t_block=
$curif
-in_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
$curif
-in_bytes_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_out_t_block=
$curif
-out_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
$curif
-out_bytes_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_in6_t_pass=
$curif
-in6_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
$curif
-in6_bytes_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_out6_t_pass=
$curif
-out6_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
$curif
-out6_bytes_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_in6_t_block=
$curif
-in6_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
$curif
-in6_bytes_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_out6_t_block=
$curif
-out6_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
$curif
-out6_bytes_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_t_pass=
$curif
-bytes_in_t_pass,
$curif
-bytes_out_t_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_t_block=
$curif
-bytes_in_t_block,
$curif
-bytes_out_t_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_t=
$curif
-bytes_t_pass,
$curif
-bytes_t_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_t_pass6=
$curif
-bytes_in6_t_pass,
$curif
-bytes_out6_t_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_t_block6=
$curif
-bytes_in6_t_block,
$curif
-bytes_out6_t_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-bytes_t6=
$curif
-bytes_t_pass6,
$curif
-bytes_t_block6,+
\"
"
;
$graphcmd
.=
"VDEF:
\"
$curif
-in_bits_95=
$curif
-in_bits,95,PERCENT
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_bits_mul=
$curif
-out_bits,
$multiplier
,*
\"
"
;
$perc
=
$multiplier
>
0
?
"95"
:
"5"
;
$graphcmd
.=
"VDEF:
\"
$curif
-out_bits_95=
$curif
-out_bits_mul,
{
$perc
}
,PERCENT
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-in_bits_block#
{
$colortrafficdown
[
1
]
}
:
$curif
-in-block
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-in_bits_pass#
{
$colortrafficdown
[
0
]
}
:
$curif
-in-pass:STACK
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-in6_bits_block#
{
$colortrafficdown
[
3
]
}
:
$curif
-in6-block:STACK
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-in6_bits_pass#
{
$colortrafficdown
[
2
]
}
:
$curif
-in6-pass:STACK
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"
{
$AREA
}
:
\"
$curif
-out_bits_block_neg#
{
$colortrafficup
[
1
]
}
:
$curif
-out-block
\"
"
;
$graphcmd
.=
"
{
$AREA
}
:
\"
$curif
-out_bits_pass_neg#
{
$colortrafficup
[
0
]
}
:
$curif
-out-pass:STACK
\"
"
;
$graphcmd
.=
"
{
$AREA
}
:
\"
$curif
-out6_bits_block_neg#
{
$colortrafficup
[
3
]
}
:
$curif
-out6-block:STACK
\"
"
;
$graphcmd
.=
"
{
$AREA
}
:
\"
$curif
-out6_bits_pass_neg#
{
$colortrafficup
[
2
]
}
:
$curif
-out6-pass:STACK
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"HRULE:
\"
$curif
-in_bits_95#
{
$colortraffic95
[
1
]
}
:
$curif
-in (95%)
\"
"
;
$graphcmd
.=
"HRULE:
\"
$curif
-out_bits_95#
{
$colortraffic95
[
0
]
}
:
$curif
-out (95%)
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t
maximum
\t
average
\t\t
current
\t
period
\t
95th percentile
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
IPv4 in-pass
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_bits_pass:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_bits_pass:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_bits_pass:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-bytes_in_t_pass:AVERAGE:%7.2lf %sB i
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_bits_95:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
IPv4 out-pass
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_bits_pass:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_bits_pass:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_bits_pass:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-bytes_out_t_pass:AVERAGE:%7.2lf %sB o
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_bits_95:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
IPv4 in-block
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_bits_block:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_bits_block:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_bits_block:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-bytes_in_t_block:AVERAGE:%7.2lf %sB i
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
IPv4 out-block
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_bits_block:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_bits_block:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_bits_block:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-bytes_out_t_block:AVERAGE:%7.2lf %sB o
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
IPv6 in-pass
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_bits_pass:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_bits_pass:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_bits_pass:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-bytes_in6_t_pass:AVERAGE:%7.2lf %sB i
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
IPv6 out-pass
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_bits_pass:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_bits_pass:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_bits_pass:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-bytes_out6_t_pass:AVERAGE:%7.2lf %sB o
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
IPv6 in-block
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_bits_block:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_bits_block:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_bits_block:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-bytes_in6_t_block:AVERAGE:%7.2lf %sB i
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
IPv6 out-block
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_bits_block:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_bits_block:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_bits_block:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-bytes_out6_t_block:AVERAGE:%7.2lf %sB o
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
(
strstr
(
$curdatabase
,
"-throughput.rrd"
))
{
/* define graphcmd for throughput stats */
/* this gathers all interface statistics, the database does not actually exist */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
bits/sec
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$iflist
=
get_configured_interface_list
();
$g
=
0
;
$operand
=
""
;
$comma
=
""
;
$graphtputbip
=
""
;
$graphtputbop
=
""
;
$graphtputbtp
=
""
;
$graphtputbib
=
""
;
$graphtputbob
=
""
;
$graphtputbtb
=
""
;
$graphtputbyip
=
""
;
$graphtputbyop
=
""
;
$graphtputbytp
=
""
;
$graphtputbyib
=
""
;
$graphtputbyob
=
""
;
$graphtputbytb
=
""
;
foreach
(
$iflist
as
$ifname
)
{
/* collect all interface stats */
$graphcmd
.=
"DEF:
\"
{
$ifname
}
-in_bytes_pass=
{
$rrddbpath
}{
$ifname
}
-traffic.rrd:inpass:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
{
$ifname
}
-out_bytes_pass=
{
$rrddbpath
}{
$ifname
}
-traffic.rrd:outpass:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
{
$ifname
}
-in_bytes_block=
{
$rrddbpath
}{
$ifname
}
-traffic.rrd:inblock:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
{
$ifname
}
-out_bytes_block=
{
$rrddbpath
}{
$ifname
}
-traffic.rrd:outblock:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-in_bytes=
{
$ifname
}
-in_bytes_pass,
{
$ifname
}
-in_bytes_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-out_bytes=
{
$ifname
}
-out_bytes_pass,
{
$ifname
}
-out_bytes_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-in_bits_pass=
{
$ifname
}
-in_bytes_pass,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-out_bits_pass=
{
$ifname
}
-out_bytes_pass,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bits_io_pass=
{
$ifname
}
-in_bits_pass,
{
$ifname
}
-out_bits_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-in_bits_block=
{
$ifname
}
-in_bytes_block,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-out_bits_block=
{
$ifname
}
-out_bytes_block,8,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bits_io_block=
{
$ifname
}
-in_bits_block,
{
$ifname
}
-out_bits_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_in_pass=
{
$ifname
}
-in_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
{
$ifname
}
-in_bytes_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_out_pass=
{
$ifname
}
-out_bytes_pass,0,
$speedlimit
,LIMIT,UN,0,
{
$ifname
}
-out_bytes_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_in_block=
{
$ifname
}
-in_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
{
$ifname
}
-in_bytes_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_out_block=
{
$ifname
}
-out_bytes_block,0,
$speedlimit
,LIMIT,UN,0,
{
$ifname
}
-out_bytes_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_pass=
{
$ifname
}
-bytes_in_pass,
{
$ifname
}
-bytes_out_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_block=
{
$ifname
}
-bytes_in_pass,
{
$ifname
}
-bytes_out_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_in_t_pass=
{
$ifname
}
-in_bytes,0,
$speedlimit
,LIMIT,UN,0,
{
$ifname
}
-in_bytes_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_in_t_block=
{
$ifname
}
-in_bytes,0,
$speedlimit
,LIMIT,UN,0,
{
$ifname
}
-in_bytes_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_out_t_pass=
{
$ifname
}
-out_bytes,0,
$speedlimit
,LIMIT,UN,0,
{
$ifname
}
-out_bytes_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_out_t_block=
{
$ifname
}
-out_bytes,0,
$speedlimit
,LIMIT,UN,0,
{
$ifname
}
-out_bytes_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_t_pass=
{
$ifname
}
-bytes_in_t_pass,
{
$ifname
}
-bytes_out_t_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
{
$ifname
}
-bytes_t_block=
{
$ifname
}
-bytes_in_t_block,
{
$ifname
}
-bytes_out_t_block,+
\"
"
;
if
(
$g
>
0
)
{
$operand
.=
",+"
;
$comma
=
","
;
}
$graphtputbip
.=
"
{
$comma
}{
$ifname
}
-in_bits_pass"
;
$graphtputbop
.=
"
{
$comma
}{
$ifname
}
-out_bits_pass"
;
$graphtputbtp
.=
"
{
$comma
}{
$ifname
}
-bits_io_pass"
;
$graphtputbib
.=
"
{
$comma
}{
$ifname
}
-in_bits_block"
;
$graphtputbob
.=
"
{
$comma
}{
$ifname
}
-out_bits_block"
;
$graphtputbtb
.=
"
{
$comma
}{
$ifname
}
-bits_io_block"
;
$graphtputbyip
.=
"
{
$comma
}{
$ifname
}
-bytes_in_t_pass"
;
$graphtputbyop
.=
"
{
$comma
}{
$ifname
}
-bytes_out_t_pass"
;
$graphtputbyib
.=
"
{
$comma
}{
$ifname
}
-bytes_in_t_block"
;
$graphtputbyob
.=
"
{
$comma
}{
$ifname
}
-bytes_out_t_block"
;
$graphtputbytp
.=
"
{
$comma
}{
$ifname
}
-bytes_t_pass"
;
$graphtputbytb
.=
"
{
$comma
}{
$ifname
}
-bytes_t_block"
;
$g
++
;
}
$graphcmd
.=
"CDEF:
\"
tput-in_bits_pass=
{
$graphtputbip
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-out_bits_pass=
{
$graphtputbop
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-bits_io_pass=
{
$graphtputbtp
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-in_bits_block=
{
$graphtputbib
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-out_bits_block=
{
$graphtputbob
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-bits_io_block=
{
$graphtputbtb
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-out_bits_pass_neg=tput-out_bits_pass,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-out_bits_block_neg=tput-out_bits_block,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-bytes_in_t_pass=
{
$graphtputbyip
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-bytes_out_t_pass=
{
$graphtputbyop
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-bytes_t_pass=
{
$graphtputbytp
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-bytes_in_t_block=
{
$graphtputbyib
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-bytes_out_t_block=
{
$graphtputbyob
}{
$operand
}
\"
"
;
$graphcmd
.=
"CDEF:
\"
tput-bytes_t_block=
{
$graphtputbytb
}{
$operand
}
\"
"
;
$graphcmd
.=
"AREA:
\"
tput-in_bits_block#
{
$colortrafficdown
[
0
]
}
:in-block
\"
"
;
$graphcmd
.=
"AREA:
\"
tput-in_bits_pass#
{
$colortrafficdown
[
1
]
}
:in-pass
\"
"
;
$graphcmd
.=
"
{
$AREA
}
:
\"
tput-out_bits_block_neg#
{
$colortrafficup
[
1
]
}
:out-block
\"
"
;
$graphcmd
.=
"
{
$AREA
}
:
\"
tput-out_bits_pass_neg#
{
$colortrafficup
[
0
]
}
:out-pass
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
maximum average current period
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
in-pass
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-in_bits_pass:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-in_bits_pass:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-in_bits_pass:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-bytes_in_t_pass:AVERAGE:%7.2lf %sB i
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
out-pass
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-out_bits_pass:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-out_bits_pass:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-out_bits_pass:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-bytes_out_t_pass:AVERAGE:%7.2lf %sB o
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
in-block
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-in_bits_block:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-in_bits_block:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-in_bits_block:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-bytes_in_t_block:AVERAGE:%7.2lf %sB i
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
out-block
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-out_bits_block:MAX:%7.2lf %sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-out_bits_block:AVERAGE:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-out_bits_block:LAST:%7.2lf %Sb/s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
tput-bytes_out_t_block:AVERAGE:%7.2lf %sB o
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-packets.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for packets stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
packets/sec
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
$curif
-in_pps_pass=
$rrddbpath$curdatabase
:inpass:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-out_pps_pass=
$rrddbpath$curdatabase
:outpass:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-in_pps_block=
$rrddbpath$curdatabase
:inblock:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-out_pps_block=
$rrddbpath$curdatabase
:outblock:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-in6_pps_pass=
$rrddbpath$curdatabase
:inpass6:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-out6_pps_pass=
$rrddbpath$curdatabase
:outpass6:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-in6_pps_block=
$rrddbpath$curdatabase
:inblock6:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-out6_pps_block=
$rrddbpath$curdatabase
:outblock6:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in_pps=
$curif
-in_pps_pass,
$curif
-in_pps_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_pps=
$curif
-out_pps_pass,
$curif
-out_pps_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_pps_pass_neg=
$curif
-out_pps_pass,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out_pps_block_neg=
$curif
-out_pps_block,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-in6_pps=
$curif
-in6_pps_pass,
$curif
-in6_pps_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_pps=
$curif
-out6_pps_pass,
$curif
-out6_pps_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_pps_pass_neg=
$curif
-out6_pps_pass,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-out6_pps_block_neg=
$curif
-out6_pps_block,
$multiplier
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_in_pass=
$curif
-in_pps_pass,0,12500000,LIMIT,UN,0,
$curif
-in_pps_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_out_pass=
$curif
-out_pps_pass,0,12500000,LIMIT,UN,0,
$curif
-out_pps_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_in_block=
$curif
-in_pps_block,0,12500000,LIMIT,UN,0,
$curif
-in_pps_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_out_block=
$curif
-out_pps_block,0,12500000,LIMIT,UN,0,
$curif
-out_pps_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_in6_pass=
$curif
-in6_pps_pass,0,12500000,LIMIT,UN,0,
$curif
-in6_pps_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_out6_pass=
$curif
-out6_pps_pass,0,12500000,LIMIT,UN,0,
$curif
-out6_pps_pass,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_in6_block=
$curif
-in6_pps_block,0,12500000,LIMIT,UN,0,
$curif
-in6_pps_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_out6_block=
$curif
-out6_pps_block,0,12500000,LIMIT,UN,0,
$curif
-out6_pps_block,IF,
$average
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_io=
$curif
-in_pps,
$curif
-out_pps,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_pass=
$curif
-pps_in_pass,
$curif
-pps_out_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_block=
$curif
-pps_in_block,
$curif
-pps_out_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_io6=
$curif
-in6_pps,
$curif
-out6_pps,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_pass6=
$curif
-pps_in6_pass,
$curif
-pps_out6_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_block6=
$curif
-pps_in6_block,
$curif
-pps_out6_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_in_t_pass=
$curif
-in_pps_pass,0,12500000,LIMIT,UN,0,
$curif
-in_pps_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_out_t_pass=
$curif
-out_pps_pass,0,12500000,LIMIT,UN,0,
$curif
-out_pps_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_in_t_block=
$curif
-in_pps_block,0,12500000,LIMIT,UN,0,
$curif
-in_pps_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_out_t_block=
$curif
-out_pps_block,0,12500000,LIMIT,UN,0,
$curif
-out_pps_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_in6_t_pass=
$curif
-in6_pps_pass,0,12500000,LIMIT,UN,0,
$curif
-in6_pps_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_out6_t_pass=
$curif
-out6_pps_pass,0,12500000,LIMIT,UN,0,
$curif
-out6_pps_pass,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_in6_t_block=
$curif
-in6_pps_block,0,12500000,LIMIT,UN,0,
$curif
-in6_pps_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_out6_t_block=
$curif
-out6_pps_block,0,12500000,LIMIT,UN,0,
$curif
-out6_pps_block,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_t_pass=
$curif
-pps_in_t_pass,
$curif
-pps_out_t_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_t_block=
$curif
-pps_in_t_block,
$curif
-pps_out_t_block,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_t_pass6=
$curif
-pps_in6_t_pass,
$curif
-pps_out6_t_pass,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pps_t_block6=
$curif
-pps_in6_t_block,
$curif
-pps_out6_t_block,+
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-in_pps_block#
{
$colorpacketsdown
[
1
]
}
:
$curif
-in-block
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-in_pps_pass#
{
$colorpacketsdown
[
0
]
}
:
$curif
-in-pass:STACK
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-in6_pps_block#
{
$colorpacketsdown
[
3
]
}
:
$curif
-in6-block:STACK
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-in6_pps_pass#
{
$colorpacketsdown
[
2
]
}
:
$curif
-in6-pass:STACK
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"
$AREA
:
\"
$curif
-out_pps_block_neg#
{
$colorpacketsup
[
1
]
}
:
$curif
-out-block
\"
"
;
$graphcmd
.=
"
$AREA
:
\"
$curif
-out_pps_pass_neg#
{
$colorpacketsup
[
0
]
}
:
$curif
-out-pass:STACK
\"
"
;
$graphcmd
.=
"
$AREA
:
\"
$curif
-out6_pps_block_neg#
{
$colorpacketsup
[
3
]
}
:
$curif
-out6-block:STACK
\"
"
;
$graphcmd
.=
"
$AREA
:
\"
$curif
-out6_pps_pass_neg#
{
$colorpacketsup
[
2
]
}
:
$curif
-out6-pass:STACK
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
maximum
\t\t
average
\t
current
\t
period
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
in-pass
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_pps_pass:MAX:%7.2lf %s pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_pps_pass:AVERAGE:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_pps_pass:LAST:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pps_in_t_pass:AVERAGE:%7.2lf %s pkts
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
out-pass
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_pps_pass:MAX:%7.2lf %s pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_pps_pass:AVERAGE:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_pps_pass:LAST:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pps_out_t_pass:AVERAGE:%7.2lf %s pkts
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
in-block
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_pps_block:MAX:%7.2lf %s pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_pps_block:AVERAGE:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in_pps_block:LAST:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pps_in_t_block:AVERAGE:%7.2lf %s pkts
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
out-block
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_pps_block:MAX:%7.2lf %s pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_pps_block:AVERAGE:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out_pps_block:LAST:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pps_out_t_block:AVERAGE:%7.2lf %s pkts
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
in-pass6
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_pps_pass:MAX:%7.2lf %s pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_pps_pass:AVERAGE:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_pps_pass:LAST:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pps_in6_t_pass:AVERAGE:%7.2lf %s pkts
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
out-pass6
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_pps_pass:MAX:%7.2lf %s pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_pps_pass:AVERAGE:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_pps_pass:LAST:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pps_out6_t_pass:AVERAGE:%7.2lf %s pkts
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
in-block6
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_pps_block:MAX:%7.2lf %s pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_pps_block:AVERAGE:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-in6_pps_block:LAST:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pps_in6_t_block:AVERAGE:%7.2lf %s pkts
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
out-pass6
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_pps_block:MAX:%7.2lf %s pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_pps_block:AVERAGE:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-out6_pps_block:LAST:%7.2lf %S pps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pps_out6_t_block:AVERAGE:%7.2lf %s pkts
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-wireless.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for packets stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
snr/channel/rate
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
$curif
-snr=
$rrddbpath$curdatabase
:snr:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-rate=
$rrddbpath$curdatabase
:rate:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-channel=
$rrddbpath$curdatabase
:channel:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"LINE2:
\"
$curif
-snr#
{
$colorwireless
[
0
]
}
:
$curif
-snr
\"
"
;
$graphcmd
.=
"LINE2:
\"
$curif
-rate#
{
$colorwireless
[
1
]
}
:
$curif
-rate
\"
"
;
$graphcmd
.=
"LINE2:
\"
$curif
-channel#
{
$colorwireless
[
2
]
}
:
$curif
-channel
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
maximum
\t\t
average
\t
current
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
SNR
\t\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-snr:MAX:%7.2lf dBi
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-snr:AVERAGE:%7.2lf dBi
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-snr:LAST:%7.2lf dBi
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
RATE
\t\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-rate:MAX:%7.2lf Mb
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-rate:AVERAGE:%7.2lf Mb
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-rate:LAST:%7.2lf Mb
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Channel
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-channel:MAX:%7.2lf
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-channel:AVERAGE:%7.2lf
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-channel:LAST:%7.2lf
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-vpnusers.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for vpn users stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
users
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
$curif
-users=
$rrddbpath$curdatabase
:users:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"LINE2:
\"
$curif
-users#
{
$colorvpnusers
[
0
]
}
:
$curif
-users
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t
maximum
\t\t
average
\t
current
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Users Online
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-users:MAX:%7.2lf
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-users:AVERAGE:%7.2lf
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-users:LAST:%7.2lf
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-states.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for states stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start -
$seconds
-e -
$average
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
states, ip
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
$curif
-pfrate=
$rrddbpath$curdatabase
:pfrate:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-pfstates=
$rrddbpath$curdatabase
:pfstates:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-pfnat=
$rrddbpath$curdatabase
:pfnat:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-srcip=
$rrddbpath$curdatabase
:srcip:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
$curif
-dstip=
$rrddbpath$curdatabase
:dstip:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-pfrate_t=
$curif
-pfrate,0,1000000,LIMIT,UN,0,
$curif
-pfrate,IF,
$seconds
,*
\"
"
;
$graphcmd
.=
"LINE1:
\"
$curif
-pfrate#
{
$colorstates
[
0
]
}
:
$curif
-pfrate
\"
"
;
$graphcmd
.=
"LINE1:
\"
$curif
-pfstates#
{
$colorstates
[
1
]
}
:
$curif
-pfstates
\"
"
;
$graphcmd
.=
"LINE1:
\"
$curif
-pfnat#
{
$colorstates
[
2
]
}
:
$curif
-pfnat
\"
"
;
$graphcmd
.=
"LINE1:
\"
$curif
-srcip#
{
$colorstates
[
3
]
}
:
$curif
-srcip
\"
"
;
$graphcmd
.=
"LINE1:
\"
$curif
-dstip#
{
$colorstates
[
4
]
}
:
$curif
-dstip
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
minimum average maximum current period
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
state changes
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfrate:MIN:%7.2lf %s cps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfrate:AVERAGE:%7.2lf %s cps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfrate:MAX:%7.2lf %s cps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfrate:LAST:%7.2lf %S cps
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfrate_t:AVERAGE:%7.2lf %s chg
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
filter states
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfstates:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfstates:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfstates:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfstates:LAST:%7.2lf %s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
nat states
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfnat:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfnat:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfnat:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-pfnat:LAST:%7.2lf %s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Source addr.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-srcip:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-srcip:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-srcip:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-srcip:LAST:%7.2lf %s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Dest. addr.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-dstip:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-dstip:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-dstip:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-dstip:LAST:%7.2lf %s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-processor.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for processor stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
utilization, number
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
user=
$rrddbpath$curdatabase
:user:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
nice=
$rrddbpath$curdatabase
:nice:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
system=
$rrddbpath$curdatabase
:system:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
interrupt=
$rrddbpath$curdatabase
:interrupt:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
processes=
$rrddbpath$curdatabase
:processes:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"AREA:
\"
user#
{
$colorprocessor
[
0
]
}
:user
\"
"
;
$graphcmd
.=
"AREA:
\"
nice#
{
$colorprocessor
[
1
]
}
:nice:STACK
\"
"
;
$graphcmd
.=
"AREA:
\"
system#
{
$colorprocessor
[
2
]
}
:system:STACK
\"
"
;
$graphcmd
.=
"AREA:
\"
interrupt#
{
$colorprocessor
[
3
]
}
:interrupt:STACK
\"
"
;
$graphcmd
.=
"LINE2:
\"
processes#
{
$colorprocessor
[
4
]
}
:processes
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
minimum average maximum current
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
User util.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
user:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
user:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
user:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
user:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Nice util.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
nice:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
nice:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
nice:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
nice:LAST:%7.2lf %s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
System util.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
system:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
system:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
system:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
system:LAST:%7.2lf %s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Interrupt
\"
"
;
$graphcmd
.=
"GPRINT:
\"
interrupt:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
interrupt:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
interrupt:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
interrupt:LAST:%7.2lf %s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Processes
\"
"
;
$graphcmd
.=
"GPRINT:
\"
processes:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
processes:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
processes:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
processes:LAST:%7.2lf %s
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-memory.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for memory usage stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
utilization, percent
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
active=
$rrddbpath$curdatabase
:active:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
inactive=
$rrddbpath$curdatabase
:inactive:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
free=
$rrddbpath$curdatabase
:free:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
cache=
$rrddbpath$curdatabase
:cache:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
wire=
$rrddbpath$curdatabase
:wire:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"LINE2:
\"
active#
{
$colormemory
[
0
]
}
:active
\"
"
;
$graphcmd
.=
"LINE2:
\"
inactive#
{
$colormemory
[
1
]
}
:inactive
\"
"
;
$graphcmd
.=
"LINE2:
\"
free#
{
$colormemory
[
2
]
}
:free
\"
"
;
$graphcmd
.=
"LINE2:
\"
cache#
{
$colormemory
[
3
]
}
:cache
\"
"
;
$graphcmd
.=
"LINE2:
\"
wire#
{
$colormemory
[
4
]
}
:wire
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
minimum average maximum current
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Active.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
active:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
active:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
active:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
active:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Inactive.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
inactive:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
inactive:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
inactive:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
inactive:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Free.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
free:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
free:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
free:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
free:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Cached.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cache:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cache:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cache:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cache:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Wired.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
wire:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
wire:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
wire:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
wire:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-mbuf.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for mbuf usage stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
utilization, percent
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
clusters -
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
current=
$rrddbpath$curdatabase
:current:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
cache=
$rrddbpath$curdatabase
:cache:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
total=
$rrddbpath$curdatabase
:total:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
max=
$rrddbpath$curdatabase
:max:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"LINE2:
\"
current#
{
$colormbuf
[
0
]
}
:current
\"
"
;
$graphcmd
.=
"LINE2:
\"
cache#
{
$colormbuf
[
1
]
}
:cache
\"
"
;
$graphcmd
.=
"LINE2:
\"
total#
{
$colormbuf
[
2
]
}
:total
\"
"
;
$graphcmd
.=
"LINE2:
\"
max#
{
$colormbuf
[
3
]
}
:max
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
minimum average maximum current
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Current.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
current:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
current:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
current:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
current:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Cache.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cache:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cache:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cache:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cache:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Total.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
total:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
total:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
total:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
total:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Max.
\"
"
;
$graphcmd
.=
"GPRINT:
\"
max:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
max:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
max:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
max:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-quality.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* make a link quality graphcmd, we only have WAN for now, others too follow */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png
\\
--start
$start
--end
$end
--step
$step
\\
--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
\\
--color SHADEA#eeeeee --color SHADEB#eeeeee
\\
--vertical-label
\"
ms / %
\"
\\
--height 200 --width 620
\\
--lower-limit 0
\\
DEF:delayraw=
$rrddbpath$curdatabase
:delay:AVERAGE:step=
$step
\\
DEF:loss=
$rrddbpath$curdatabase
:loss:AVERAGE:step=
$step
\\
\"
CDEF:delay=delayraw,1000,*
\"
\\
\"
CDEF:roundavg=delay,PREV(delay),+,2,/
\"
\\
\"
CDEF:loss10=loss,
$multiplier
,*
\"
\\
\"
CDEF:r0=delay,20,MIN
\"
\\
\"
CDEF:r1=delay,60,MIN
\"
\\
\"
CDEF:r2=delay,180,MIN
\"
\\
\"
CDEF:r3=delay,420,MIN
\"
\\
COMMENT:
\"\t\t\t\t\t
Delay
\t\t\t
Packet loss
\\
n
\"
\\
AREA:delay#
$colorqualityrtt[0]
:
\"
> 420 ms
\"
\\
GPRINT:delay:MIN:
\"\t\t
Min
\\
: %7.2lf ms
\"
\\
GPRINT:loss:MIN:
\"\t
Min
\\
: %3.1lf %%
\\
n
\"
\\
AREA:r3#
$colorqualityrtt[1]
:
\"
180-420 ms
\"
\\
GPRINT:delay:AVERAGE:
\"\t\t
Avg
\\
: %7.2lf ms
\"
\\
GPRINT:loss:AVERAGE:
\"\t
Avg
\\
: %3.1lf %%
\\
n
\"
\\
AREA:r2#
$colorqualityrtt[2]
:
\"
60-180 ms
\"
\\
GPRINT:delay:MAX:
\"\t\t
Max
\\
: %7.2lf ms
\"
\\
GPRINT:loss:MAX:
\"\t
Max
\\
: %3.1lf %%
\\
n
\"
\\
AREA:r1#
$colorqualityrtt[3]
:
\"
20-60 ms
\\
n
\"
\\
AREA:r0#
$colorqualityrtt[4]
:
\"
< 20 ms
\"
\\
GPRINT:delay:LAST:
\"\t\t
Last
\\
: %7.2lf ms
\"
\\
GPRINT:loss:LAST:
\"\t
Last\: %3.1lf %%
\\
n
\"
\\
AREA:loss10#
$colorqualityloss
:
\"
Packet loss
\\
n
\"
\\
LINE1:delay#
$colorqualityrtt[5]
:
\"
Delay average
\\
n
\"
\\
COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-cellular.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
signal
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
$curif
-rssi=
$rrddbpath$curdatabase
:rssi:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"LINE2:
\"
$curif
-rssi#
{
$colorwireless
[
0
]
}
:
$curif
-rssi
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
maximum
\t\t
average
\t
current
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
RSSI
\t\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-rssi:MAX:%7.2lf
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-rssi:AVERAGE:%7.2lf
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-rssi:LAST:%7.2lf
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-loggedin.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for online Captive Portal users stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
Captive Portal Users
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--base=1000 "
;
$graphcmd
.=
"--lower-limit=0 "
;
$graphcmd
.=
"--slope-mode "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
$curif
-loggedinusers=
$rrddbpath$curdatabase
:loggedinusers:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-totalusers_t=PREV,UN,0,PREV,IF,
$curif
-loggedinusers,+
\"
"
;
$graphcmd
.=
"CDEF:
\"
$curif
-totalusers_d=
$curif
-totalusers_t,FLOOR
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-totalusers_d#
{
$colorcaptiveportalusers
[
0
]
}
:Total logged in users
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-totalusers_d:MAX:%8.0lf
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"-concurrent.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for online Captive Portal users stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
Captive Portal Users
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--base=1000 "
;
$graphcmd
.=
"--lower-limit=0 "
;
$graphcmd
.=
"--slope-mode "
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
$curif
-concurrentusers=
$rrddbpath$curdatabase
:concurrentusers:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"AREA:
\"
$curif
-concurrentusers#
{
$colorcaptiveportalusers
[
0
]
}
:Concurrent Users
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t
current
\t\t
average
\t
maximum
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Users Online
\t\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-concurrentusers:LAST:%8.0lf
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-concurrentusers:AVERAGE:%8.0lf
\"
"
;
$graphcmd
.=
"GPRINT:
\"
$curif
-concurrentusers:MAX:%8.0lf
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
elseif
((
strstr
(
$curdatabase
,
"ntpd.rrd"
))
&&
(
file_exists
(
"
$rrddbpath$curdatabase
"
)))
{
/* define graphcmd for ntpd (was: mbuf) usage stats */
$graphcmd
=
"
$rrdtool
graph
$rrdtmppath$curdatabase
-
$curgraph
.png "
;
$graphcmd
.=
"--start
$start
--end
$end
--step
$step
"
;
$graphcmd
.=
"--vertical-label
\"
time
\"
"
;
$graphcmd
.=
"--color SHADEA#eeeeee --color SHADEB#eeeeee "
;
$graphcmd
.=
"--title
\"
"
.
php_uname
(
'n'
)
.
" -
{
$prettydb
}
-
{
$hperiod
}
-
{
$havg
}
average
\"
"
;
$graphcmd
.=
"--height 200 --width 620 "
;
$graphcmd
.=
"DEF:
\"
offset=
$rrddbpath$curdatabase
:offset:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
sjit=
$rrddbpath$curdatabase
:sjit:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
cjit=
$rrddbpath$curdatabase
:cjit:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"DEF:
\"
wander=
$rrddbpath$curdatabase
:wander:AVERAGE:step=
$step
\"
"
;
$graphcmd
.=
"LINE2:
\"
offset#
{
$colorntpd
[
0
]
}
:offset
\"
"
;
$graphcmd
.=
"LINE2:
\"
sjit#
{
$colorntpd
[
1
]
}
:sjit
\"
"
;
$graphcmd
.=
"LINE2:
\"
cjit#
{
$colorntpd
[
2
]
}
:cjit
\"
"
;
$graphcmd
.=
"LINE2:
\"
wander#
{
$colorntpd
[
3
]
}
:wander
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t
minimum average maximum current
\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Offset
\"
"
;
$graphcmd
.=
"GPRINT:
\"
offset:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
offset:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
offset:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
offset:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
System jitter
\"
"
;
$graphcmd
.=
"GPRINT:
\"
sjit:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
sjit:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
sjit:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
sjit:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Clock jitter
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cjit:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cjit:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cjit:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
cjit:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"
Clk freq wander
\"
"
;
$graphcmd
.=
"GPRINT:
\"
wander:MIN:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
wander:AVERAGE:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
wander:MAX:%7.2lf %s
\"
"
;
$graphcmd
.=
"GPRINT:
\"
wander:LAST:%7.2lf %S
\"
"
;
$graphcmd
.=
"COMMENT:
\"\\
n
\"
"
;
$graphcmd
.=
"COMMENT:
\"\t\t\t\t\t\t\t\t\t\t\t\t\t
"
.
strftime
(
'%b %d %H\:%M\:%S %Y'
)
.
"
\"
"
;
}
else
{
$data
=
false
;
log_error
(
sprintf
(
gettext
(
"Sorry we do not have data to graph for %s"
),
$curdatabase
));
}
/* check modification time to see if we need to generate image */
if
(
file_exists
(
"
$rrdtmppath$curdatabase
-
$curgraph
.png"
))
{
if
((
time
()
-
filemtime
(
"
$rrdtmppath$curdatabase
-
$curgraph
.png"
))
>=
15
)
{
if
(
$data
)
{
$_gb
=
exec
(
"
$graphcmd
2>&1"
,
$graphcmdoutput
,
$graphcmdreturn
);
$graphcmdoutput
=
implode
(
" "
,
$graphcmdoutput
)
.
$graphcmd
;
flush
();
usleep
(
500
);
}
}
}
else
{
if
(
$data
)
{
$_gb
=
exec
(
"
$graphcmd
2>&1"
,
$graphcmdoutput
,
$graphcmdreturn
);
$graphcmdoutput
=
implode
(
" "
,
$graphcmdoutput
)
.
$graphcmd
;
flush
();
usleep
(
500
);
}
}
if
((
$graphcmdreturn
<>
0
)
||
(
!
$data
))
{
log_error
(
sprintf
(
gettext
(
'Failed to create graph with error code %1$s, the error is: %2$s'
),
$graphcmdreturn
,
$graphcmdoutput
));
header
(
"Content-type: image/png"
);
header
(
"Expires: Mon, 26 Jul 1997 05:00:00 GMT"
);
header
(
"Last-Modified: "
.
gmdate
(
"D, d M Y H:i:s"
)
.
" GMT"
);
header
(
"Cache-Control: no-store, no-cache, must-revalidate"
);
header
(
"Cache-Control: post-check=0, pre-check=0"
,
false
);
header
(
"Pragma: no-cache"
);
$file
=
"/usr/local/www/themes/
{
$g
[
'theme'
]
}
/images/misc/rrd_error.png"
;
readfile
(
$file
);
}
else
{
$file
=
"
$rrdtmppath$curdatabase
-
$curgraph
.png"
;
if
(
file_exists
(
"
$file
"
))
{
header
(
"Content-type: image/png"
);
header
(
"Expires: Mon, 26 Jul 1997 05:00:00 GMT"
);
header
(
"Last-Modified: "
.
gmdate
(
"D, d M Y H:i:s"
)
.
" GMT"
);
header
(
"Cache-Control: no-store, no-cache, must-revalidate"
);
header
(
"Cache-Control: post-check=0, pre-check=0"
,
false
);
header
(
"Pragma: no-cache"
);
readfile
(
$file
);
}
}
src/www/status_rrd_graph_settings.php
View file @
df81ae81
<?php
<?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2007 Seth Mos <seth.mos@dds.nl>
Copyright (C) 2007 Seth Mos <seth.mos@dds.nl>
...
@@ -98,7 +99,7 @@ foreach($databases as $database) {
...
@@ -98,7 +99,7 @@ foreach($databases as $database) {
}
}
}
}
$pgtitle
=
array
(
gettext
(
"Status"
),
gettext
(
"RRD Graphs"
));
$pgtitle
=
array
(
gettext
(
'System'
),
gettext
(
'Settings'
),
gettext
(
'RRD Graphs'
));
include
(
"head.inc"
);
include
(
"head.inc"
);
?>
?>
...
@@ -116,8 +117,6 @@ include("head.inc");
...
@@ -116,8 +117,6 @@ include("head.inc");
<section
class=
"col-xs-12"
>
<section
class=
"col-xs-12"
>
<?
include
(
"status_rrd_graph_tabs.inc"
);
?>
<div
class=
"tab-content content-box col-xs-12"
>
<div
class=
"tab-content content-box col-xs-12"
>
...
...
src/www/status_rrd_graph_tabs.inc
deleted
100644 → 0
View file @
af8f5ab0
<?php
$tab_array
=
array
();
if
(
$curcat
==
"system"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
gettext
(
"System"
),
$tabactive
,
"status_rrd_graph.php?cat=system"
);
if
(
$curcat
==
"traffic"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
gettext
(
"Traffic"
),
$tabactive
,
"status_rrd_graph.php?cat=traffic"
);
if
(
$curcat
==
"packets"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
gettext
(
"Packets"
),
$tabactive
,
"status_rrd_graph.php?cat=packets"
);
if
(
$curcat
==
"quality"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
gettext
(
"Quality"
),
$tabactive
,
"status_rrd_graph.php?cat=quality"
);
if
(
$wireless
)
{
if
(
$curcat
==
"wireless"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
gettext
(
"Wireless"
),
$tabactive
,
"status_rrd_graph.php?cat=wireless"
);
}
if
(
$cellular
)
{
if
(
$curcat
==
"cellular"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
gettext
(
"Cellular"
),
$tabactive
,
"status_rrd_graph.php?cat=cellular"
);
}
if
(
$vpnusers
)
{
if
(
$curcat
==
"vpnusers"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
"VPN"
,
$tabactive
,
"status_rrd_graph.php?cat=vpnusers"
);
}
if
(
$captiveportal
)
{
if
(
$curcat
==
"captiveportal"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
"Captive Portal"
,
$tabactive
,
"status_rrd_graph.php?cat=captiveportal"
);
}
if
(
$ntpd
)
{
if
(
$curcat
==
"ntpd"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
"NTP"
,
$tabactive
,
"status_rrd_graph.php?cat=ntpd"
);
}
if
(
$curcat
==
"custom"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
gettext
(
"Custom"
),
$tabactive
,
"status_rrd_graph.php?cat=custom"
);
if
(
$curcat
==
"settings"
)
{
$tabactive
=
True
;
}
else
{
$tabactive
=
False
;
}
$tab_array
[]
=
array
(
gettext
(
"Settings"
),
$tabactive
,
"status_rrd_graph_settings.php"
);
display_top_tabs
(
$tab_array
);
?>
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