From 0a547add2f4cc264380d2dab2c472efe5a1d7094 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sat, 3 May 2014 19:17:16 +0200 Subject: 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. --- plugin/netlink.php | 122 ----------------------------------------------------- 1 file changed, 122 deletions(-) delete mode 100644 plugin/netlink.php (limited to 'plugin/netlink.php') diff --git a/plugin/netlink.php b/plugin/netlink.php deleted file mode 100644 index 9ddaee8..0000000 --- a/plugin/netlink.php +++ /dev/null @@ -1,122 +0,0 @@ -rrd_format = '%5.1lf%s'; - -switch($obj->args['type']) { - case 'if_collisions': - $obj->data_sources = array('value'); - $obj->legend = array('value' => 'Collisions'); - $obj->colors = array('value' => '0000ff'); - $obj->rrd_title = sprintf('Collisions (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Collisions/s'; - break; - case 'if_dropped': - $obj->data_sources = array('rx', 'tx'); - $obj->legend = array( - 'rx' => 'Receive', - 'tx' => 'Transmit', - ); - $obj->colors = array( - 'rx' => '0000ff', - 'tx' => '00b000', - ); - $obj->rrd_title = sprintf('Dropped Packets (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Packets/s'; - break; - case 'if_errors': - $obj->data_sources = array('rx', 'tx'); - $obj->legend = array( - 'rx' => 'Receive', - 'tx' => 'Transmit', - ); - $obj->colors = array( - 'rx' => '0000ff', - 'tx' => '00b000', - ); - $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Errors/s'; - break; - case 'if_multicast': - $obj->data_sources = array('value'); - $obj->legend = array('value' => 'Packets'); - $obj->colors = array('value' => '0000ff'); - $obj->rrd_title = sprintf('Multicast Packets (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Packets/s'; - break; - case 'if_octets': - $obj->data_sources = array('rx', 'tx'); - $obj->legend = array( - 'rx' => 'Receive', - 'tx' => 'Transmit', - ); - $obj->colors = array( - 'rx' => '0000ff', - 'tx' => '00b000', - ); - $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = sprintf('%s/s', ucfirst($CONFIG['network_datasize'])); - $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1; - break; - case 'if_packets': - $obj->data_sources = array('rx', 'tx'); - $obj->legend = array( - 'rx' => 'Receive', - 'tx' => 'Transmit', - ); - $obj->colors = array( - 'rx' => '0000ff', - 'tx' => '00b000', - ); - $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Packets/s'; - break; - case 'if_rx_errors': - $obj->data_sources = array('value'); - $obj->legend = array( - 'crc' => 'CRC', - 'fifo' => 'FiFo', - 'frame' => 'Frame', - 'length' => 'Lenght', - 'missed' => 'Missed', - 'over' => 'Over', - ); - $obj->colors = array( - 'crc' => '00e000', - 'fifo' => 'f000c0', - 'frame' => 'ffb000', - 'length' => 'f00000', - 'missed' => '0000f0', - 'over' => '00e0ff', - ); - $obj->rrd_title = sprintf('Interface receive errors (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Errors/s'; - break; - case 'if_tx_errors': - $obj->data_sources = array('value'); - $obj->legend = array( - 'aborted' => 'Aborted', - 'carrier' => 'Carrier', - 'fifo' => 'FiFo', - 'heartbeat'=> 'Heartbeat', - 'window' => 'Window', - ); - $obj->colors = array( - 'aborted' => 'f00000', - 'carrier' => '00e0ff', - 'fifo' => '00e000', - 'heartbeat'=> 'ffb000', - 'window' => 'f000c0', - ); - $obj->rrd_title = sprintf('Interface transmit errors (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Errors/s'; - break; -} - -$obj->rrd_graph(); -- cgit v1.1