diff options
author | Pim van den Berg | 2009-11-04 23:04:30 +0100 |
---|---|---|
committer | Pim van den Berg | 2009-11-04 23:04:30 +0100 |
commit | 488b4f3ea230b0bc3cb7fa7e5264691e21067cd0 (patch) | |
tree | 67944684b708f9e2998eeeb0200e608f1f451a36 /plugin | |
parent | remove path_format from plugins (diff) | |
download | apt-panopticon_cgp-488b4f3ea230b0bc3cb7fa7e5264691e21067cd0.zip apt-panopticon_cgp-488b4f3ea230b0bc3cb7fa7e5264691e21067cd0.tar.gz apt-panopticon_cgp-488b4f3ea230b0bc3cb7fa7e5264691e21067cd0.tar.bz2 apt-panopticon_cgp-488b4f3ea230b0bc3cb7fa7e5264691e21067cd0.tar.xz |
add unixsock flush support
Via the UnixSock plugin of Collectd it is possible to send commands to the
Collectd daemon. One of the commands is the FLUSH command, which you can
use to let the daemon write cached data to the rrd files.
CGP uses the FLUSH command before generating a graph and before showing
the load information on the main page. In this case the information shown
via CGP is always up-to-date. Also when you have configured the RRDTool
plugin of Collectd with a CacheTimeout setting.
This commit includes code based on functions collectd_identifier and
collectd_flush from php-collection by Bruno Prémont.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/cpu.php | 2 | ||||
-rw-r--r-- | plugin/df.php | 3 | ||||
-rw-r--r-- | plugin/disk.php | 3 | ||||
-rw-r--r-- | plugin/entropy.php | 3 | ||||
-rw-r--r-- | plugin/interface.php | 3 | ||||
-rw-r--r-- | plugin/irq.php | 2 | ||||
-rw-r--r-- | plugin/load.php | 3 | ||||
-rw-r--r-- | plugin/memory.php | 2 | ||||
-rw-r--r-- | plugin/processes.php | 2 | ||||
-rw-r--r-- | plugin/sensors.php | 2 | ||||
-rw-r--r-- | plugin/swap.php | 2 | ||||
-rw-r--r-- | plugin/users.php | 3 |
12 files changed, 30 insertions, 0 deletions
diff --git a/plugin/cpu.php b/plugin/cpu.php index d750a3a..5f688f4 100644 --- a/plugin/cpu.php +++ b/plugin/cpu.php | |||
@@ -59,6 +59,8 @@ $obj->rrd_title = "CPU-$pinstance usage on $host"; | |||
59 | $obj->rrd_vertical = 'Jiffies'; | 59 | $obj->rrd_vertical = 'Jiffies'; |
60 | $obj->rrd_format = '%5.2lf'; | 60 | $obj->rrd_format = '%5.2lf'; |
61 | 61 | ||
62 | collectd_flush(ident_from_args($obj->args)); | ||
63 | |||
62 | $obj->rrd_graph(); | 64 | $obj->rrd_graph(); |
63 | 65 | ||
64 | ?> | 66 | ?> |
diff --git a/plugin/df.php b/plugin/df.php index f4dd5d6..6d7414b 100644 --- a/plugin/df.php +++ b/plugin/df.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericStacked.class.php'; | 6 | require_once 'type/GenericStacked.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | # LAYOUT | 9 | # LAYOUT |
9 | # | 10 | # |
@@ -36,6 +37,8 @@ $obj->rrd_title = "Free space ($tinstance) on $host"; | |||
36 | $obj->rrd_vertical = 'Bytes'; | 37 | $obj->rrd_vertical = 'Bytes'; |
37 | $obj->rrd_format = '%5.1lf%sB'; | 38 | $obj->rrd_format = '%5.1lf%sB'; |
38 | 39 | ||
40 | collectd_flush(ident_from_args($obj->args)); | ||
41 | |||
39 | $obj->rrd_graph(); | 42 | $obj->rrd_graph(); |
40 | 43 | ||
41 | ?> | 44 | ?> |
diff --git a/plugin/disk.php b/plugin/disk.php index 0c18016..45b5fde 100644 --- a/plugin/disk.php +++ b/plugin/disk.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericIO.class.php'; | 6 | require_once 'type/GenericIO.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # disk-XXXX/ | 10 | # disk-XXXX/ |
@@ -57,6 +58,8 @@ switch($type) { | |||
57 | break; | 58 | break; |
58 | } | 59 | } |
59 | 60 | ||
61 | collectd_flush(ident_from_args($obj->args)); | ||
62 | |||
60 | $obj->rrd_graph(); | 63 | $obj->rrd_graph(); |
61 | 64 | ||
62 | ?> | 65 | ?> |
diff --git a/plugin/entropy.php b/plugin/entropy.php index dcfbcc8..a4379ab 100644 --- a/plugin/entropy.php +++ b/plugin/entropy.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/Default.class.php'; | 6 | require_once 'type/Default.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # entropy/entropy.rrd | 10 | # entropy/entropy.rrd |
@@ -31,6 +32,8 @@ $obj->rrd_title = "Available entropy on $host"; | |||
31 | $obj->rrd_vertical = 'Bits'; | 32 | $obj->rrd_vertical = 'Bits'; |
32 | $obj->rrd_format = '%4.0lf'; | 33 | $obj->rrd_format = '%4.0lf'; |
33 | 34 | ||
35 | collectd_flush(ident_from_args($obj->args)); | ||
36 | |||
34 | $obj->rrd_graph(); | 37 | $obj->rrd_graph(); |
35 | 38 | ||
36 | ?> | 39 | ?> |
diff --git a/plugin/interface.php b/plugin/interface.php index a3fca3d..45e3cf1 100644 --- a/plugin/interface.php +++ b/plugin/interface.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericIO.class.php'; | 6 | require_once 'type/GenericIO.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | # LAYOUT | 9 | # LAYOUT |
9 | # interface/ | 10 | # interface/ |
@@ -48,6 +49,8 @@ switch($type) { | |||
48 | break; | 49 | break; |
49 | } | 50 | } |
50 | 51 | ||
52 | collectd_flush(ident_from_args($obj->args)); | ||
53 | |||
51 | $obj->rrd_graph(); | 54 | $obj->rrd_graph(); |
52 | 55 | ||
53 | ?> | 56 | ?> |
diff --git a/plugin/irq.php b/plugin/irq.php index e442142..95bddcf 100644 --- a/plugin/irq.php +++ b/plugin/irq.php | |||
@@ -34,6 +34,8 @@ $obj->rrd_title = "Interrupts on $host"; | |||
34 | $obj->rrd_vertical = 'IRQs/s'; | 34 | $obj->rrd_vertical = 'IRQs/s'; |
35 | $obj->rrd_format = '%6.1lf'; | 35 | $obj->rrd_format = '%6.1lf'; |
36 | 36 | ||
37 | collectd_flush(ident_from_args($obj->args)); | ||
38 | |||
37 | $obj->rrd_graph(); | 39 | $obj->rrd_graph(); |
38 | 40 | ||
39 | ?> | 41 | ?> |
diff --git a/plugin/load.php b/plugin/load.php index 0246edc..83fcf19 100644 --- a/plugin/load.php +++ b/plugin/load.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/Default.class.php'; | 6 | require_once 'type/Default.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # load/load.rrd | 10 | # load/load.rrd |
@@ -35,6 +36,8 @@ $obj->rrd_title = "System load on $host"; | |||
35 | $obj->rrd_vertical = 'System load'; | 36 | $obj->rrd_vertical = 'System load'; |
36 | $obj->rrd_format = '%.2lf'; | 37 | $obj->rrd_format = '%.2lf'; |
37 | 38 | ||
39 | collectd_flush(ident_from_args($obj->args)); | ||
40 | |||
38 | $obj->rrd_graph(); | 41 | $obj->rrd_graph(); |
39 | 42 | ||
40 | ?> | 43 | ?> |
diff --git a/plugin/memory.php b/plugin/memory.php index 6cef5a7..7b0e47b 100644 --- a/plugin/memory.php +++ b/plugin/memory.php | |||
@@ -47,6 +47,8 @@ $obj->rrd_title = "Physical memory utilization on $host"; | |||
47 | $obj->rrd_vertical = 'Bytes'; | 47 | $obj->rrd_vertical = 'Bytes'; |
48 | $obj->rrd_format = '%5.1lf%s'; | 48 | $obj->rrd_format = '%5.1lf%s'; |
49 | 49 | ||
50 | collectd_flush(ident_from_args($obj->args)); | ||
51 | |||
50 | $obj->rrd_graph(); | 52 | $obj->rrd_graph(); |
51 | 53 | ||
52 | ?> | 54 | ?> |
diff --git a/plugin/processes.php b/plugin/processes.php index c741a02..5fc0463 100644 --- a/plugin/processes.php +++ b/plugin/processes.php | |||
@@ -52,6 +52,8 @@ $obj->rrd_title = "Processes on $host"; | |||
52 | $obj->rrd_vertical = 'Processes'; | 52 | $obj->rrd_vertical = 'Processes'; |
53 | $obj->rrd_format = '%5.1lf%s'; | 53 | $obj->rrd_format = '%5.1lf%s'; |
54 | 54 | ||
55 | collectd_flush(ident_from_args($obj->args)); | ||
56 | |||
55 | $obj->rrd_graph(); | 57 | $obj->rrd_graph(); |
56 | 58 | ||
57 | ?> | 59 | ?> |
diff --git a/plugin/sensors.php b/plugin/sensors.php index b1b15cf..ddcf521 100644 --- a/plugin/sensors.php +++ b/plugin/sensors.php | |||
@@ -52,6 +52,8 @@ switch($type) { | |||
52 | break; | 52 | break; |
53 | } | 53 | } |
54 | 54 | ||
55 | collectd_flush(ident_from_args($obj->args)); | ||
56 | |||
55 | $obj->rrd_graph(); | 57 | $obj->rrd_graph(); |
56 | 58 | ||
57 | ?> | 59 | ?> |
diff --git a/plugin/swap.php b/plugin/swap.php index 7160ec3..18c6242 100644 --- a/plugin/swap.php +++ b/plugin/swap.php | |||
@@ -44,6 +44,8 @@ $obj->rrd_title = "Swap utilization on $host"; | |||
44 | $obj->rrd_vertical = 'Bytes'; | 44 | $obj->rrd_vertical = 'Bytes'; |
45 | $obj->rrd_format = '%5.1lf%s'; | 45 | $obj->rrd_format = '%5.1lf%s'; |
46 | 46 | ||
47 | collectd_flush(ident_from_args($obj->args)); | ||
48 | |||
47 | $obj->rrd_graph(); | 49 | $obj->rrd_graph(); |
48 | 50 | ||
49 | ?> | 51 | ?> |
diff --git a/plugin/users.php b/plugin/users.php index 00874a2..1555927 100644 --- a/plugin/users.php +++ b/plugin/users.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/Default.class.php'; | 6 | require_once 'type/Default.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # users/users.rrd | 10 | # users/users.rrd |
@@ -31,6 +32,8 @@ $obj->rrd_title = "Users on $host"; | |||
31 | $obj->rrd_vertical = 'Users'; | 32 | $obj->rrd_vertical = 'Users'; |
32 | $obj->rrd_format = '%.1lf'; | 33 | $obj->rrd_format = '%.1lf'; |
33 | 34 | ||
35 | collectd_flush(ident_from_args($obj->args)); | ||
36 | |||
34 | $obj->rrd_graph(); | 37 | $obj->rrd_graph(); |
35 | 38 | ||
36 | ?> | 39 | ?> |