Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.137.174.65
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/3/root/usr/share/doc/rrdtool/html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/3/root/usr/share/doc/rrdtool/html/rrdgraph_libdbi.html
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>rrdgraph_libdbi</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<h1 id="NAME">NAME</h1>

<p>rrdgraph_libdbi - fetching data for graphing in rrdtool graph via libdbi</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p>&lt;rrdfile&gt; = <b>sql//&lt;libdbi driver&gt;/&lt;driver-option-name&gt;=&lt;driver-option-value&gt;/...&#x200B;[/rrdminstepsize=&lt;stepsize&gt;]&#x200B;[/rrdfillmissing=&lt;fill missing n seconds&gt;]&#x200B;//&lt;table&gt;&#x200B;/&lt;unixtimestamp column&gt;&#x200B;/&lt;data value column&gt;&#x200B;[/derive]&#x200B;/&lt;where clause 1&gt;&#x200B;/...&#x200B;/&lt;where clause n&gt;</b></p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>This pseudo-rrd-filename defines a sql datasource:</p>

<dl>

<dt id="sql"><b>sql//</b></dt>
<dd>

<pre><code>magic cookie-prefix for a libdbi type datasource</code></pre>

</dd>
<dt id="libdbi-driver"><b>&lt;libdbi driver&gt;</b></dt>
<dd>

<pre><code>which libdbi driver to use (e.g.: mysql)</code></pre>

</dd>
<dt id="driver-option-name-driver-option-value"><b>&lt;driver-option-name&gt;</b>=<b>&lt;driver-option-value&gt;</b></dt>
<dd>

<pre><code>defines the parameters that are required to connect to the database with the given libdbi driver
(These drivers are libdbi dependent - for details please look at the driver documentation of libdbi!)</code></pre>

</dd>
<dt id="rrdminstepsize-minimum-step-size"><b>/rrdminstepsize</b>=<b>&lt;minimum step size&gt;</b></dt>
<dd>

<pre><code>defines the minimum number of the step-length used for graphing (default: 300 seconds)</code></pre>

</dd>
<dt id="rrdfillmissing-fill-missing-seconds"><b>/rrdfillmissing</b>=<b>&lt;fill missing seconds&gt;</b></dt>
<dd>

<pre><code>defines the number of seconds to fill with the last value to avoid NaN boxes due to data-insertation jitter (default: 0 seconds)</code></pre>

</dd>
<dt id="table"><b>&lt;table&gt;</b></dt>
<dd>

<pre><code>defines the table from which to fetch the resultset.

If there is a need to fetch data from several tables, these tables can be defined by separating the tablenames with a &quot;+&quot;

hex-type-encoding via %xx are translated to the actual value, use %% to use %</code></pre>

</dd>
<dt id="unixtimestamp-column"><b>&lt;[*]unixtimestamp column&gt;</b></dt>
<dd>

<pre><code>defines the column of &lt;table&gt; which contains the unix-timestamp
- if this is a DATETIME field in the database, then prefix with leading &#39;*&#39;

hex-type-encoding via %xx are translated to the actual value, use %% to use %</code></pre>

</dd>
<dt id="data-value-column"><b>&lt;data value column&gt;</b></dt>
<dd>

<pre><code>defines the column of &lt;table&gt; which contains the value column, which should be graphed

hex-type-encoding via %xx are translated to the actual value, use %% to use %</code></pre>

</dd>
<dt id="derive"><b>/derive</b></dt>
<dd>

<pre><code>defines that the data value used should be the delta of the 2 consecutive values (to simulate COUNTER or DERIVE type datasources)</code></pre>

</dd>
<dt id="where-clause-s"><b>/&lt;where clause(s)&gt;</b></dt>
<dd>

<pre><code>defines one (ore more) where clauses that are joined with AND to filter the entries in the &lt;table&gt;

hex-type-encoding via %xx are translated to the actual value, use %% to use %</code></pre>

</dd>
</dl>

<p>the returned value column-names, which can be used as ds-names, are:</p>

<dl>

<dt id="min-avg-max-count-and-sigma"><b>min</b>, <b>avg</b>, <b>max</b>, <b>count</b> and <b>sigma</b></dt>
<dd>

<pre><code>are returned to be used as ds-names in your DS definition.
The reason for using this is that if the consolidation function is used for min/avg and max, then the engine is used several times.
And this results in the same SQL Statements used several times</code></pre>

</dd>
</dl>

<h1 id="EXAMPLES">EXAMPLES</h1>

<p>Here an example of a table in a MySQL database:</p>

<pre><code>DB connect information
  dbhost=127.0.0.1
  user=rrd
  password=secret
  dbname=rrd

here the table:
  CREATE TABLE RRDValue (
    RRDKeyID      bigint(20) NOT NULL,
    UnixTimeStamp int(11) NOT NULL,
    value         double default NOT NULL,
    PRIMARY KEY  (RRDKeyID,UnixTimeStamp)
  );</code></pre>

<p>and the RRDKeyID we want to graph for is: 1141942900757789274</p>

<p>The pseudo rrd-filename to access this is: &quot;sql//mysql/host=127.0.0.1/dbname=rrd/username=rrd/password=secret&#x200B;//RRDValue&#x200B;/UnixTimeStamp&#x200B;/value&#x200B;/RRDKeyID=1141464142203608274&quot;</p>

<p>To illustrate this here a command to create a graph that contains the actual values.</p>

<pre><code>DS_BASE=&quot;sql//mysql/host=127.0.0.1/dbname=rrd/username=rrd/password=passwd//RRDValue/UnixTimeStamp/value/RRDKeyID=1141942900757789274&quot;
rrdtool graph test.png --imgformat=PNG --start=-1day --end=+3hours --width=1000 --height=600 \
  &quot;DEF:min=$DS_BASE:min:AVERAGE&quot; \
  &quot;LINE1:min#FF0000:value&quot; \
  &quot;DEF:avg=$DS_BASE:avg:AVERAGE&quot; \
  &quot;LINE1:avg#00FF00:average&quot; \
  &quot;DEF:max=$DS_BASE:max:AVERAGE&quot; \
  &quot;LINE1:max#FF0000:max&quot; \
  &quot;DEF:sigma=$DS_BASE:sigma:AVERAGE&quot; \
  &quot;CDEF:upper=avg,4,sigma,*,+&quot; \
  &quot;LINE1:upper#0000FF:+4 sigma&quot; \
  &quot;CDEF:lower=avg,4,sigma,*,-&quot; \
  &quot;LINE1:lower#0000FF:-4 sigma&quot;</code></pre>

<h1 id="NOTES">NOTES</h1>

<p>* Naturally you can also use any other kind of driver that libdbi supports - e.g. postgres, ...</p>

<p>* From the way the data source is joined, it should also be possible to do joins over different tables (separate tables with &quot;,&quot; in table and add in the WHERE Clauses the table equal joins. This has not been tested!!!)</p>

<p>* It should also be relatively simple to add to the database using the same data source string. This has not been implemented...</p>

<p>* The aggregation functions are ignored and several data columns are used instead to avoid querying the same SQL several times when minimum, average and maximum are needed for graphing...</p>

<p>* for DB efficiency you should think of having 2 tables, one containing historic values and the other containing the latest data. This second table should be kept small to allow for the least amount of blocking SQL statements. With mysql you can even use myisam table-type for the first and InnoDB for the second. This is especially interesting as with tables with +100M rows myisam is much smaller then InnoDB.</p>

<p>* To debug the SQL statements set the environment variable RRDDEBUGSQL and the actual SQL statements and the timing is printed to stderr.</p>

<h1 id="Performance-issues-with-MySQL-backend">Performance issues with MySQL backend</h1>

<p>Previous versions of LibDBI have a big performance issue when retrieving data from a MySQL server. Performance impact is exponentially based on the number of values you retrieve from the database. For example, it would take more than 2 seconds to graph 5DS on 150 hours of data with a precision of 5 minutes (against 100ms when data comes from a RRD file). This bug has been fixed in version 0.9.0 of LibDBI. You can find more information on this libdbi-users mailing list thread: http://sourceforge.net/mailarchive/message.php?msg_id=30320894</p>

<h1 id="BUGS">BUGS</h1>

<p>* at least on Linux please make sure that the libdbi driver is explicitly linked against libdbi.so.0 check via ldd /usr/lib/dbd/libmysql.so, that there is a line with libdbi.so.0. otherwise at least the perl module RRDs will fail because the dynamic linker cannot find some symbols from libdbi.so. (this only happens when the libdbi driver is actually used the first time!) This is KNOWN to be the case with RHEL4 and FC4 and FC5! (But actually this is a bug with libdbi make files!)</p>

<p>* at least version 0.8.1 of libdbi exhibits a bug with BINARY fields (shorttext,text,mediumtext,longtext and possibly also BINARY and BLOB fields), that can result in coredumps of rrdtool. The tool will tell you on stderr if this occurs, so that you know what may be the reason. If you are not experiencing these coredumps, then set the environment variable RRD_NO_LIBDBI_BUG_WARNING, and then the message will not get shown.</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Martin Sperl &lt;rrdtool@martin.sperl.org&gt;</p>


</body>

</html>



Anon7 - 2022
AnonSec Team