Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated pi-hole graphs for better grouping #7179

Merged
merged 1 commit into from
Aug 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions html/includes/graphs/application/pi-hole_block_percent.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

require 'includes/graphs/common.inc.php';

$scale_min = 0;
$scale_max = 100;
$colours = 'mixed';
$unit_text = 'Stats';
$unitlen = 6;
$bigdescrlen = 25;
$smalldescrlen = 25;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = rrd_name($device['hostname'], array('app', $app['app_type'], $app['app_id']));

$array = array(
'ads_percentage' => array('descr' => 'ADs blocked %','colour' => '912925',),
);

$i = 0;

if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $var['colour'];
$i++;
}
} else {
echo "file missing: $rrd_filename";
}

require 'includes/graphs/generic_v3_multiline_float.inc.php';
35 changes: 35 additions & 0 deletions html/includes/graphs/application/pi-hole_blocklist.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

require 'includes/graphs/common.inc.php';

$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Stats';
$unitlen = 6;
$bigdescrlen = 25;
$smalldescrlen = 25;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = rrd_name($device['hostname'], array('app', $app['app_type'], $app['app_id']));

$array = array(
'domains_blocked' => array('descr' => 'Blocked domains','colour' => '000000',),
);

$i = 0;

if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $var['colour'];
$i++;
}
} else {
echo "file missing: $rrd_filename";
}

require 'includes/graphs/generic_v3_multiline_float.inc.php';
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
$rrd_filename = rrd_name($device['hostname'], array('app', $app['app_type'], $app['app_id']));

$array = array(
'domains_blocked' => array('descr' => 'Blocked domains','colour' => '000000',),
'dns_query' => array('descr' => 'Today DNS Queries','colour' => '657C5E',),
'ads_blocked' => array('descr' => 'ADs blocked','colour' => 'F44842',),
'ads_percentage' => array('descr' => 'ADs blocked %','colour' => '912925',),
'unique_domains' => array('descr' => 'Unique domains','colour' => 'F44842',),
'queries_forwarded' => array('descr' => 'Queries forwarded','colour' => '1F35A5',),
'queries_cached' => array('descr' => 'Queries cached','colour' => '137C21',),
);
Expand Down
36 changes: 36 additions & 0 deletions html/includes/graphs/application/pi-hole_query_results.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

require 'includes/graphs/common.inc.php';

$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Stats';
$unitlen = 6;
$bigdescrlen = 25;
$smalldescrlen = 25;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = rrd_name($device['hostname'], array('app', $app['app_type'], $app['app_id']));

$array = array(
'dns_query' => array('descr' => 'Today DNS Queries','colour' => '657C5E',),
'ads_blocked' => array('descr' => 'ADs blocked','colour' => 'F44842',),
);

$i = 0;

if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $var['colour'];
$i++;
}
} else {
echo "file missing: $rrd_filename";
}

require 'includes/graphs/generic_v3_multiline_float.inc.php';
7 changes: 5 additions & 2 deletions html/pages/apps.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,11 @@
);

$graphs['pi-hole'] = array(
'stats',
'queries',
'query_types',
'destinations',
'query_results',
'block_percent',
'blocklist',
);

print_optionbar_start();
Expand Down
7 changes: 5 additions & 2 deletions html/pages/device/apps/pi-hole.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
global $config;

$graphs = array(
'pi-hole_stats' => 'Stats',
'pi-hole_queries' => 'Queries',
'pi-hole_query_types' => 'Query Types',
'pi-hole_destinations' => 'Destinations',
'pi-hole_query_results' => 'Query Results',
'pi-hole_block_percent' => 'Block Percentage',
'pi-hole_blocklist' => 'Blocklist Domains'
);

foreach ($graphs as $key => $text) {
Expand Down