File: rrd_005.phpt

package info (click to toggle)
php-rrd 2.0.3%2B1.1.3-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 496 kB
  • sloc: ansic: 2,447; xml: 665; makefile: 58; php: 3
file content (44 lines) | stat: -rw-r--r-- 1,073 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--TEST--
RRDUpdater default timestamp test
--SKIPIF--
<?php
include('skipif.inc');
include('rrdtool-bin.inc');
include('data/definition.inc');
if (!file_exists($data_emptyDb)) {
	die("skip $data_emptyDb doesnt' exist");
}
?>
--FILE--
<?php
include('rrdtool-bin.inc');
include('data/definition.inc');
$rrdFile = dirname(__FILE__) . "/rrd_updater_default_val.rrd";
copy($data_emptyDb, $rrdFile);

$updator = new RRDUpdater($rrdFile);
$updator->update(array("speed" => "12345"));
sleep(1);
$updator->update(array("speed" => "12357"));
sleep(1);
$updator->update(array("speed" => "12363"));
sleep(1);
$updator->update(array("speed" => "12363"));
sleep(1);
$updator->update(array("speed" => "12363"));
sleep(1);

//mostly for "visual test"
$command = "$rrdtool_bin graph "
 . dirname(__FILE__) . "/rrd_updater_default_val.png "
 . "--start -5s --end now "
 . "--vertical-label m/s "
 . "DEF:myspeed=$rrdFile:speed:AVERAGE "
 . "CDEF:realspeed=myspeed,1000,* "
 . "LINE2:realspeed#FF0000";

echo "exporting graph via exec\n";
exec($command);
?>
--EXPECTF--
exporting %s via exec