From 93164fd8d4027666d05ff33d0f05e620fd3dca33 Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 10:46:44 -0400 Subject: [PATCH 01/11] Added a bunch of changes... --- plugin/aggregation.json | 43 ++++++++++++++++ plugin/interface_lif.json | 51 +++++++++++++++++++ plugin/interface_port.json | 51 +++++++++++++++++++ plugin/iops_vol.json | 18 +++++++ plugin/latency_vol.json | 27 ++++++++++ plugin/traffic_vol.json | 18 +++++++ plugin/zfs_arc.json | 26 ++++++++++ plugin/zfs_arc.php | 99 ++++++++++++++++++++++++++++++++++++ type/GenericFilled.class.php | 78 ++++++++++++++++++++++++++++ 9 files changed, 411 insertions(+) create mode 100644 plugin/aggregation.json create mode 100644 plugin/interface_lif.json create mode 100644 plugin/interface_port.json create mode 100644 plugin/iops_vol.json create mode 100644 plugin/latency_vol.json create mode 100644 plugin/traffic_vol.json create mode 100644 plugin/zfs_arc.json create mode 100644 plugin/zfs_arc.php create mode 100644 type/GenericFilled.class.php diff --git a/plugin/aggregation.json b/plugin/aggregation.json new file mode 100644 index 0000000..f2e48dc --- /dev/null +++ b/plugin/aggregation.json @@ -0,0 +1,43 @@ +{ + "cpu": { + "title": "Total CPU usage on {{HOST}}", + "vertical": "Percent", + "rrdtool_opts": ["-u", "100"], + "type": "stacked", + "legend": { + "idle": { + "name": "Idle", + "color": "e8e8e8" + }, + "nice": { + "name": "Nice", + "color": "00e000" + }, + "user": { + "name": "User", + "color": "0000ff" + }, + "wait": { + "name": "Wait-IO", + "color": "ffb000" + }, + "system": { + "name": "System", + "color": "ff0000" + }, + "softirq": { + "name": "SoftIRQ", + "color": "ff00ff" + }, + "interrupt": { + "name": "IRQ", + "color": "a000a0" + }, + "steal": { + "name": "Steal", + "color": "000000" + } + }, + "legend_format": "%5.2lf" + } +} diff --git a/plugin/interface_lif.json b/plugin/interface_lif.json new file mode 100644 index 0000000..e17ba95 --- /dev/null +++ b/plugin/interface_lif.json @@ -0,0 +1,51 @@ +{ + "if_octets": { + "title": "Interface Traffic ({{PI}}) on {{HOST}}", + "vertical": "{{ND}} per second", + "type": "io", + "legend": { + "rx": { + "name": "Receive", + "color": "0000ff" + }, + "tx": { + "name": "Transmit", + "color": "00b000" + } + }, + "legend_format": "%5.1lf%s", + "datasize": true + }, + "if_errors": { + "title": "Interface Errors ({{PI}}) on {{HOST}}", + "vertical": "Errors per second", + "type": "io", + "legend": { + "rx": { + "name": "Receive", + "color": "0000ff" + }, + "tx": { + "name": "Transmit", + "color": "00b000" + } + }, + "legend_format": "%5.1lf%s" + }, + "if_packets": { + "title": "Interface Packets ({{PI}}) on {{HOST}}", + "vertical": "Packets per second", + "type": "io", + "legend": { + "rx": { + "name": "Receive", + "color": "0000ff" + }, + "tx": { + "name": "Transmit", + "color": "00b000" + } + }, + "legend_format": "%5.1lf%s" + } +} diff --git a/plugin/interface_port.json b/plugin/interface_port.json new file mode 100644 index 0000000..e17ba95 --- /dev/null +++ b/plugin/interface_port.json @@ -0,0 +1,51 @@ +{ + "if_octets": { + "title": "Interface Traffic ({{PI}}) on {{HOST}}", + "vertical": "{{ND}} per second", + "type": "io", + "legend": { + "rx": { + "name": "Receive", + "color": "0000ff" + }, + "tx": { + "name": "Transmit", + "color": "00b000" + } + }, + "legend_format": "%5.1lf%s", + "datasize": true + }, + "if_errors": { + "title": "Interface Errors ({{PI}}) on {{HOST}}", + "vertical": "Errors per second", + "type": "io", + "legend": { + "rx": { + "name": "Receive", + "color": "0000ff" + }, + "tx": { + "name": "Transmit", + "color": "00b000" + } + }, + "legend_format": "%5.1lf%s" + }, + "if_packets": { + "title": "Interface Packets ({{PI}}) on {{HOST}}", + "vertical": "Packets per second", + "type": "io", + "legend": { + "rx": { + "name": "Receive", + "color": "0000ff" + }, + "tx": { + "name": "Transmit", + "color": "00b000" + } + }, + "legend_format": "%5.1lf%s" + } +} diff --git a/plugin/iops_vol.json b/plugin/iops_vol.json new file mode 100644 index 0000000..10aac8a --- /dev/null +++ b/plugin/iops_vol.json @@ -0,0 +1,18 @@ +{ + "disk_ops": { + "title": "Disk Operations ({{PI}}) on {{HOST}}", + "vertical": "Ops per second", + "type": "io", + "legend": { + "read": { + "name": "Read", + "color": "0000ff" + }, + "write": { + "name": "Write", + "color": "00b000" + } + }, + "legend_format": "%5.1lf%s" + } +} diff --git a/plugin/latency_vol.json b/plugin/latency_vol.json new file mode 100644 index 0000000..694c76a --- /dev/null +++ b/plugin/latency_vol.json @@ -0,0 +1,27 @@ +{ + "netapp_vol_latency": { + "title": "Disk time per operation ({{PI}}) on {{HOST}}", + "vertical": "Avg. Time/Op", + "type": "io", + "legend": { + "read_ops": { + "name": "Read", + "color": "0000ff" + }, + "write_ops": { + "name": "Write", + "color": "00b000" + }, + "read_latency": { + "name": "Read Latency", + "color": "00b0aa" + }, + "write_latency": { + "name": "Write Latency", + "color": "00b0dd" + } + }, + "legend_format": "%5.1lf%ss", + "scale": 0.001 + } +} diff --git a/plugin/traffic_vol.json b/plugin/traffic_vol.json new file mode 100644 index 0000000..b51b304 --- /dev/null +++ b/plugin/traffic_vol.json @@ -0,0 +1,18 @@ +{ + "disk_octets": { + "title": "Disk Traffic ({{PI}}) on {{HOST}}", + "vertical": "Bytes per second", + "type": "io", + "legend": { + "read": { + "name": "Read", + "color": "0000ff" + }, + "write": { + "name": "Write", + "color": "00b000" + } + }, + "legend_format": "%5.1lf%s" + } +} diff --git a/plugin/zfs_arc.json b/plugin/zfs_arc.json new file mode 100644 index 0000000..f58e759 --- /dev/null +++ b/plugin/zfs_arc.json @@ -0,0 +1,26 @@ +{ + "cache_size": { + "title": "ARC Usage on {{HOST}}", + "vertical": "Bytes", + "type": "filled", + "legend": { + "c": { + "name": "Target" + }, + "arc": { + "name": "Cur Size" + }, + "c_min": { + "name": "Min" + }, + "c_max": { + "name": "Max" + }, + "L2": { + "name": "L2 Size" + } + }, + "legend_format": "%5.0lf%sB", + "base": "1024" + } +} diff --git a/plugin/zfs_arc.php b/plugin/zfs_arc.php new file mode 100644 index 0000000..d066b42 --- /dev/null +++ b/plugin/zfs_arc.php @@ -0,0 +1,99 @@ +rrd_format = '%5.1lf%s'; + +switch($obj->args['type']) { + case 'arc_counts': + $obj->data_sources = array( + 'demand_data', + 'demand_metadata', + 'prefetch_data', + 'prefetch_metadata', + ); + $obj->colors = array( + 'hits-demand_data' => 'ff0000', + 'misses-demand_data' => '880000', + 'hits-demand_metadata' => '00ff00', + 'misses-demand_metadata' => '00aa00', + 'hits-prefetch_data' => '0000ff', + 'misses-prefetch_data' => '00f0f0', + 'hits-prefetch_metadata' => 'ff00ff', + 'misses-prefetch_metadata' => '888800', + ); + $obj->ds_names = array( + 'hits-demand_data' => 'data hits', + 'misses-demand_data' => 'metadata misses', + 'hits-demand_metadata' => 'metadata hits', + 'misses-demand_metadata' => 'metadata misses', + 'hits-prefetch_data' => 'prefetch data hits', + 'misses-prefetch_data' => 'prefetch data misses', + 'hits-prefetch_metadata' => 'prefetch metadata hits', + 'misses-prefetch_metadata' => 'prefetch metadata misses', + ); + $obj->rrd_title = 'arc counts'; + $obj->rrd_vertical = 'count'; + break; + case 'cache_size': +# $obj->data_sources = array('current','target','minlimit','maxlimit'); +# $obj->order = array( +# 'current', +# 'target', +# 'minlimit', +# 'maxlimit', +# ); + $obj->rrd_title = 'Arc size'; + $obj->rrd_vertical = 'bytes'; + break; + case 'arc_l2_bytes': + $obj->data_sources = array( + 'write', + 'read', + ); + $obj->ds_names = array( + 'write' => 'Write', + 'read' => 'Read', + ); + $obj->colors = array( + 'write' => 'ff0000', + 'read' => '0000ff', + ); + $obj->rrd_title = 'Arc L2 bytes'; + $obj->rrd_vertical = 'bytes'; + break; + case 'arc_l2_size': + $obj->data_sources = array( + 'value', + ); + $obj->ds_names = array( + 'value' => 'Bytes', + ); + $obj->colors = array( + 'value' => '0000ff', + ); + $obj->rrd_title = 'Arc L2 size'; + $obj->rrd_vertical = 'bytes'; + break; + case 'arc_ratio': + $obj->data_sources = array('value'); + $obj->rrd_title = 'Arc ratio'; + $obj->rrd_vertical = 'ratio'; + break; +} +collectd_flush($obj->identifiers); +$obj->rrd_graph(); diff --git a/type/GenericFilled.class.php b/type/GenericFilled.class.php new file mode 100644 index 0000000..09c2951 --- /dev/null +++ b/type/GenericFilled.class.php @@ -0,0 +1,78 @@ +rrd_options(); + + $sources = $this->rrd_get_sources(); + + $raw = null; + if ($this->scale) + $raw = '_raw'; + $i=0; + foreach ($this->tinstances as $tinstance) { + foreach ($this->data_sources as $ds) { + $rrdgraph[] = sprintf('DEF:min_%s%s=%s:%s:MIN', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); + $rrdgraph[] = sprintf('DEF:avg_%s_raw=%s:%s:AVERAGE', crc32hex($sources[$i]), $this->parse_filename($this->files[$tinstance]), $ds); + $rrdgraph[] = sprintf('DEF:max_%s%s=%s:%s:MAX', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); + $i++; + } + } + if ($this->scale) { + $i=0; + foreach ($this->tinstances as $tinstance) { + foreach ($this->data_sources as $ds) { + $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); + $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); + $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); + if ($i == 1) + $rrdgraph[] = sprintf('CDEF:avg_%s_neg=avg_%1$s_raw,%s%s,*', crc32hex($sources[$i]), $this->negative_io ? '-' : '', $this->scale); + if ($this->percentile) + $rrdgraph[] = sprintf('VDEF:pct_%1$s=avg_%1$s,%2$s,PERCENT', crc32hex($sources[$i]), $this->percentile); + $i++; + } + } + } + + $rrdgraph[] = sprintf('CDEF:overlap=avg_%s,avg_%s_neg,LT,avg_%1$s,avg_%2$s_neg,IF', + crc32hex($sources[0]), crc32hex($sources[1])); + + $i = 0; + foreach($sources as $source) { + $rrdgraph[] = sprintf('AREA:avg_%s%s#%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->get_faded_color($this->colors[$source])); + $i++; + } + + $rrdgraph[] = sprintf('AREA:overlap#%s', + $this->get_faded_color( + $this->get_faded_color($this->colors[$sources[0]]), + $this->get_faded_color($this->colors[$sources[1]]) + ) + ); + + $i = 0; + foreach($sources as $source) { + $legend = empty($this->legend[$source]) ? $source : $this->legend[$source]; + $rrdgraph[] = sprintf('LINE1:avg_%s%s#%s:%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->colors[$source], $this->rrd_escape($legend)); + $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:%s Min,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:%s Avg,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:%s Max,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:avg_%s:LAST:%s Last\l', crc32hex($source), $this->rrd_format); + $i++; + } + + if ($this->percentile) { + $rrdgraph[] = 'COMMENT: \l'; + foreach($sources as $source) { + $legend = empty($this->legend[$source]) ? $source : $this->legend[$source]; + $rrdgraph[] = sprintf('HRULE:pct_%s#%s:%sth Percentile %s', crc32hex($source), $this->get_faded_color($this->colors[$source], '000000', 0.6), $this->percentile, $this->rrd_escape($legend)); + $rrdgraph[] = sprintf('GPRINT:pct_%s:%s\l', crc32hex($source), $this->rrd_format); + } + } + + return $rrdgraph; + } +} From ba7d386cdb81f0eed206f0c104dfbe3d01fe51d7 Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 10:47:45 -0400 Subject: [PATCH 02/11] more changes --- conf/.gitignore | 2 ++ graph.php | 12 ++++++++---- plugin/cpu.json | 2 +- plugin/memory.json | 25 ++++++++++++++++++------- plugin/netlink.json | 10 +++++----- type/Base.class.php | 9 ++++----- 6 files changed, 38 insertions(+), 22 deletions(-) diff --git a/conf/.gitignore b/conf/.gitignore index 529bf01..a3956cc 100644 --- a/conf/.gitignore +++ b/conf/.gitignore @@ -1 +1,3 @@ config.local.php +config.hosts.php +make_config_local.sh diff --git a/graph.php b/graph.php index 8eec2ec..2143faf 100644 --- a/graph.php +++ b/graph.php @@ -29,10 +29,10 @@ $typesdb = parse_typesdb_file($CONFIG['typesdb']); -if ($plugin == 'aggregation') { - $pi = explode("-", GET('pi')); - $plugin = $_GET['p'] = validate_get($pi[0], 'plugin'); -} +#if ($plugin == 'aggregation') { +# $pi = explode("-", GET('pi')); +# $plugin = $_GET['p'] = validate_get($pi[0], 'plugin'); +#} # plugin json if (function_exists('json_decode') && file_exists('plugin/'.$plugin.'.json')) { @@ -59,6 +59,10 @@ require_once 'type/Uptime.class.php'; $obj = new Type_Uptime($CONFIG, $_GET); break; + case 'filled': + require_once 'type/GenericFilled.class.php'; + $obj = new Type_GenericFilled($CONFIG, $_GET); + break; default: require_once 'type/Default.class.php'; $obj = new Type_Default($CONFIG, $_GET); diff --git a/plugin/cpu.json b/plugin/cpu.json index 6f74654..3c39345 100644 --- a/plugin/cpu.json +++ b/plugin/cpu.json @@ -2,7 +2,7 @@ "cpu": { "title": "CPU-{{PI}} usage on {{HOST}}", "vertical": "Jiffies", - "rrdtool_opts": ["-u", "100"], + "rrdtool_opts": ["-u","100","-r"], "type": "stacked", "legend": { "idle": { diff --git a/plugin/memory.json b/plugin/memory.json index eb8d0e4..e2714da 100644 --- a/plugin/memory.json +++ b/plugin/memory.json @@ -8,6 +8,10 @@ "name": "Free", "color": "00e000" }, + "used": { + "name": "Used", + "color": "ff0000" + }, "inactive": { "name": "Inactive", "color": "00b000" @@ -20,22 +24,29 @@ "name": "Cache", "color": "0000ff" }, + "arc": { + "name": "ARC Cache", + "color": "0000ff" + }, "buffered": { "name": "Buffered", "color": "ffb000" }, - "locked": { - "name": "Locked", - "color": "ff00ff" - }, - "used": { - "name": "Used", - "color": "ff0000" + "kernel": { + "name": "Kernel" }, "active": { "name": "Active", "color": "ff00ff" }, + "unusable": { + "name": "Unusable", + "color": "00b000" + }, + "locked": { + "name": "Locked", + "color": "ff00ff" + }, "wired": { "name": "Wired", "color": "ff0000" diff --git a/plugin/netlink.json b/plugin/netlink.json index 51c1d9d..2bf5400 100644 --- a/plugin/netlink.json +++ b/plugin/netlink.json @@ -27,7 +27,7 @@ "legend_format": "%5.1lf%s" }, "if_errors": { - "title": "Interface Errors ({{PI}}) on {{HOST}}", + "title": "Errors ({{PI}}) on {{HOST}}", "vertical": "Errors/s", "type": "io", "legend": { @@ -55,7 +55,7 @@ "legend_format": "%5.1lf%s" }, "if_octets": { - "title": "Interface Traffic ({{PI}}) on {{HOST}}", + "title": "Traffic ({{PI}}) on {{HOST}}", "vertical": "{{ND}}/second", "type": "io", "legend": { @@ -72,7 +72,7 @@ "datasize": true }, "if_packets": { - "title": "Interface Packets ({{PI}}) on {{HOST}}", + "title": "Packets ({{PI}}) on {{HOST}}", "vertical": "Packets/s", "type": "io", "legend": { @@ -88,7 +88,7 @@ "legend_format": "%5.1lf%s" }, "if_rx_errors": { - "title": "Interface receive errors ({{PI}}) on {{HOST}}", + "title": "Receive errors ({{PI}}) on {{HOST}}", "vertical": "Errors/s", "type": "stacked", "legend": { @@ -120,7 +120,7 @@ "legend_format": "%5.1lf%s" }, "if_tx_errors": { - "title": "Interface transmit errors ({{PI}}) on {{HOST}}", + "title": "Transmit errors ({{PI}}) on {{HOST}}", "vertical": "Errors/s", "type": "stacked", "legend": { diff --git a/type/Base.class.php b/type/Base.class.php index 8d51121..fe0926e 100644 --- a/type/Base.class.php +++ b/type/Base.class.php @@ -105,7 +105,7 @@ function parse_get($_get) { 'type' => isset($_get['t']) ? $_get['t'] : null, 'tinstance' => isset($_get['ti']) ? $_get['ti'] : null, ); - $this->seconds = isset($_get['s']) ? $_get['s'] : null; + $this->seconds = isset($_get['s']) ? $_get['s'] : null; } function validate_color($color) { @@ -171,7 +171,6 @@ function rrd_files() { $instance = strpos($basename,'-') ? substr($basename, strpos($basename,'-') + 1) : 'value'; - $this->tinstances[] = $instance; $this->files[$instance] = $filename; $this->identifiers[$instance] = preg_replace( @@ -192,8 +191,8 @@ function get_filenames() { strlen($this->args['pinstance']) ? '-' : '', $this->args['pinstance'], $this->args['type'], strlen($this->args['tinstance']) ? '-' : '', $this->args['tinstance'] - ); - $identifier = preg_replace("/([*?[])/", '[$1]', $identifier); + ); + $identifier = preg_replace("/([*?[])/", '[$1]', $identifier); $wildcard = strlen($this->args['tinstance']) ? '.' : '[-.]*'; @@ -328,7 +327,7 @@ function rrd_get_sources() { if(is_array($this->data_sources) && count($this->data_sources)==1 && in_array('value', $this->data_sources)) { # use tinstances as sources $sources = $this->tinstances; - } else { + } else { # use data_sources as sources $sources = $this->data_sources; } From 577ccbd3e1a90f0a52ece338bcd10e083315d8cf Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 10:56:11 -0400 Subject: [PATCH 03/11] changed .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 543f45a..40929c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -conf/config.local.php +conf/*local* plugin/local/*.json From 9eaebf4e5c7d5e4dae1d183d429b37fe19333965 Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 10:57:25 -0400 Subject: [PATCH 04/11] added memory values --- plugin/memory.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin/memory.json b/plugin/memory.json index 38d5af7..da2cb6c 100644 --- a/plugin/memory.json +++ b/plugin/memory.json @@ -11,6 +11,9 @@ "used": { "name": "Used", "color": "ff0000" + }, + kernel": { + "name": "Kernel" }, "inactive": { "name": "Inactive", From 4f28484d4d317f68f2772846e6f92077753d6028 Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 11:05:56 -0400 Subject: [PATCH 05/11] added my stuff --- graph.php | 4 ++++ plugin/memory.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/graph.php b/graph.php index cca350b..15be500 100644 --- a/graph.php +++ b/graph.php @@ -72,6 +72,10 @@ require_once 'type/GenericIO.class.php'; $obj = new Type_GenericIO($CONFIG, GET()); break; + case 'filled': + require_once 'type/GenericFilled.class.php'; + $obj = new Type_GenericFilled($CONFIG, GET()); + break; case 'uptime': require_once 'type/Uptime.class.php'; $obj = new Type_Uptime($CONFIG, GET()); diff --git a/plugin/memory.json b/plugin/memory.json index da2cb6c..93c8576 100644 --- a/plugin/memory.json +++ b/plugin/memory.json @@ -12,7 +12,7 @@ "name": "Used", "color": "ff0000" }, - kernel": { + "kernel": { "name": "Kernel" }, "inactive": { From 2146898f24ed0b2adf6590af77c3bd1b2a2a4709 Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 11:16:23 -0400 Subject: [PATCH 06/11] fixed issue with canvas --- inc/html.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/html.inc.php b/inc/html.inc.php index 7312601..aa86db2 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -122,6 +122,7 @@ function html_end($footer = false) { EOT; } if ($CONFIG['graph_type'] == 'canvas') { + $html_weburl = htmlentities($CONFIG['weburl']); if ($CONFIG['rrd_fetch_method'] == 'async') { $js_async = 'true'; } else { From f123f7df6d7e187faf4ed6d1e87e7ef51c4853eb Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 11:35:46 -0400 Subject: [PATCH 07/11] fixed duplicates --- graph.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/graph.php b/graph.php index 15be500..46bcb94 100644 --- a/graph.php +++ b/graph.php @@ -80,10 +80,6 @@ require_once 'type/Uptime.class.php'; $obj = new Type_Uptime($CONFIG, GET()); break; - case 'filled': - require_once 'type/GenericFilled.class.php'; - $obj = new Type_GenericFilled($CONFIG, $_GET); - break; default: require_once 'type/Default.class.php'; $obj = new Type_Default($CONFIG, GET()); From 29a1c6aa7defd75dc116b1037dad59bf227f8983 Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 11:36:33 -0400 Subject: [PATCH 08/11] deleted conf/.gitignore --- conf/.gitignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 conf/.gitignore diff --git a/conf/.gitignore b/conf/.gitignore deleted file mode 100644 index a3956cc..0000000 --- a/conf/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -config.local.php -config.hosts.php -make_config_local.sh From 0f182689209756a5628635684b3a70d54e3e5b23 Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 13:28:06 -0400 Subject: [PATCH 09/11] added ability to set the number of hosts to show per line on index page --- inc/html.inc.php | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/inc/html.inc.php b/inc/html.inc.php index aa86db2..f0d69ed 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -230,17 +230,30 @@ function host_summary($cat, $hosts) { $row_style = array(0 => "even", 1 => "odd"); $host_counter = 0; + $line_counter = 0; foreach($hosts as $host) { - $host_counter++; - printf('
', $row_style[$host_counter % 2]); + if($CONFIG['perline']) { + $foo = $host_counter % $CONFIG['perline']; + echo "\n"; + if($host_counter % $CONFIG['perline'] == 0) { + printf('
', $row_style[$line_counter % 2]); + } + } else { + printf('
', $row_style[$line_counter % 2]); + } + + printf('', htmlentities($CONFIG['weburl']), urlencode($host), htmlentities($host)); - echo "
"; + + if ($CONFIG['showload'] || $CONFIG['showmem'] || $CONFIG['showtime']) { + echo "
"; + } if ($CONFIG['showload']) { require_once 'type/Default.class.php'; @@ -308,7 +321,19 @@ function host_summary($cat, $hosts) { } } - print "
\n"; + if($CONFIG['perline']) { + if(($host_counter % $CONFIG['perline'] ) == $CONFIG['perline'] - 1) { + print "
\n"; + $line_counter++; + } + $host_counter++; + } else { + print "
\n"; + $line_counter++; + if ($CONFIG['showload'] || $CONFIG['showmem'] || $CONFIG['showtime']) { + echo "
\n"; + } + } } echo "\n"; From 5f4543741e654ccb0ec808ae3d3548a3130a8388 Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 13:28:48 -0400 Subject: [PATCH 10/11] Added the $CONFIG['perline'] value --- conf/config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/config.php b/conf/config.php index ec55d30..36e1205 100644 --- a/conf/config.php +++ b/conf/config.php @@ -33,6 +33,7 @@ $CONFIG['showload'] = true; $CONFIG['showmem'] = false; $CONFIG['showtime'] = false; +$CONFIG['perline'] = 1; $CONFIG['term'] = array( '2hour' => 3600 * 2, From 4b55a2adafbf7865660338a56e1636e77cb3afef Mon Sep 17 00:00:00 2001 From: Brian ONeill Date: Fri, 7 Aug 2015 14:02:06 -0400 Subject: [PATCH 11/11] more work with style sheets and mutliple rows on main page --- inc/html.inc.php | 13 +++++++++-- layout/style.css | 56 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/inc/html.inc.php b/inc/html.inc.php index f0d69ed..7d016a8 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -232,20 +232,25 @@ function host_summary($cat, $hosts) { $host_counter = 0; $line_counter = 0; + if($CONFIG['perline']) { + printf('
'); + } + foreach($hosts as $host) { if($CONFIG['perline']) { $foo = $host_counter % $CONFIG['perline']; echo "\n"; if($host_counter % $CONFIG['perline'] == 0) { - printf('
', $row_style[$line_counter % 2]); + printf('
', $row_style[$line_counter % 2]); } } else { printf('
', $row_style[$line_counter % 2]); } - printf('', + # printf('', + printf('', htmlentities($CONFIG['weburl']), urlencode($host), htmlentities($host)); @@ -335,6 +340,10 @@ function host_summary($cat, $hosts) { } } } + + if($CONFIG['perline']) { + printf('
'); + } echo "
\n"; echo "\n"; diff --git a/layout/style.css b/layout/style.css index 768c0c6..40d451a 100644 --- a/layout/style.css +++ b/layout/style.css @@ -64,8 +64,8 @@ h2 { } a:link, a:visited, a:active { - text-decoration: none; - color: #222; + text-decoration: none; + color: #222; } a:hover { @@ -78,11 +78,11 @@ a:hover { } .row.even { -/* background: #eeeeee; */ +/* background: #aaaaaa; */ } .row.odd { -/* background: #cccccc; */ +/* background: #cccccc; */ } .row label { @@ -161,7 +161,7 @@ hr { .selected:link, .selected:visited, .selected:active { font-style: italic; - color: #4D79B5; + color: #4D79B5; } .time-range li { @@ -194,7 +194,7 @@ legend { code { font-family: Consolas,"Liberation Mono",Menlo,Courier,monospace; - background-color: rgba(0,0,0,0.1); + background-color: rgba(0,0,0,0.1); padding: 0 0.2em; } @@ -202,3 +202,47 @@ code { font-size: 0.7em; opacity: 0.6; } + +.divCell { + float:left;/*fix for buggy browsers*/ + display:table-column; + width:20em; +/* background-color:#ccc; */ +} + +.divTable { + display: table; + width:auto; + background-color:#fff; +/* border:1px solid #666666; */ + border-spacing:5px;/*cellspacing:poor IE support for this*/ + /* border-collapse:separate;*/ +} + +.divRow { + display:table-row; + width:auto; +} + +.divRow:nth-of-type(odd) { + background: #ccc; +} + +.divRow label { + float: left; + width: 20em; +} + +.divRow .hostinfo { + float: left; +} + +.divRow .field { + float: left; + width: 3.4em; +} + +.divRow .field.wide { + width: 8em; +} +