aboutsummaryrefslogtreecommitdiffstatshomepage
Commit message (Collapse)AuthorAgeFilesLines
* jsrrdgraph: Fix parsing of rrdfiles containing escapesPeter Wu2014-08-101-5/+7
| | | | | | This fixes parsing of URLs such as 'rrd.php?path=some%3Ffile.rrd', and if people really insist, paths such as 'C:\bar.rrd' (must be written as 'C\:\\bar.rrd', add additional escapes for Javascript strings if needed).
* Add README filePeter Wu2014-08-103-3/+119
| | | | | | Documents requirements, installation instructions (obsoleting doc/INSTALL) and performance hints. Added a nginx server configuration example that optimises for performance.
* Merge (a)sync code, reformat CGP.jsPeter Wu2014-08-024-150/+136
| | | | | | | | | | | | | | | | | | | | Best viewed with `git diff -w`. Since CGP-sync.js and CGP-async.js are almost equal except for one function call, merge them into a single function. While at it, reformat CGP.js to expose a single namespace (`CGP`) which exports the symbol `drawAll`. Remove `alert()` and add a `console.error()` call instead. This is less intrustive to users (who will notice a broken graph anyway) and be more helpful for developers (who can examine the call trace in the Developer Console. Add `"use strict"` and use the standard four spaces as indent. Process the script through `js-beautify` which re-indented the code and added some spaces between operators. Replace double by single quotes for consistency. Rename `catch(e)` to `catch(ex)` to supress a jshint warning about IE8.
* jsrrdgraph: Fix error functions. Error prototype.Manuel Luis Sanmartín Rozada2014-08-024-6/+7
|
* jsrrdgraph: Fix reduce in DEFManuel Luis Sanmartín Rozada2014-08-021-2/+2
|
* jsrrdgraph: Add fallback fonts.Manuel Luis Sanmartín Rozada2014-08-022-3/+3
|
* jsrrdgraph: Use Typed Arrays for better performancePeter Wu2014-08-021-7/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Profiling was done using Firebug in Firefox 31 on Linux x86_64. Test was performed as follows: - rrd generated using collectd with default rrdtool settings. - CPU utilization was visualized with 8 lines (idle, nice, etc.). - The data has gaps between 20% and 40% and 55% and 85% (were no data was collected). - The measured performance was from advancing the data 40% to the right (there are no gaps before that). The total running time is 18859.094ms (old), 5151.822ms (new). In the below profiles, common functions with similar running times and call counts were omitted. Columns in the profile table: function, call count, time spent in the function, average time spent per call in *total* (including other functions called by the function) and percentage of the total running time. The RrdGraph.data_calc function was not called much, but seems to be heavy enough to include in the trace. Profile for old implementation: - getEndianByteAt 246959 12200.42ms 0.063ms 64.69% - getDoubleAt 30306 3183.393ms 0.612ms 16.88% - RRDRRA.getEl 30306 1177.33ms 0.665ms 6.24% - RRDRRA.calc_idx 30306 449.201ms 0.015ms 2.38% - (RrdDataFile.build 47 431.986ms total=21189.434ms 2.29%) - getByteAt 254290 327.369ms 0.013ms 1.74% - (2 functions omitted) - getCStringAt 752 103.308ms 0.271ms 0.55% - RrdRpn.calc 5504 98.55ms 0.018ms 0.52% - (1 function omitted) - (RrdGraph.data_calc 1 75.417ms total=174.535ms 0.4%) - getLongAt 1128 65.796ms 0.212ms 0.35% Profile for new implementation: - RRDRRA.getEl 32280 1202.446ms 0.065ms 23.34% - RrdRpn.calc 43968 848.693ms 0.019ms 16.47% (probably includes the getByteAt call which is not visible in trace) - (RrdGraph.data calc 2 616.648ms total=1466.432ms 11.97%) - getDoubleAt 32280 460.894ms 0.014ms 8.95% - (RrdDataFile.build 48 438.1ms total=2719.07ms 8.5%) - (RRDRRA.calc_idx 32280 436.375ms total=436.375ms 8.47%) - (10 functions omitted) - getLongAt 1152 16.273ms 0.014ms 0.32% - (2 functions omitted) - getCStringAt 768 13.651ms 0.018ms 0.26% A second test was performed on a graph with no visible data points. I dragged it to the left to get in the future with only NaN values. Then the profile started. It turns out that the byte readings are not dominating here, 99% of the time was spent in RrdRpn.calc and RrdGraph.data_calc: - (old) RrdRpn.calc 3.14k 58493s 0.019ms - (new) RrdRpn.calc 3.10k 56912s 0.018ms - RrdGraph.data_calc (n=2) took about 46 seconds for both. - getByteAt (n=12096): 0.014ms (old), invisible/inlined (new) - getEndianByteAt (n=4608): 0.040ms (old only) - getCStringAt (n=768): 0.285ms (old), 0.018ms (new) - getLongAt (n=1152): 0.233ms (old), 0.014ms (new)
* jsrrdgraph: Remove unused getStringAt, move implementationPeter Wu2014-08-021-48/+43
| | | | | | | | | | | | Rename switch_endian to littleEndian to be more explicit (the meaning is now inversed too). Make getEndianByteAt private since it is an implementation detail. Drop getStringAt as this is not used in this library. Move getCharAt above getCStringAt since they are more related. Move the methods definition for the current implementation to a new function.
* jsrrdgraph: Drop iDataOffset and iDataLength parametersPeter Wu2014-08-021-11/+9
| | | | | These parameters are not used in this library. Should it ever be necessary to process a slice of data, then the caller should do so.
* jsrrdgraph: document.write is for dinosaursPeter Wu2014-08-021-1/+3
| | | | | Use conditional compilation for the antique browsers that provide VBScript support.
* jsrrdgraph: Performance fixPeter Wu2014-08-021-6/+9
| | | | | | | | | | | commit 2a74a333ff143499b465234f0395a4aad7bdaa78 ("Upgrade to javascriptrrd ver 1.1.1") converted getByteAt calls to a getEndianByteAt call, but this also introduced a branch operation. Since endianess is dependent on the file, we can move the switch_endian check outside the function. Performance improved from 0.148ms (n=336k) to .039ms (n=384k) which translates to about 30 seconds!
* jsrrdgraph: binaryXHR: jshint style fixesPeter Wu2014-08-021-257/+264
| | | | | | | | | | | Added jshint comment on top, added "use strict". Added missing semi-colons, converted to '===' (after validation). Added comment for `typeof strData == "unknown"`. Break one long line over two lines. There are no other changes except for whitespace and line ending changes. Check with `git diff -w`.
* jsrrdgraph: Fixed jshint warnings/errorsPeter Wu2014-08-0213-218/+185
| | | | | | | | | | | | | | | | | Many fall in the category missing semicolon, but there are legitimate bugs (like throwing an error with an undefined variable, using isInfinite instead of !isFinite or fabs instead of Math.abs). At some places, I moved the variable declarations to avoid duplicate definition warnings. Redundant breaks have been removed (after return / throw). Global variables were implicitly defined in RrdDataFile (which caught my attention) and Base64, these have been made local. Also fixed some whitespace errors. Yay, the consistency. Not all (style) issues are fixed.
* support php versions without json support and show a warning messagePim van den Berg2014-07-253-2/+21
|
* jsrrdgraph: Fix get reponseText in FetchBinaryURLManuel Luis Sanmartín Rozada2014-07-251-1/+1
|
* jsrrdgraph: Upgrade to javascriptrrd ver 1.1.1Manuel Luis Sanmartín Rozada2014-07-252-85/+143
|
* jsrrdgraph: Fix ident. Thanks to PoilManuel Luis Sanmartín Rozada2014-07-251-3/+3
|
* jsrrdgraph: Check when this.gdes[i].legend is nullManuel Luis Sanmartín Rozada2014-07-251-2/+7
|
* jsrrdgraph: Fix textalign name typo. Thanks to PoilManuel Luis Sanmartín Rozada2014-07-253-9/+9
|
* jsrrdgraph: Fix flags parsing (options without a value)Peter Wu2014-07-251-97/+92
| | | | | Also fix some typos and white-space issues. Reported at https://github.com/pommi/CGP/issues/88
* inc/collectd: get_host_rrd_files: filter non-plugin .rrd filesPim van den Berg2014-07-241-1/+4
| | | | Closes #92
* Remove from all files the ending php tagFrançois LASSERRE2014-07-2310-20/+0
|
* type/base: stop escaping characters manually since we use escapeshellarg()Pim van den Berg2014-07-231-10/+2
| | | | Closes #89
* Update html.inc.phpFrançois LASSERRE2014-07-231-6/+6
| | | Fix a link when no class selected.
* conf: replace [] by array() to support PHP < 5.4Pim van den Berg2014-07-221-1/+1
|
* graph: use filter_var instead of filter_input to allow overriding GET from ↵Pim van den Berg2014-07-211-2/+2
| | | | | | | detail.php In detail.php $_GET['x'] and $_GET['y'] are overridden. filter_input takes the original values. This results in NULL values.
* type/base: print shellcmd when rrd_graph('debug') is calledPim van den Berg2014-07-211-1/+1
|
* Better x and y validation, report 400 on errorsPeter Wu2014-07-212-8/+16
| | | | | | | | | Report 400 Bad Request on query errors instead of reporting 200 OK (which can be cached). Add some additional validation for the 'x' and 'y' parameters, to catch underflow (test with `x=-10` for example). Also fix a typo in the error message and include more details (the actual error).
* Fix overly permissive hostname validation, fix host checkPeter Wu2014-07-212-3/+3
| | | | | | | | | `[\w\W]` matches EVERYTHING. Validation failed. Also remove `\d` as that `\w` is a superset of it. Also check that the host parameter is actually non-empty, otherwise `collectd_plugins` will happily return results as the directory `$CONFIG['datadir'] . '/' . ''` trivially exists...
* Fix regex for strange datadirsPeter Wu2014-07-201-1/+4
| | | | | If a datadir would contain characters with a special meaning in regex (e.g. `/tmp/logs (new)`), then the function would blow up.
* Display a HTTP error if the command failedPeter Wu2014-07-201-1/+4
| | | | ... for instance, when using an overly large "s" parameter.
* Escape file argument for rrd_infoPeter Wu2014-07-201-2/+7
| | | | Also init info_array in case the output is empty.
* Use a more secure command line building methodPeter Wu2014-07-208-73/+100
| | | | | | | | | | | | | | | | | | | Previously, a command is built by string concatenation. Here, the distinction between a value and multiple params got lost. Solve this by using an array for shell arguments. As the escaping is now removed from the `rrd_gen_graph` function, the canvas style needs to manually add those quotes to make the JS code still work. That only supports double-quotes, so hopefully nobody creates a name with a double quote as that would break the fragile JS command line parser. Separate the rrdtool options from the rrdtool graph command to make the `$graph_type == 'canvas'` option work (it would otherwise not understand the `rrdtool graph - -a PNG` option). Merge the SVG and PNG cases as they are the same except for the Content-Type header. Fix a missing html escape in a debug style.
* security: Add missing input validation for pluginPeter Wu2014-07-201-1/+1
| | | | | | | This is a security bug. The contents of the file are not immediately disclosed, but it could disclose environment information to the attacker (when display_errors=1 and an ancient PHP version is used that does not check for '\0' in `file_exists()`).
* Fix type confusionPeter Wu2014-07-202-4/+8
| | | | | | | | | index.php expects that collectd_hosts() always return an array for array_diff. Since an empty array evaluates to FALSE anyway, do not change the type and just return the empty array. In base.php, if no files are returned, the loop is never called and three variables are not initialized. Do it now.
* Defensive programming: more urlencode/htmlentitiesPeter Wu2014-07-204-52/+61
| | | | | | | | | | | | | | | | | | Make build_url return an URL, not HTML. This separates presentation from data. plugin_header's return value is unused, remove the unnecessary return. At places where `printf("<tag att='%s'>", $x);` is used, it is now converted to `printf("<tag att=\"%s\">", htmlentities($x));` since the single quote is not escaped by default by htmlentities. In case the canvas style is used, JS should use `textContent` instead of `innerHTML` to avoid reading `&quot;` instead of `"`. Nobody (should) use(s) IE6 anymore, so it is a safe change. While at it, use the standard charset attribute of meta to specify the character set (UTF-8).
* graph: don't overwrite config rrdtool_opts by rrdtool_opts from json pluginPim van den Berg2014-07-162-5/+7
| | | | Closes #86
* type/default: optionally draw min/max spikes in a lighter color in graphsPim van den Berg2014-07-053-4/+8
| | | | Closes #73
* jsrrdgraph: RrdGraph.js: make HRULE support reference to variablePim van den Berg2014-07-051-1/+3
| | | | | | The value of HRULE could be a reference to for example a VDEF variable. Closes #85
* type/genericio: apply percentile on scaled valuePim van den Berg2014-07-051-1/+1
|
* Escape HTML in GET-provided hostnameNicolas Iooss2014-06-302-4/+4
| | | | | | | A malicious user can enter javascript code in "h" GET parameter and this code gets executed because this parameter is copied in the HTML output without any escaping. This patch escape the output before it is checked it is valid.
* jsrrdgraph: Fix graph width to look like rrdtool.Manuel Luis Sanmartín Rozada2014-06-281-2/+1
|
* jsrrdgraph: Fix errors in second axis.Manuel Luis Sanmartín Rozada2014-06-281-2/+2
|
* rm plugin.phpPim van den Berg2014-06-281-17/+0
| | | | | Forgotten in commit: v0.3-77-gbf56a64 [remove ajax js code]
* Merge remote-tracking branch 'feandil/time_range'Pim van den Berg2014-06-281-0/+1
|\
| * Use config time_range for canvas graphsVincent Brillault2014-06-281-0/+1
| |
* | Keep the list of plugins sortedVincent Brillault2014-06-281-0/+1
|/
* type/base: replace array_merge by + sign to merge a fallback arrayPim van den Berg2014-06-281-2/+2
| | | | | | | array_merge resets the index, while in case of $this->colors and $this->legend, we'd like to keep the index. An irq plugin sample: array(1 => 1, 'ERR' => 'ERR') must not become array(0 => 1, 'ERR' => 'ERR') after an array_merge.
* Merge remote-tracking branch 'dhchen/master'Pim van den Berg2014-06-242-17/+24
|\
| * Add support for multiple types dbDao-hui Chen2014-06-112-17/+24
| |