aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc
diff options
context:
space:
mode:
authorPim van den Berg2014-05-03 19:17:16 +0200
committerPim van den Berg2014-05-12 21:32:24 +0200
commit0a547add2f4cc264380d2dab2c472efe5a1d7094 (patch)
tree55bb43a3e31c5814848d61eea92c8438e4a37886 /inc
parenttype/base: set default title to "Plugin Type (PluginInstance) (Category)" (diff)
downloadapt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.zip
apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.gz
apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.bz2
apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.xz
graph.php: use JSON plugins instead of including PHP plugin files
A couple of big changes here. A lot of logic moved to graph.php. The PHP plugin files have been rewritten to JSON. In these JSON files *everything* is optional. Also *NOT* having a JSON plugin file won't block you from having a graph. The JSON will just make the graphs prettier (by having a title, y-axis title, legend, colors, etc..). The Collectd types.db file is parsed and used to determine RRD content. When things are not defined in the JSON it will fallback to a default.
Diffstat (limited to 'inc')
-rw-r--r--inc/collectd.inc.php24
-rw-r--r--inc/types.db187
2 files changed, 211 insertions, 0 deletions
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php
index 3bfc6ff..695d79c 100644
--- a/inc/collectd.inc.php
+++ b/inc/collectd.inc.php
@@ -167,3 +167,27 @@ function plugin_sort($data) {
167 167
168 return $data; 168 return $data;
169} 169}
170
171function parse_typesdb_file($file = '/usr/share/collectd/types.db') {
172 if (!file_exists($file))
173 $file = 'inc/types.db';
174
175 $types = array();
176 foreach (file($file) as $type) {
177 if(!preg_match('/^(?P<dataset>[\w_]+)\s+(?P<datasources>.*)/', $type, $matches))
178 continue;
179 $dataset = $matches['dataset'];
180 $datasources = explode(', ', $matches['datasources']);
181
182 foreach ($datasources as $ds) {
183 if (!preg_match('/^(?P<dsname>\w+):(?P<dstype>[\w]+):(?P<min>[\-\dU\.]+):(?P<max>[\dU\.]+)/', $ds, $matches))
184 error_log(sprintf('CGP Error: DS "%s" from dataset "%s" did not match', $ds, $dataset));
185 $types[$dataset][$matches['dsname']] = array(
186 'dstype' => $matches['dstype'],
187 'min' => $matches['min'],
188 'max' => $matches['max'],
189 );
190 }
191 }
192 return $types;
193}
diff --git a/inc/types.db b/inc/types.db
new file mode 100644
index 0000000..e6345ab
--- /dev/null
+++ b/inc/types.db
@@ -0,0 +1,187 @@
1absolute value:ABSOLUTE:0:U
2apache_bytes value:DERIVE:0:U
3apache_connections value:GAUGE:0:65535
4apache_idle_workers value:GAUGE:0:65535
5apache_requests value:DERIVE:0:U
6apache_scoreboard value:GAUGE:0:65535
7ath_nodes value:GAUGE:0:65535
8ath_stat value:DERIVE:0:U
9bitrate value:GAUGE:0:4294967295
10bytes value:GAUGE:0:U
11cache_operation value:DERIVE:0:U
12cache_ratio value:GAUGE:0:100
13cache_result value:DERIVE:0:U
14cache_size value:GAUGE:0:4294967295
15charge value:GAUGE:0:U
16compression_ratio value:GAUGE:0:2
17compression uncompressed:DERIVE:0:U, compressed:DERIVE:0:U
18connections value:DERIVE:0:U
19conntrack value:GAUGE:0:4294967295
20contextswitch value:DERIVE:0:U
21counter value:COUNTER:U:U
22cpufreq value:GAUGE:0:U
23cpu value:DERIVE:0:U
24current_connections value:GAUGE:0:U
25current_sessions value:GAUGE:0:U
26current value:GAUGE:U:U
27delay value:GAUGE:-1000000:1000000
28derive value:DERIVE:0:U
29df_complex value:GAUGE:0:U
30df_inodes value:GAUGE:0:U
31df used:GAUGE:0:1125899906842623, free:GAUGE:0:1125899906842623
32disk_latency read:GAUGE:0:U, write:GAUGE:0:U
33disk_merged read:DERIVE:0:U, write:DERIVE:0:U
34disk_octets read:DERIVE:0:U, write:DERIVE:0:U
35disk_ops_complex value:DERIVE:0:U
36disk_ops read:DERIVE:0:U, write:DERIVE:0:U
37disk_time read:DERIVE:0:U, write:DERIVE:0:U
38dns_answer value:DERIVE:0:U
39dns_notify value:DERIVE:0:U
40dns_octets queries:DERIVE:0:U, responses:DERIVE:0:U
41dns_opcode value:DERIVE:0:U
42dns_qtype_cached value:GAUGE:0:4294967295
43dns_qtype value:DERIVE:0:U
44dns_query value:DERIVE:0:U
45dns_question value:DERIVE:0:U
46dns_rcode value:DERIVE:0:U
47dns_reject value:DERIVE:0:U
48dns_request value:DERIVE:0:U
49dns_resolver value:DERIVE:0:U
50dns_response value:DERIVE:0:U
51dns_transfer value:DERIVE:0:U
52dns_update value:DERIVE:0:U
53dns_zops value:DERIVE:0:U
54email_check value:GAUGE:0:U
55email_count value:GAUGE:0:U
56email_size value:GAUGE:0:U
57entropy value:GAUGE:0:4294967295
58fanspeed value:GAUGE:0:U
59file_size value:GAUGE:0:U
60files value:GAUGE:0:U
61fork_rate value:DERIVE:0:U
62frequency value:GAUGE:0:U
63frequency_offset value:GAUGE:-1000000:1000000
64fscache_stat value:DERIVE:0:U
65gauge value:GAUGE:U:U
66http_request_methods value:DERIVE:0:U
67http_requests value:DERIVE:0:U
68http_response_codes value:DERIVE:0:U
69humidity value:GAUGE:0:100
70if_collisions value:DERIVE:0:U
71if_dropped rx:DERIVE:0:U, tx:DERIVE:0:U
72if_errors rx:DERIVE:0:U, tx:DERIVE:0:U
73if_multicast value:DERIVE:0:U
74if_octets rx:DERIVE:0:U, tx:DERIVE:0:U
75if_packets rx:DERIVE:0:U, tx:DERIVE:0:U
76if_rx_errors value:DERIVE:0:U
77if_tx_errors value:DERIVE:0:U
78invocations value:DERIVE:0:U
79io_octets rx:DERIVE:0:U, tx:DERIVE:0:U
80io_packets rx:DERIVE:0:U, tx:DERIVE:0:U
81ipt_bytes value:DERIVE:0:U
82ipt_packets value:DERIVE:0:U
83irq value:DERIVE:0:U
84latency value:GAUGE:0:65535
85links value:GAUGE:0:U
86load shortterm:GAUGE:0:100, midterm:GAUGE:0:100, longterm:GAUGE:0:100
87memcached_command value:DERIVE:0:U
88memcached_connections value:GAUGE:0:U
89memcached_items value:GAUGE:0:U
90memcached_octets rx:DERIVE:0:U, tx:DERIVE:0:U
91memcached_ops value:DERIVE:0:U
92memory value:GAUGE:0:281474976710656
93multimeter value:GAUGE:U:U
94mysql_commands value:DERIVE:0:U
95mysql_handler value:DERIVE:0:U
96mysql_locks value:DERIVE:0:U
97mysql_log_position value:DERIVE:0:U
98mysql_octets rx:DERIVE:0:U, tx:DERIVE:0:U
99nfs_procedure value:DERIVE:0:U
100nginx_connections value:GAUGE:0:U
101nginx_requests value:DERIVE:0:U
102node_octets rx:DERIVE:0:U, tx:DERIVE:0:U
103node_rssi value:GAUGE:0:255
104node_stat value:DERIVE:0:U
105node_tx_rate value:GAUGE:0:127
106operations value:DERIVE:0:U
107percent value:GAUGE:0:100.1
108pg_blks value:DERIVE:0:U
109pg_db_size value:GAUGE:0:U
110pg_n_tup_c value:DERIVE:0:U
111pg_n_tup_g value:GAUGE:0:U
112pg_numbackends value:GAUGE:0:U
113pg_scan value:DERIVE:0:U
114pg_xact value:DERIVE:0:U
115ping_droprate value:GAUGE:0:100
116ping value:GAUGE:0:65535
117ping_stddev value:GAUGE:0:65535
118players value:GAUGE:0:1000000
119power value:GAUGE:0:U
120protocol_counter value:DERIVE:0:U
121ps_code value:GAUGE:0:9223372036854775807
122ps_count processes:GAUGE:0:1000000, threads:GAUGE:0:1000000
123ps_cputime user:DERIVE:0:U, syst:DERIVE:0:U
124ps_data value:GAUGE:0:9223372036854775807
125ps_disk_octets read:DERIVE:0:U, write:DERIVE:0:U
126ps_disk_ops read:DERIVE:0:U, write:DERIVE:0:U
127ps_pagefaults minflt:DERIVE:0:U, majflt:DERIVE:0:U
128ps_rss value:GAUGE:0:9223372036854775807
129ps_stacksize value:GAUGE:0:9223372036854775807
130ps_state value:GAUGE:0:65535
131ps_vm value:GAUGE:0:9223372036854775807
132queue_length value:GAUGE:0:U
133records value:GAUGE:0:U
134requests value:GAUGE:0:U
135response_time value:GAUGE:0:U
136route_etx value:GAUGE:0:U
137route_metric value:GAUGE:0:U
138routes value:GAUGE:0:U
139serial_octets rx:DERIVE:0:U, tx:DERIVE:0:U
140signal_noise value:GAUGE:U:0
141signal_power value:GAUGE:U:0
142signal_quality value:GAUGE:0:U
143snr value:GAUGE:0:U
144spam_check value:GAUGE:0:U
145spam_score value:GAUGE:U:U
146swap_io value:DERIVE:0:U
147swap value:GAUGE:0:1099511627776
148tcp_connections value:GAUGE:0:4294967295
149temperature value:GAUGE:-273.15:U
150threads value:GAUGE:0:U
151time_dispersion value:GAUGE:-1000000:1000000
152timeleft value:GAUGE:0:3600
153time_offset value:GAUGE:-1000000:1000000
154total_bytes value:DERIVE:0:U
155total_connections value:DERIVE:0:U
156total_operations value:DERIVE:0:U
157total_requests value:DERIVE:0:U
158total_sessions value:DERIVE:0:U
159total_threads value:DERIVE:0:U
160total_time_in_ms value:DERIVE:0:U
161total_values value:DERIVE:0:U
162uptime value:GAUGE:0:4294967295
163users value:GAUGE:0:65535
164vcpu value:GAUGE:0:U
165virt_cpu_total value:DERIVE:0:U
166virt_vcpu value:DERIVE:0:U
167vmpage_action value:DERIVE:0:U
168vmpage_faults minflt:DERIVE:0:U, majflt:DERIVE:0:U
169vmpage_io in:DERIVE:0:U, out:DERIVE:0:U
170vmpage_number value:GAUGE:0:4294967295
171volatile_changes value:GAUGE:0:U
172voltage_threshold value:GAUGE:U:U, threshold:GAUGE:U:U
173voltage value:GAUGE:U:U
174vs_memory value:GAUGE:0:9223372036854775807
175vs_processes value:GAUGE:0:65535
176vs_threads value:GAUGE:0:65535
177#
178# Legacy types
179# (required for the v5 upgrade target)
180#
181arc_counts demand_data:COUNTER:0:U, demand_metadata:COUNTER:0:U, prefetch_data:COUNTER:0:U, prefetch_metadata:COUNTER:0:U
182arc_l2_bytes read:COUNTER:0:U, write:COUNTER:0:U
183arc_l2_size value:GAUGE:0:U
184arc_ratio value:GAUGE:0:U
185arc_size current:GAUGE:0:U, target:GAUGE:0:U, minlimit:GAUGE:0:U, maxlimit:GAUGE:0:U
186mysql_qcache hits:COUNTER:0:U, inserts:COUNTER:0:U, not_cached:COUNTER:0:U, lowmem_prunes:COUNTER:0:U, queries_in_cache:GAUGE:0:U
187mysql_threads running:GAUGE:0:U, connected:GAUGE:0:U, cached:GAUGE:0:U, created:COUNTER:0:U