diff --git a/README.md b/README.md
index 16f9b82232f20ef01642fec67939bca9b644aa57..602c76fdb24f55d74c3132e935a2c561d4bb73c9 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 Zabbix
 ======
-Script and templates for Zabbix 2.2.x. and 2.4.x
+Script and templates for Zabbix 2.2.x, 2.4.x, 3.0.x
 
 - In bin you will find Bash/Perl/PHP scripts used by some User Parameters (need to be installed on agent)
 - In sudoers.d you can find settings for sudo
@@ -54,6 +54,10 @@ Template App Exim
 =====
 Monitoring for mail server Exim.
 
+Template App Rserve
+=====
+Monitoring for RServer in R.
+
 Template App lm_sensors
 =====
 Monitoring CPU and MotherBoard temperatures by lm_senros module.
diff --git a/bin/apc-check.php b/bin/apc-check.php
index f3c79bb16f01b4c2e5efba3a4b5f95642d77bed1..748db3783341985d8808aac5edfd03a4bb48a545 100644
--- a/bin/apc-check.php
+++ b/bin/apc-check.php
@@ -1,7 +1,6 @@
 <?php
 
 $item = $argv[1];
-
 function file_get_contents_curl($url) {
     $ch = curl_init();
 
diff --git a/bin/arduino.py b/bin/arduino.py
new file mode 100644
index 0000000000000000000000000000000000000000..191f9bfe5def139f22ba5ff33724afef9f56a1b9
--- /dev/null
+++ b/bin/arduino.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+import serial
+import sys
+import time
+
+ser=serial.Serial('/dev/ttyACM0', 9600, timeout=0.5)
+ser.open()
+try:
+	time.sleep(2)
+	ser.flush()
+	ser.write(sys.argv[1]+"\n")
+	response=ser.readline()
+	print response
+#	ser.close()
+except:
+	print " ERROR "
\ No newline at end of file
diff --git a/bin/blacklist.sh b/bin/blacklist.sh
new file mode 100644
index 0000000000000000000000000000000000000000..8581a5f7ba5d94d85a28874491ddf060a84543fc
--- /dev/null
+++ b/bin/blacklist.sh
@@ -0,0 +1,68 @@
+#!/bin/bash 
+# http://giantdorks.org/alain/shell-script-to-query-a-list-of-hostnames-or-ip-addresses-against-a-list-of-local-and-remote-dns-black-lists/
+# Modified by Gerard Stanczak gerard@thecamels.org 
+# Usage: blacklist.sh DOMAIN  
+ 
+# IPs or hostnames to check if none provided as arguments to the script
+hosts='
+'
+ 
+# Locally maintained list of DNSBLs to check
+LocalList='
+b.barracudacentral.org
+'
+ 
+# pipe delimited exclude list for remote lists
+Exclude='spamtrap.drbl.drand.net|dnsbl.proxybl.org|^dnsbl.mailer.mobi$|^foo.bar$|^bar.baz$|^.*webiron.*$'
+ 
+# Remotely maintained list of DNSBLs to check
+WPurl="https://en.wikipedia.org/wiki/Comparison_of_DNS_blacklists"
+WPlst=$(curl -s $WPurl | egrep "<td>([a-z]+\.){1,7}[a-z]+</td>" | sed -r "s|</?td>||g;/$Exclude/d")
+ 
+ 
+# ---------------------------------------------------------------------
+ 
+HostToIP()
+{
+ if ( echo "$host" | egrep -q "[a-zA-Z]" ); then
+   IP=$(host "$host" | awk '/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ {print$NF}')
+ else
+   IP="$host"
+ fi
+}
+ 
+Reverse()
+{
+ echo $1 | awk -F. '{print$4"."$3"."$2"."$1}'
+}
+ 
+Check()
+{
+ result=$(dig +short $rIP.$BL)
+ if [ -n "$result" ]; then
+   echo -e "$host  LISTED  $BL (answer = $result)"
+ else
+   echo -e "$host  OK  $BL"
+ fi
+}
+ 
+if [ -n "$1" ]; then
+  hosts=$@
+fi
+ 
+if [ -z "$hosts" ]; then
+  hosts=$(netstat -tn | awk '$4 ~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/ && $4 !~ /127.0.0/ {gsub(/:[0-9]+/,"",$4);} END{print$4}')
+fi
+ 
+for host in $hosts; do
+  HostToIP
+  rIP=$(Reverse $IP)
+  # Checking $IP against BLs from $WPurl"
+  for BL in $WPlst; do
+    Check
+  done
+  # Checking $IP against BLs from a local list"
+  for BL in $LocalList; do
+    Check
+  done
+done
\ No newline at end of file
diff --git a/bin/check-update.sh b/bin/check-update.sh
new file mode 100644
index 0000000000000000000000000000000000000000..5c992d26be6a7f39f1dc5eb54adb7e4c00b26592
--- /dev/null
+++ b/bin/check-update.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+day=$(date +%e)
+if ((day <= 7)) ; then
+	result=`/usr/bin/yum -q check-update | grep -v "^$"`
+	echo -n "$result" > /tmp/yum-update-pending
+	chown zabbix.zabbix /tmp/yum-update-pending
+fi
diff --git a/bin/hdd_discovery.sh b/bin/hdd_discovery.sh
index c78951e363c728a30bb9feb839e4cbaa9e453ca2..edc9f706c90f6bcc5b6db61a848ecbd8071e22e0 100644
--- a/bin/hdd_discovery.sh
+++ b/bin/hdd_discovery.sh
@@ -1,10 +1,4 @@
 #!/bin/bash
-# Script for HDD discovery
-#
-# Created by:
-# Michał Macioszek, Taras Baran, Michal Gębora, Marcin Wilk, Maks Bednarek, Anna Fałek, Mikołaj Szczuraszek
-
-
 disks=`ls -l /dev/sd* | awk '{print $NF}' | sed 's/[0-9]//g' | uniq`
 echo -n "{\"data\":["
 
diff --git a/bin/mysql_discover_tables.sh b/bin/mysql_discover_tables.sh
new file mode 100644
index 0000000000000000000000000000000000000000..4140b6ef5cd5dbd97c47751d4436de8e7729ef8d
--- /dev/null
+++ b/bin/mysql_discover_tables.sh
@@ -0,0 +1,19 @@
+#!bin/bash
+
+comma=1
+echo -n "{\"data\":["
+
+for i in $(sudo /bin/find /var/lib/mysql -type f -printf %p+%s= | tr "=" "\n" | grep -v "\/mysql\/mysql\/" | grep "\.ibd" | cut -d "+" -f 1 | sed 's/@002d/\-/g' | cut -d "/" -f 5- | sed 's/.ibd//g' ); do
+
+           dbname=$(echo $i | cut -d '/' -f 1)
+           tblname=$(echo $i | cut -d '/' -f 2)
+
+           if [ $comma -eq 0 ]; then
+                echo -n ","
+           fi
+           comma=0
+           echo -n "{\"{#DBNAME}\":\"$dbname\",\"{#TABLENAME}\":\"$tblname\"}"
+
+done
+
+echo -n "]}"
diff --git a/bin/mysql_print_table_size.sh b/bin/mysql_print_table_size.sh
new file mode 100644
index 0000000000000000000000000000000000000000..50a7803c6b536ae5fe91154f460a882245675416
--- /dev/null
+++ b/bin/mysql_print_table_size.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+cachefile='/tmp/mysqldbsize.log'
+random=$RANDOM
+
+if [ ! -e $cachefile ]; then
+        touch -d "2 hours ago" $cachefile
+fi
+
+if [ $# -ne 2 ]; then
+  echo "Usage: $0 dbname tablename"
+  exit 1
+fi
+
+cachefileage=$(($(date +%s) - $(stat -c %Y $cachefile)))
+process_running=$(ps aux | grep 'find /var/lib/mysql' | grep -v "grep" | wc -l)
+
+if [ "$cachefileage" -gt 60 ] && [ "$process_running" -eq 0 ]; then
+
+  sudo /bin/find /var/lib/mysql -type f -printf %p+%s= | tr "=" "\n" | grep -v "\/mysql\/mysql\/" | grep "\.ibd" | sed 's/@002d/\-/g' > $cachefile.$random
+
+        if [ $? -eq 0 ]; then
+                mv $cachefile.$random $cachefile
+                chown zabbix.zabbix $cachefile
+        fi
+fi
+
+grep "/$1/" $cachefile | grep "/$2\.ibd" | cut -d "+" -f 2
+
diff --git a/bin/pgsql_find_db.sh b/bin/pgsql_find_db.sh
new file mode 100644
index 0000000000000000000000000000000000000000..c31cbc86b10e730a92dddd53d0e612477719efd4
--- /dev/null
+++ b/bin/pgsql_find_db.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# If you want to monitor "foo" and "bar" databases, you set the GETDB as
+# GETDB="select datname from pg_database where datname in ('foo','bar');"
+# CREATE USER zabbix WITH PASSWORD 'asfrtgrg432f';
+# GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO zabbix;
+
+GETDB="select datname from pg_database where datistemplate = 'f';"
+
+for dbname in $(psql -U zabbix -d postgres -t -c "${GETDB}"); do
+    dblist="$dblist,"'{"{#DBNAME}":"'$dbname'"}'
+done
+echo '{"data":['${dblist#,}' ]}'
\ No newline at end of file
diff --git a/bin/ss_get_mysql_stats.php b/bin/ss_get_mysql_stats.php
index 27d101a47dc5087b94a8fd47592c3c6a08a3d04f..86c7dfea1a8c6bbe1c5260466204431d90a6724a 100644
--- a/bin/ss_get_mysql_stats.php
+++ b/bin/ss_get_mysql_stats.php
@@ -1,24 +1,11 @@
 <?php
 
 # ============================================================================
-# This is a script to retrieve information from a MySQL server for input to a
-# Cacti graphing process.  It is hosted at
-# http://code.google.com/p/mysql-cacti-templates/.
-#
-# This program is copyright (c) 2007 Baron Schwartz. Feedback and improvements
-# are welcome.
-#
-# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation, version 2.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA  02111-1307  USA.
+# This program is part of Percona Monitoring Plugins
+# License: GPL License (see COPYING)
+# Copyright 2008-2015 Baron Schwartz, 2012-2015 Percona
+# Authors:
+#  Baron Schwartz, Roman Vynar
 # ============================================================================
 
 # ============================================================================
@@ -41,19 +28,27 @@ if ( !array_key_exists('SCRIPT_FILENAME', $_SERVER)
 # .cnf extension.
 # ============================================================================
 $mysql_user = 'zabbix';
-$mysql_pass = 'ha7jqnlacwefrs';
+$mysql_pass = 'wJ44mR6a59r3duDr';
 $mysql_port = 3306;
 $mysql_ssl  = FALSE;   # Whether to use SSL to connect to MySQL.
+$mysql_ssl_key  = '/etc/pki/tls/certs/mysql/client-key.pem';
+$mysql_ssl_cert = '/etc/pki/tls/certs/mysql/client-cert.pem';
+$mysql_ssl_ca   = '/etc/pki/tls/certs/mysql/ca-cert.pem';
+
+$heartbeat = FALSE;        # Whether to use pt-heartbeat table for repl. delay calculation.
+$heartbeat_utc = FALSE;    # Whether pt-heartbeat is run with --utc option.
+$heartbeat_server_id = 0;  # Server id to associate with a heartbeat. Leave 0 if no preference.
+$heartbeat_table = 'percona.heartbeat'; # db.tbl.
 
-$heartbeat  = '';      # db.tbl in case you use mk-heartbeat from Maatkit.
 $cache_dir  = '/tmp';  # If set, this uses caching to avoid multiple calls.
 $poll_time  = 300;     # Adjust to match your polling interval.
+$timezone   = null;    # If not set, uses the system default.  Example: "UTC"
 $chk_options = array (
    'innodb'  => true,    # Do you want to check InnoDB statistics?
    'master'  => true,    # Do you want to check binary logging?
    'slave'   => true,    # Do you want to check slave status?
    'procs'   => true,    # Do you want to check SHOW PROCESSLIST?
-   'get_qrt' => true,   # Get query response times from Percona Server?
+   'get_qrt' => true,    # Get query response times from Percona Server or MariaDB?
 );
 
 $use_ss    = FALSE; # Whether to use the script server or not
@@ -63,13 +58,18 @@ $debug_log = FALSE; # If $debug_log is a filename, it'll be used.
 # ============================================================================
 # You should not need to change anything below this line.
 # ============================================================================
-$version = "1.1.8";
+$version = '1.1.5';
 
 # ============================================================================
-# Include settings from an external config file (issue 39).
+# Include settings from an external config file.
 # ============================================================================
-if ( file_exists(__FILE__ . '.cnf' ) ) {
+if ( file_exists('/etc/cacti/' . basename(__FILE__) . '.cnf' ) ) {
+   require('/etc/cacti/' . basename(__FILE__) . '.cnf');
+   debug('Found configuration file /etc/cacti/' . basename(__FILE__) . '.cnf');
+}
+elseif ( file_exists(__FILE__ . '.cnf' ) ) {
    require(__FILE__ . '.cnf');
+   debug('Found configuration file ' . __FILE__ . '.cnf');
 }
 
 # Make this a happy little script even when there are errors.
@@ -104,6 +104,18 @@ if ( $use_ss ) {
    }
 }
 
+# ============================================================================
+# Set the default timezone either to the configured, system timezone, or the
+# default set above in the script.
+# ============================================================================
+if ( function_exists("date_default_timezone_set")
+   && function_exists("date_default_timezone_get") ) {
+   $tz = ($timezone ? $timezone : @date_default_timezone_get());
+   if ( $tz ) {
+      @date_default_timezone_set($tz);
+   }
+}
+
 # ============================================================================
 # Make sure we can also be called as a script.
 # ============================================================================
@@ -156,8 +168,12 @@ if ( !function_exists('array_change_key_case') ) {
 # Validate that the command-line options are here and correct
 # ============================================================================
 function validate_options($options) {
-   debug($options);
-   $opts = array('host', 'items', 'user', 'pass', 'heartbeat', 'nocache', 'port');
+   $opts = array('host', 'items', 'user', 'pass', 'nocache', 'port', 'server-id');
+   # Show help
+   if ( array_key_exists('help', $options) ) {
+      usage('');
+   }
+
    # Required command-line options
    foreach ( array('host', 'items') as $option ) {
       if ( !isset($options[$option]) || !$options[$option] ) {
@@ -175,21 +191,20 @@ function validate_options($options) {
 # Print out a brief usage summary
 # ============================================================================
 function usage($message) {
-   global $mysql_user, $mysql_pass, $mysql_port, $heartbeat;
+   global $mysql_user, $mysql_pass, $mysql_port;
 
    $usage = <<<EOF
 $message
 Usage: php ss_get_mysql_stats.php --host <host> --items <item,...> [OPTION]
 
-   --host      Hostname to connect to; use host:port syntax to specify a port
-               Use :/path/to/socket if you want to connect via a UNIX socket
+   --host      MySQL host
    --items     Comma-separated list of the items whose data you want
-   --user      MySQL username; defaults to $mysql_user if not given
-   --pass      MySQL password; defaults to $mysql_pass if not given
-   --heartbeat MySQL heartbeat table; defaults to '$heartbeat' (see mk-heartbeat)
+   --user      MySQL username
+   --pass      MySQL password
+   --port      MySQL port
+   --server-id Server id to associate with a heartbeat if heartbeat usage is enabled
    --nocache   Do not cache results in a file
-   --port      MySQL port; defaults to $mysql_port if not given
-   --mysql_ssl Add the MYSQL_CLIENT_SSL flag to mysql_connect() call
+   --help      Show usage
 
 EOF;
    die($usage);
@@ -200,39 +215,23 @@ EOF;
 # return them as an array ( arg => value )
 # ============================================================================
 function parse_cmdline( $args ) {
-   $result = array();
-   $cur_arg = '';
-   foreach ($args as $val) {
-      if ( strpos($val, '--') === 0 ) {
-         if ( strpos($val, '--no') === 0 ) {
-            # It's an option without an argument, but it's a --nosomething so
-            # it's OK.
-            $result[substr($val, 2)] = 1;
-            $cur_arg = '';
+   $options = array();
+   while (list($tmp, $p) = each($args)) {
+      if (strpos($p, '--') === 0) {
+         $param = substr($p, 2);
+         $value = null;
+         $nextparam = current($args);
+         if ($nextparam !== false && strpos($nextparam, '--') !==0) {
+            list($tmp, $value) = each($args);
          }
-         elseif ( $cur_arg ) { # Maybe the last --arg was an option with no arg
-            if ( $cur_arg == '--user' || $cur_arg == '--pass' || $cur_arg == '--port' ) {
-               # Special case because Cacti will pass these without an arg
-               $cur_arg = '';
-            }
-            else {
-               die("No arg: $cur_arg\n");
-            }
-         }
-         else {
-            $cur_arg = $val;
-         }
-      }
-      else {
-         $result[substr($cur_arg, 2)] = $val;
-         $cur_arg = '';
+         $options[$param] = $value;
       }
    }
-   if ( $cur_arg && ($cur_arg != '--user' && $cur_arg != '--pass' && $cur_arg != '--port') ) {
-      die("No arg: $cur_arg\n");
+   if ( array_key_exists('host', $options) ) {
+      $options['host'] = substr($options['host'], 0, 4) == 'tcp:' ? substr($options['host'], 4) : $options['host'];
    }
-   debug($result);
-   return $result;
+   debug($options);
+   return $options;
 }
 
 # ============================================================================
@@ -240,43 +239,24 @@ function parse_cmdline( $args ) {
 # top of this file.
 # ============================================================================
 function ss_get_mysql_stats( $options ) {
-   # Process connection options and connect to MySQL.
-   global $debug, $mysql_user, $mysql_pass, $heartbeat, $cache_dir, $poll_time,
-          $chk_options, $mysql_port, $mysql_ssl;
+   # Process connection options.
+   global $debug, $mysql_user, $mysql_pass, $cache_dir, $poll_time, $chk_options,
+          $mysql_port, $mysql_ssl, $mysql_ssl_key, $mysql_ssl_cert, $mysql_ssl_ca,
+          $heartbeat, $heartbeat_table, $heartbeat_server_id, $heartbeat_utc;
 
-   # Connect to MySQL.
    $user = isset($options['user']) ? $options['user'] : $mysql_user;
    $pass = isset($options['pass']) ? $options['pass'] : $mysql_pass;
+   $host = $options['host'];
    $port = isset($options['port']) ? $options['port'] : $mysql_port;
-   $heartbeat = isset($options['heartbeat']) ? $options['heartbeat'] : $heartbeat;
-   # If there is a port, or if it's a non-standard port, we add ":$port" to the
-   # hostname.
-   $host_str  = $options['host']
-              . (isset($options['port']) || $port != 3306 ? ":$port" : '');
-   debug(array('connecting to', $host_str, $user, $pass));
-   if ( !extension_loaded('mysql') ) {
-      debug("The MySQL extension is not loaded");
-      die("The MySQL extension is not loaded");
-   }
-   if ( $mysql_ssl || (isset($options['mysql_ssl']) && $options['mysql_ssl']) ) {
-      $conn = mysql_connect($host_str, $user, $pass, true, MYSQL_CLIENT_SSL);
-   }
-   else {
-      $conn = mysql_connect($host_str, $user, $pass);
-   }
-   if ( !$conn ) {
-      die("MySQL: " . mysql_error());
-   }
+   $heartbeat_server_id = isset($options['server-id']) ? $options['server-id'] : $heartbeat_server_id;
 
-   $sanitized_host
-       = str_replace(array(":", "/"), array("", "_"), $options['host']);
-   $cache_file = "$cache_dir/$sanitized_host-mysql_cacti_stats.txt"
-               . (isset($options['port']) || $port != 3306 ? ":$port" : '');
+   $sanitized_host = str_replace(array(":", "/"), array("", "_"), $host);
+   $cache_file = "$cache_dir/$sanitized_host-mysql_cacti_stats.txt" . ($port != 3306 ? ":$port" : '');
    debug("Cache file is $cache_file");
 
    # First, check the cache.
    $fp = null;
-   if ( !isset($options['nocache']) ) {
+   if ( $cache_dir && !array_key_exists('nocache', $options) ) {
       if ( $fp = fopen($cache_file, 'a+') ) {
          $locked = flock($fp, 1); # LOCK_SH
          if ( $locked ) {
@@ -308,14 +288,36 @@ function ss_get_mysql_stats( $options ) {
             }
          }
          else {
-            debug("Couldn't lock the cache file, ignoring it.");
             $fp = null;
+            debug("Couldn't lock the cache file, ignoring it");
          }
       }
+      else {
+         $fp = null;
+         debug("Couldn't open the cache file");
+      }
    }
    else {
-      $fp = null;
-      debug("Couldn't open the cache file");
+      debug("Caching is disabled.");
+   }
+
+   # Connect to MySQL.
+   debug(array('Connecting to', $host, $port, $user, $pass));
+   if ( !extension_loaded('mysqli') ) {
+      debug("PHP MySQLi extension is not loaded");
+      die("PHP MySQLi extension is not loaded");
+   }
+   if ( $mysql_ssl ) {
+      $conn = mysqli_init();
+      mysqli_ssl_set($conn, $mysql_ssl_key, $mysql_ssl_cert, $mysql_ssl_ca, NULL, NULL);
+      mysqli_real_connect($conn, $host, $user, $pass, NULL, $port);
+   }
+   else {
+      $conn = mysqli_connect($host, $user, $pass, NULL, $port);
+   }
+   if ( mysqli_connect_errno() ) {
+      debug("MySQL connection failed: " . mysqli_connect_error());
+      die("ERROR: " . mysqli_connect_error());
    }
 
    # Set up variables.
@@ -334,22 +336,22 @@ function ss_get_mysql_stats( $options ) {
       'innodb_sem_wait_time_ms'  => 0,
       # Values for the 'state' column from SHOW PROCESSLIST (converted to
       # lowercase, with spaces replaced by underscores)
-      'State_closing_tables'       => null,
-      'State_copying_to_tmp_table' => null,
-      'State_end'                  => null,
-      'State_freeing_items'        => null,
-      'State_init'                 => null,
-      'State_locked'               => null,
-      'State_login'                => null,
-      'State_preparing'            => null,
-      'State_reading_from_net'     => null,
-      'State_sending_data'         => null,
-      'State_sorting_result'       => null,
-      'State_statistics'           => null,
-      'State_updating'             => null,
-      'State_writing_to_net'       => null,
-      'State_none'                 => null,
-      'State_other'                => null, # Everything not listed above
+      'State_closing_tables'       => 0,
+      'State_copying_to_tmp_table' => 0,
+      'State_end'                  => 0,
+      'State_freeing_items'        => 0,
+      'State_init'                 => 0,
+      'State_locked'               => 0,
+      'State_login'                => 0,
+      'State_preparing'            => 0,
+      'State_reading_from_net'     => 0,
+      'State_sending_data'         => 0,
+      'State_sorting_result'       => 0,
+      'State_statistics'           => 0,
+      'State_updating'             => 0,
+      'State_writing_to_net'       => 0,
+      'State_none'                 => 0,
+      'State_other'                => 0, # Everything not listed above
    );
 
    # Get SHOW STATUS and convert the name-value array into a simple
@@ -367,7 +369,14 @@ function ss_get_mysql_stats( $options ) {
 
    # Get SHOW SLAVE STATUS, and add it to the $status array.
    if ( $chk_options['slave'] ) {
-      $result = run_query("SHOW SLAVE STATUS", $conn);
+      # Leverage lock-free SHOW SLAVE STATUS if available
+      $result = run_query("SHOW SLAVE STATUS NONBLOCKING", $conn);
+      if ( !$result ) {
+         $result = run_query("SHOW SLAVE STATUS NOLOCK", $conn);
+         if ( !$result ) {
+            $result = run_query("SHOW SLAVE STATUS", $conn);
+         }
+      }
       $slave_status_rows_gotten = 0;
       foreach ( $result as $row ) {
          $slave_status_rows_gotten++;
@@ -379,9 +388,16 @@ function ss_get_mysql_stats( $options ) {
 
          # Check replication heartbeat, if present.
          if ( $heartbeat ) {
+            if ( $heartbeat_utc ) {
+               $now_func = 'UNIX_TIMESTAMP(UTC_TIMESTAMP)';
+            }
+            else {
+               $now_func = 'UNIX_TIMESTAMP()';
+            }
             $result2 = run_query(
-               "SELECT GREATEST(0, UNIX_TIMESTAMP() - UNIX_TIMESTAMP(ts) - 1)"
-               . " AS delay FROM $heartbeat WHERE id = 1", $conn);
+               "SELECT MAX($now_func - ROUND(UNIX_TIMESTAMP(ts)))"
+               . " AS delay FROM $heartbeat_table"
+               . " WHERE $heartbeat_server_id = 0 OR server_id = $heartbeat_server_id", $conn);
             $slave_delay_rows_gotten = 0;
             foreach ( $result2 as $row2 ) {
                $slave_delay_rows_gotten++;
@@ -391,7 +407,7 @@ function ss_get_mysql_stats( $options ) {
                   $status['slave_lag'] = $row2['delay'];
                }
                else {
-                  debug("Couldn't get slave lag from $heartbeat");
+                  debug("Couldn't get slave lag from $heartbeat_table");
                }
             }
             if ( $slave_delay_rows_gotten == 0 ) {
@@ -443,6 +459,10 @@ function ss_get_mysql_stats( $options ) {
          if ( $state == '' ) {
             $state = 'none';
          }
+         # MySQL 5.5 replaces the 'Locked' state with a variety of "Waiting for
+         # X lock" types of statuses.  Wrap these all back into "Locked" because
+         # we don't really care about the type of locking it is.
+         $state = preg_replace('/^(Table lock|Waiting for .*lock)$/', 'Locked', $state);
          $state = str_replace(' ', '_', strtolower($state));
          if ( array_key_exists("State_$state", $status) ) {
             increment($status, "State_$state", 1);
@@ -453,35 +473,59 @@ function ss_get_mysql_stats( $options ) {
       }
    }
 
+   # Get SHOW ENGINES to be able to determine whether InnoDB is present.
+   $engines = array();
+   $result = run_query("SHOW ENGINES", $conn);
+   foreach ( $result as $row ) {
+      $engines[$row[0]] = $row[1];
+   }
+
    # Get SHOW INNODB STATUS and extract the desired metrics from it, then add
    # those to the array too.
    if ( $chk_options['innodb']
-         && array_key_exists('have_innodb', $status)
-         && $status['have_innodb'] == 'YES'
+         && array_key_exists('InnoDB', $engines)
+         && $engines['InnoDB'] == 'YES'
+         || $engines['InnoDB'] == 'DEFAULT'
    ) {
       $result        = run_query("SHOW /*!50000 ENGINE*/ INNODB STATUS", $conn);
       $istatus_text = $result[0]['Status'];
       $istatus_vals = get_innodb_array($istatus_text);
 
-      # Get response time histogram from Percona Server if enabled.
+      # Get response time histogram from Percona Server or MariaDB if enabled.
       if ( $chk_options['get_qrt']
-           && isset($status['have_response_time_distribution']) 
-           &&      ($status['have_response_time_distribution'] == 'YES'))
+           && (( isset($status['have_response_time_distribution'])
+           && $status['have_response_time_distribution'] == 'YES')
+           || (isset($status['query_response_time_stats'])
+           && $status['query_response_time_stats'] == 'ON')) )
       {
          debug('Getting query time histogram');
          $i = 0;
          $result = run_query(
-            "SELECT `count`, total * 1000000 AS total "
+            "SELECT `count`, ROUND(total * 1000000) AS total "
                . "FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME "
                . "WHERE `time` <> 'TOO LONG'",
             $conn);
          foreach ( $result as $row ) {
+            if ( $i > 13 ) {
+               # It's possible that the number of rows returned isn't 14.
+               # Don't add extra status counters.
+               break;
+            }
             $count_key = sprintf("Query_time_count_%02d", $i);
             $total_key = sprintf("Query_time_total_%02d", $i);
             $status[$count_key] = $row['count'];
             $status[$total_key] = $row['total'];
             $i++;
          }
+         # It's also possible that the number of rows returned is too few.
+         # Don't leave any status counters unassigned; it will break graphs.
+         while ( $i <= 13 ) {
+            $count_key = sprintf("Query_time_count_%02d", $i);
+            $total_key = sprintf("Query_time_total_%02d", $i);
+            $status[$count_key] = 0;
+            $status[$total_key] = 0;
+            $i++;
+         }
       }
       else {
          debug('Not getting time histogram because it is not enabled');
@@ -506,6 +550,8 @@ function ss_get_mysql_stats( $options ) {
          'Innodb_rows_inserted'           => 'rows_inserted',
          'Innodb_rows_read'               => 'rows_read',
          'Innodb_rows_updated'            => 'rows_updated',
+         'Innodb_buffer_pool_reads'       => 'pool_reads',
+         'Innodb_buffer_pool_read_requests' => 'pool_read_requests',
       );
 
       # If the SHOW STATUS value exists, override...
@@ -548,204 +594,221 @@ function ss_get_mysql_stats( $options ) {
    }
 
    # Define the variables to output.  I use shortened variable names so maybe
-   # it'll all fit in 1024 bytes for Cactid and Spine's benefit.  This list must
-   # come right after the word MAGIC_VARS_DEFINITIONS.  The Perl script parses
-   # it and uses it as a Perl variable.
+   # it'll all fit in 1024 bytes for Cactid and Spine's benefit.  Strings must
+   # have some non-hex characters (non a-f0-9) to avoid a Cacti bug.  This list
+   # must come right after the word MAGIC_VARS_DEFINITIONS.  The Perl script
+   # parses it and uses it as a Perl variable.
    $keys = array(
-       'Key_read_requests'          => 'a0',
-       'Key_reads'                  => 'a1',
-       'Key_write_requests'         => 'a2',
-       'Key_writes'                 => 'a3',
-       'history_list'               => 'a4',
-       'innodb_transactions'        => 'a5',
-       'read_views'                 => 'a6',
-       'current_transactions'       => 'a7',
-       'locked_transactions'        => 'a8',
-       'active_transactions'        => 'a9',
-       'pool_size'                  => 'aa',
-       'free_pages'                 => 'ab',
-       'database_pages'             => 'ac',
-       'modified_pages'             => 'ad',
-       'pages_read'                 => 'ae',
-       'pages_created'              => 'af',
-       'pages_written'              => 'ag',
-       'file_fsyncs'                => 'ah',
-       'file_reads'                 => 'ai',
-       'file_writes'                => 'aj',
-       'log_writes'                 => 'ak',
-       'pending_aio_log_ios'        => 'al',
-       'pending_aio_sync_ios'       => 'am',
-       'pending_buf_pool_flushes'   => 'an',
-       'pending_chkp_writes'        => 'ao',
-       'pending_ibuf_aio_reads'     => 'ap',
-       'pending_log_flushes'        => 'aq',
-       'pending_log_writes'         => 'ar',
-       'pending_normal_aio_reads'   => 'as',
-       'pending_normal_aio_writes'  => 'at',
-       'ibuf_inserts'               => 'au',
-       'ibuf_merged'                => 'av',
-       'ibuf_merges'                => 'aw',
-       'spin_waits'                 => 'ax',
-       'spin_rounds'                => 'ay',
-       'os_waits'                   => 'az',
-       'rows_inserted'              => 'b0',
-       'rows_updated'               => 'b1',
-       'rows_deleted'               => 'b2',
-       'rows_read'                  => 'b3',
-       'Table_locks_waited'         => 'b4',
-       'Table_locks_immediate'      => 'b5',
-       'Slow_queries'               => 'b6',
-       'Open_files'                 => 'b7',
-       'Open_tables'                => 'b8',
-       'Opened_tables'              => 'b9',
-       'innodb_open_files'          => 'ba',
-       'open_files_limit'           => 'bb',
-       'table_cache'                => 'bc',
-       'Aborted_clients'            => 'bd',
-       'Aborted_connects'           => 'be',
-       'Max_used_connections'       => 'bf',
-       'Slow_launch_threads'        => 'bg',
-       'Threads_cached'             => 'bh',
-       'Threads_connected'          => 'bi',
-       'Threads_created'            => 'bj',
-       'Threads_running'            => 'bk',
-       'max_connections'            => 'bl',
-       'thread_cache_size'          => 'bm',
-       'Connections'                => 'bn',
-       'slave_running'              => 'bo',
-       'slave_stopped'              => 'bp',
-       'Slave_retried_transactions' => 'bq',
-       'slave_lag'                  => 'br',
-       'Slave_open_temp_tables'     => 'bs',
-       'Qcache_free_blocks'         => 'bt',
-       'Qcache_free_memory'         => 'bu',
-       'Qcache_hits'                => 'bv',
-       'Qcache_inserts'             => 'bw',
-       'Qcache_lowmem_prunes'       => 'bx',
-       'Qcache_not_cached'          => 'by',
-       'Qcache_queries_in_cache'    => 'bz',
-       'Qcache_total_blocks'        => 'c0',
-       'query_cache_size'           => 'c1',
-       'Questions'                  => 'c2',
-       'Com_update'                 => 'c3',
-       'Com_insert'                 => 'c4',
-       'Com_select'                 => 'c5',
-       'Com_delete'                 => 'c6',
-       'Com_replace'                => 'c7',
-       'Com_load'                   => 'c8',
-       'Com_update_multi'           => 'c9',
-       'Com_insert_select'          => 'ca',
-       'Com_delete_multi'           => 'cb',
-       'Com_replace_select'         => 'cc',
-       'Select_full_join'           => 'cd',
-       'Select_full_range_join'     => 'ce',
-       'Select_range'               => 'cf',
-       'Select_range_check'         => 'cg',
-       'Select_scan'                => 'ch',
-       'Sort_merge_passes'          => 'ci',
-       'Sort_range'                 => 'cj',
-       'Sort_rows'                  => 'ck',
-       'Sort_scan'                  => 'cl',
-       'Created_tmp_tables'         => 'cm',
-       'Created_tmp_disk_tables'    => 'cn',
-       'Created_tmp_files'          => 'co',
-       'Bytes_sent'                 => 'cp',
-       'Bytes_received'             => 'cq',
-       'innodb_log_buffer_size'     => 'cr',
-       'unflushed_log'              => 'cs',
-       'log_bytes_flushed'          => 'ct',
-       'log_bytes_written'          => 'cu',
-       'relay_log_space'            => 'cv',
-       'binlog_cache_size'          => 'cw',
-       'Binlog_cache_disk_use'      => 'cx',
-       'Binlog_cache_use'           => 'cy',
-       'binary_log_space'           => 'cz',
-       'innodb_locked_tables'       => 'd0',
-       'innodb_lock_structs'        => 'd1',
-       'State_closing_tables'       => 'd2',
-       'State_copying_to_tmp_table' => 'd3',
-       'State_end'                  => 'd4',
-       'State_freeing_items'        => 'd5',
-       'State_init'                 => 'd6',
-       'State_locked'               => 'd7',
-       'State_login'                => 'd8',
-       'State_preparing'            => 'd9',
-       'State_reading_from_net'     => 'da',
-       'State_sending_data'         => 'db',
-       'State_sorting_result'       => 'dc',
-       'State_statistics'           => 'dd',
-       'State_updating'             => 'de',
-       'State_writing_to_net'       => 'df',
-       'State_none'                 => 'dg',
-       'State_other'                => 'dh',
-       'Handler_commit'             => 'di',
-       'Handler_delete'             => 'dj',
-       'Handler_discover'           => 'dk',
-       'Handler_prepare'            => 'dl',
-       'Handler_read_first'         => 'dm',
-       'Handler_read_key'           => 'dn',
-       'Handler_read_next'          => 'do',
-       'Handler_read_prev'          => 'dp',
-       'Handler_read_rnd'           => 'dq',
-       'Handler_read_rnd_next'      => 'dr',
-       'Handler_rollback'           => 'ds',
-       'Handler_savepoint'          => 'dt',
-       'Handler_savepoint_rollback' => 'du',
-       'Handler_update'             => 'dv',
-       'Handler_write'              => 'dw',
-       # Some InnoDB stats added later...
-       'innodb_tables_in_use'    => 'dx',
-       'innodb_lock_wait_secs'   => 'dy',
-       'hash_index_cells_total'  => 'dz',
-       'hash_index_cells_used'   => 'e0',
-       'total_mem_alloc'         => 'e1',
-       'additional_pool_alloc'   => 'e2',
-       'uncheckpointed_bytes'    => 'e3',
-       'ibuf_used_cells'         => 'e4',
-       'ibuf_free_cells'         => 'e5',
-       'ibuf_cell_count'         => 'e6',
-      'adaptive_hash_memory'    => 'e7',
-      'page_hash_memory'        => 'e8',
-      'dictionary_cache_memory' => 'e9',
-      'file_system_memory'      => 'ea',
-      'lock_system_memory'      => 'eb',
-      'recovery_system_memory'  => 'ec',
-      'thread_hash_memory'      => 'ed',
-      'innodb_sem_waits'        => 'ee',
-      'innodb_sem_wait_time_ms' => 'ef',
-      'Key_buf_bytes_unflushed' => 'eg',
-      'Key_buf_bytes_used'      => 'eh',
-      'key_buffer_size'         => 'ei',
-      'Innodb_row_lock_time'    => 'ej',
-      'Innodb_row_lock_waits'   => 'ek',
-      'Query_time_count_00'     => 'el',
-      'Query_time_count_01'     => 'em',
-      'Query_time_count_02'     => 'en',
-      'Query_time_count_03'     => 'eo',
-      'Query_time_count_04'     => 'ep',
-      'Query_time_count_05'     => 'eq',
-      'Query_time_count_06'     => 'er',
-      'Query_time_count_07'     => 'es',
-      'Query_time_count_08'     => 'et',
-      'Query_time_count_09'     => 'eu',
-      'Query_time_count_10'     => 'ev',
-      'Query_time_count_11'     => 'ew',
-      'Query_time_count_12'     => 'ex',
-      'Query_time_count_13'     => 'ey',
-      'Query_time_total_00'     => 'ez',
-      'Query_time_total_01'     => 'fa',
-      'Query_time_total_02'     => 'fb',
-      'Query_time_total_03'     => 'fc',
-      'Query_time_total_04'     => 'fd',
-      'Query_time_total_05'     => 'fe',
-      'Query_time_total_06'     => 'ff',
-      'Query_time_total_07'     => 'fg',
-      'Query_time_total_08'     => 'fh',
-      'Query_time_total_09'     => 'fi',
-      'Query_time_total_10'     => 'fj',
-      'Query_time_total_11'     => 'fk',
-      'Query_time_total_12'     => 'fl',
-      'Query_time_total_13'     => 'fm',
+      'Key_read_requests'           =>  'gg',
+      'Key_reads'                   =>  'gh',
+      'Key_write_requests'          =>  'gi',
+      'Key_writes'                  =>  'gj',
+      'history_list'                =>  'gk',
+      'innodb_transactions'         =>  'gl',
+      'read_views'                  =>  'gm',
+      'current_transactions'        =>  'gn',
+      'locked_transactions'         =>  'go',
+      'active_transactions'         =>  'gp',
+      'pool_size'                   =>  'gq',
+      'free_pages'                  =>  'gr',
+      'database_pages'              =>  'gs',
+      'modified_pages'              =>  'gt',
+      'pages_read'                  =>  'gu',
+      'pages_created'               =>  'gv',
+      'pages_written'               =>  'gw',
+      'file_fsyncs'                 =>  'gx',
+      'file_reads'                  =>  'gy',
+      'file_writes'                 =>  'gz',
+      'log_writes'                  =>  'hg',
+      'pending_aio_log_ios'         =>  'hh',
+      'pending_aio_sync_ios'        =>  'hi',
+      'pending_buf_pool_flushes'    =>  'hj',
+      'pending_chkp_writes'         =>  'hk',
+      'pending_ibuf_aio_reads'      =>  'hl',
+      'pending_log_flushes'         =>  'hm',
+      'pending_log_writes'          =>  'hn',
+      'pending_normal_aio_reads'    =>  'ho',
+      'pending_normal_aio_writes'   =>  'hp',
+      'ibuf_inserts'                =>  'hq',
+      'ibuf_merged'                 =>  'hr',
+      'ibuf_merges'                 =>  'hs',
+      'spin_waits'                  =>  'ht',
+      'spin_rounds'                 =>  'hu',
+      'os_waits'                    =>  'hv',
+      'rows_inserted'               =>  'hw',
+      'rows_updated'                =>  'hx',
+      'rows_deleted'                =>  'hy',
+      'rows_read'                   =>  'hz',
+      'Table_locks_waited'          =>  'ig',
+      'Table_locks_immediate'       =>  'ih',
+      'Slow_queries'                =>  'ii',
+      'Open_files'                  =>  'ij',
+      'Open_tables'                 =>  'ik',
+      'Opened_tables'               =>  'il',
+      'innodb_open_files'           =>  'im',
+      'open_files_limit'            =>  'in',
+      'table_cache'                 =>  'io',
+      'Aborted_clients'             =>  'ip',
+      'Aborted_connects'            =>  'iq',
+      'Max_used_connections'        =>  'ir',
+      'Slow_launch_threads'         =>  'is',
+      'Threads_cached'              =>  'it',
+      'Threads_connected'           =>  'iu',
+      'Threads_created'             =>  'iv',
+      'Threads_running'             =>  'iw',
+      'max_connections'             =>  'ix',
+      'thread_cache_size'           =>  'iy',
+      'Connections'                 =>  'iz',
+      'slave_running'               =>  'jg',
+      'slave_stopped'               =>  'jh',
+      'Slave_retried_transactions'  =>  'ji',
+      'slave_lag'                   =>  'jj',
+      'Slave_open_temp_tables'      =>  'jk',
+      'Qcache_free_blocks'          =>  'jl',
+      'Qcache_free_memory'          =>  'jm',
+      'Qcache_hits'                 =>  'jn',
+      'Qcache_inserts'              =>  'jo',
+      'Qcache_lowmem_prunes'        =>  'jp',
+      'Qcache_not_cached'           =>  'jq',
+      'Qcache_queries_in_cache'     =>  'jr',
+      'Qcache_total_blocks'         =>  'js',
+      'query_cache_size'            =>  'jt',
+      'Questions'                   =>  'ju',
+      'Com_update'                  =>  'jv',
+      'Com_insert'                  =>  'jw',
+      'Com_select'                  =>  'jx',
+      'Com_delete'                  =>  'jy',
+      'Com_replace'                 =>  'jz',
+      'Com_load'                    =>  'kg',
+      'Com_update_multi'            =>  'kh',
+      'Com_insert_select'           =>  'ki',
+      'Com_delete_multi'            =>  'kj',
+      'Com_replace_select'          =>  'kk',
+      'Select_full_join'            =>  'kl',
+      'Select_full_range_join'      =>  'km',
+      'Select_range'                =>  'kn',
+      'Select_range_check'          =>  'ko',
+      'Select_scan'                 =>  'kp',
+      'Sort_merge_passes'           =>  'kq',
+      'Sort_range'                  =>  'kr',
+      'Sort_rows'                   =>  'ks',
+      'Sort_scan'                   =>  'kt',
+      'Created_tmp_tables'          =>  'ku',
+      'Created_tmp_disk_tables'     =>  'kv',
+      'Created_tmp_files'           =>  'kw',
+      'Bytes_sent'                  =>  'kx',
+      'Bytes_received'              =>  'ky',
+      'innodb_log_buffer_size'      =>  'kz',
+      'unflushed_log'               =>  'lg',
+      'log_bytes_flushed'           =>  'lh',
+      'log_bytes_written'           =>  'li',
+      'relay_log_space'             =>  'lj',
+      'binlog_cache_size'           =>  'lk',
+      'Binlog_cache_disk_use'       =>  'll',
+      'Binlog_cache_use'            =>  'lm',
+      'binary_log_space'            =>  'ln',
+      'innodb_locked_tables'        =>  'lo',
+      'innodb_lock_structs'         =>  'lp',
+      'State_closing_tables'        =>  'lq',
+      'State_copying_to_tmp_table'  =>  'lr',
+      'State_end'                   =>  'ls',
+      'State_freeing_items'         =>  'lt',
+      'State_init'                  =>  'lu',
+      'State_locked'                =>  'lv',
+      'State_login'                 =>  'lw',
+      'State_preparing'             =>  'lx',
+      'State_reading_from_net'      =>  'ly',
+      'State_sending_data'          =>  'lz',
+      'State_sorting_result'        =>  'mg',
+      'State_statistics'            =>  'mh',
+      'State_updating'              =>  'mi',
+      'State_writing_to_net'        =>  'mj',
+      'State_none'                  =>  'mk',
+      'State_other'                 =>  'ml',
+      'Handler_commit'              =>  'mm',
+      'Handler_delete'              =>  'mn',
+      'Handler_discover'            =>  'mo',
+      'Handler_prepare'             =>  'mp',
+      'Handler_read_first'          =>  'mq',
+      'Handler_read_key'            =>  'mr',
+      'Handler_read_next'           =>  'ms',
+      'Handler_read_prev'           =>  'mt',
+      'Handler_read_rnd'            =>  'mu',
+      'Handler_read_rnd_next'       =>  'mv',
+      'Handler_rollback'            =>  'mw',
+      'Handler_savepoint'           =>  'mx',
+      'Handler_savepoint_rollback'  =>  'my',
+      'Handler_update'              =>  'mz',
+      'Handler_write'               =>  'ng',
+      'innodb_tables_in_use'        =>  'nh',
+      'innodb_lock_wait_secs'       =>  'ni',
+      'hash_index_cells_total'      =>  'nj',
+      'hash_index_cells_used'       =>  'nk',
+      'total_mem_alloc'             =>  'nl',
+      'additional_pool_alloc'       =>  'nm',
+      'uncheckpointed_bytes'        =>  'nn',
+      'ibuf_used_cells'             =>  'no',
+      'ibuf_free_cells'             =>  'np',
+      'ibuf_cell_count'             =>  'nq',
+      'adaptive_hash_memory'        =>  'nr',
+      'page_hash_memory'            =>  'ns',
+      'dictionary_cache_memory'     =>  'nt',
+      'file_system_memory'          =>  'nu',
+      'lock_system_memory'          =>  'nv',
+      'recovery_system_memory'      =>  'nw',
+      'thread_hash_memory'          =>  'nx',
+      'innodb_sem_waits'            =>  'ny',
+      'innodb_sem_wait_time_ms'     =>  'nz',
+      'Key_buf_bytes_unflushed'     =>  'og',
+      'Key_buf_bytes_used'          =>  'oh',
+      'key_buffer_size'             =>  'oi',
+      'Innodb_row_lock_time'        =>  'oj',
+      'Innodb_row_lock_waits'       =>  'ok',
+      'Query_time_count_00'         =>  'ol',
+      'Query_time_count_01'         =>  'om',
+      'Query_time_count_02'         =>  'on',
+      'Query_time_count_03'         =>  'oo',
+      'Query_time_count_04'         =>  'op',
+      'Query_time_count_05'         =>  'oq',
+      'Query_time_count_06'         =>  'or',
+      'Query_time_count_07'         =>  'os',
+      'Query_time_count_08'         =>  'ot',
+      'Query_time_count_09'         =>  'ou',
+      'Query_time_count_10'         =>  'ov',
+      'Query_time_count_11'         =>  'ow',
+      'Query_time_count_12'         =>  'ox',
+      'Query_time_count_13'         =>  'oy',
+      'Query_time_total_00'         =>  'oz',
+      'Query_time_total_01'         =>  'pg',
+      'Query_time_total_02'         =>  'ph',
+      'Query_time_total_03'         =>  'pi',
+      'Query_time_total_04'         =>  'pj',
+      'Query_time_total_05'         =>  'pk',
+      'Query_time_total_06'         =>  'pl',
+      'Query_time_total_07'         =>  'pm',
+      'Query_time_total_08'         =>  'pn',
+      'Query_time_total_09'         =>  'po',
+      'Query_time_total_10'         =>  'pp',
+      'Query_time_total_11'         =>  'pq',
+      'Query_time_total_12'         =>  'pr',
+      'Query_time_total_13'         =>  'ps',
+      'wsrep_replicated_bytes'      =>  'pt',
+      'wsrep_received_bytes'        =>  'pu',
+      'wsrep_replicated'            =>  'pv',
+      'wsrep_received'              =>  'pw',
+      'wsrep_local_cert_failures'   =>  'px',
+      'wsrep_local_bf_aborts'       =>  'py',
+      'wsrep_local_send_queue'      =>  'pz',
+      'wsrep_local_recv_queue'      =>  'qg',
+      'wsrep_cluster_size'          =>  'qh',
+      'wsrep_cert_deps_distance'    =>  'qi',
+      'wsrep_apply_window'          =>  'qj',
+      'wsrep_commit_window'         =>  'qk',
+      'wsrep_flow_control_paused'   =>  'ql',
+      'wsrep_flow_control_sent'     =>  'qm',
+      'wsrep_flow_control_recv'     =>  'qn',
+      'pool_reads'                  =>  'qo',
+      'pool_read_requests'          =>  'qp',
    );
 
    # Return the output.
@@ -846,13 +909,26 @@ function get_innodb_array($text) {
          $results['spin_rounds'][] = to_int($row[5]);
          $results['os_waits'][]    = to_int($row[8]);
       }
-      elseif (strpos($line, 'RW-shared spins') === 0 ) {
+      elseif (strpos($line, 'RW-shared spins') === 0
+            && strpos($line, ';') > 0 ) {
          # RW-shared spins 3859028, OS waits 2100750; RW-excl spins 4641946, OS waits 1530310
          $results['spin_waits'][] = to_int($row[2]);
          $results['spin_waits'][] = to_int($row[8]);
          $results['os_waits'][]   = to_int($row[5]);
          $results['os_waits'][]   = to_int($row[11]);
       }
+      elseif (strpos($line, 'RW-shared spins') === 0 && strpos($line, '; RW-excl spins') === FALSE) {
+         # Post 5.5.17 SHOW ENGINE INNODB STATUS syntax
+         # RW-shared spins 604733, rounds 8107431, OS waits 241268
+         $results['spin_waits'][] = to_int($row[2]);
+         $results['os_waits'][]   = to_int($row[7]);
+      }
+      elseif (strpos($line, 'RW-excl spins') === 0) {
+         # Post 5.5.17 SHOW ENGINE INNODB STATUS syntax
+         # RW-excl spins 604733, rounds 8107431, OS waits 241268
+         $results['spin_waits'][] = to_int($row[2]);
+         $results['os_waits'][]   = to_int($row[7]);
+      }
       elseif (strpos($line, 'seconds the semaphore:') > 0) {
          # --Thread 907205 has waited at handler/ha_innodb.cc line 7156 for 1.00 seconds the semaphore:
          increment($results, 'innodb_sem_waits', 1);
@@ -866,7 +942,8 @@ function get_innodb_array($text) {
          # transactions
          # Trx id counter 0 1170664159
          # Trx id counter 861B144C
-         $results['innodb_transactions'] = make_bigint($row[3], $row[4]);
+         $results['innodb_transactions'] = make_bigint(
+            $row[3], (isset($row[4]) ? $row[4] : null));
          $txn_seen = TRUE;
       }
       elseif ( strpos($line, 'Purge done for trx') === 0 ) {
@@ -952,6 +1029,16 @@ function get_innodb_array($text) {
          $results['ibuf_used_cells']  = to_int($row[2]);
          $results['ibuf_free_cells']  = to_int($row[6]);
          $results['ibuf_cell_count']  = to_int($row[9]);
+         if (strpos($line, 'merges')) {
+            $results['ibuf_merges']  = to_int($row[10]);
+         }
+      }
+      elseif (strpos($line, ', delete mark ') > 0 && strpos($prev_line, 'merged operations:') === 0 ) {
+         # Output of show engine innodb status has changed in 5.5
+         # merged operations:
+         # insert 593983, delete mark 387006, delete 73092
+         $results['ibuf_inserts'] = to_int($row[1]);
+         $results['ibuf_merged']  = to_int($row[1]) + to_int($row[4]) + to_int($row[6]);
       }
       elseif (strpos($line, ' merged recs, ') > 0 ) {
          # 19817685 inserts, 19817684 merged recs, 3552620 merges
@@ -1007,8 +1094,9 @@ function get_innodb_array($text) {
       }
 
       # BUFFER POOL AND MEMORY
-      elseif (strpos($line, "Total memory allocated") === 0 ) {
+      elseif (strpos($line, "Total memory allocated") === 0 && strpos($line, "in additional pool allocated") > 0 ) {
          # Total memory allocated 29642194944; in additional pool allocated 0
+         # Total memory allocated by read views 96
          $results['total_mem_alloc']       = to_int($row[3]);
          $results['additional_pool_alloc'] = to_int($row[8]);
       }
@@ -1088,6 +1176,7 @@ function get_innodb_array($text) {
          $results['queries_inside'] = to_int($row[0]);
          $results['queries_queued'] = to_int($row[4]);
       }
+      $prev_line = $line;
    }
 
    foreach ( array('spin_waits', 'spin_rounds', 'os_waits') as $key ) {
@@ -1144,23 +1233,29 @@ function to_int ( $str ) {
 }
 
 # ============================================================================
-# Wrap mysql_query in error-handling, and instead of returning the result,
+# Wrap mysqli_query in error-handling, and instead of returning the result,
 # return an array of arrays in the result.
 # ============================================================================
 function run_query($sql, $conn) {
    global $debug;
    debug($sql);
-   $result = @mysql_query($sql, $conn);
-   if ( $debug ) {
-      $error = @mysql_error($conn);
+   $result = @mysqli_query($conn, $sql);
+   if ( $debug && strpos($sql, 'SHOW SLAVE STATUS ') === false ) {
+      $error = @mysqli_error($conn);
       if ( $error ) {
          debug(array($sql, $error));
          die("SQLERR $error in $sql");
       }
    }
    $array = array();
-   while ( $row = @mysql_fetch_array($result) ) {
-      $array[] = $row;
+   $count = @mysqli_num_rows($result);
+   if ( $count > 10000 ) {
+      debug('Abnormal number of rows returned: ' . $count);
+   }
+   else {
+      while ( $row = @mysqli_fetch_array($result) ) {
+         $array[] = $row;
+      }
    }
    debug(array($sql, $array));
    return $array;
@@ -1268,7 +1363,7 @@ function debug($val) {
       if ( !count($calls) ) {
          $calls[] = "at $file:$line";
       }
-      fwrite($fp, date('Y-m-d h:i:s') . ' ' . implode(' <- ', $calls));
+      fwrite($fp, date('Y-m-d H:i:s') . ' ' . implode(' <- ', $calls));
       fwrite($fp, "\n" . var_export($val, TRUE) . "\n");
       fclose($fp);
    }
@@ -1278,4 +1373,3 @@ function debug($val) {
    }
 }
 
-?>
diff --git a/bin/swap_enabled.sh b/bin/swap_enabled.sh
new file mode 100644
index 0000000000000000000000000000000000000000..8f20e8a35e2d73cfb09b53b3c339d5b4f4cd9bcc
--- /dev/null
+++ b/bin/swap_enabled.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+swap=$(free -m | grep -i swap | awk '{ print $2 }')
+
+if [ "$swap" != "0" ]; then
+   echo '{"data":[{"{#TOTAL}":"total", "{#FREE}":"free", "{#PFREE}":"pfree", "{#PUSED}":"pused"  } ]}'
+fi
diff --git a/sudoers.d/zabbix b/sudoers.d/zabbix
index d131954bff46e851f0bb183ac8715e7f5b1fcb5c..3cd5afffb4dcc4daf60ec7b42a525ca7596c2a87 100644
--- a/sudoers.d/zabbix
+++ b/sudoers.d/zabbix
@@ -9,4 +9,10 @@ zabbix ALL=(ALL) NOPASSWD: /opt/dell/srvadmin/bin/omreport
 zabbix ALL=(ALL) NOPASSWD: /usr/bin/bcu
 zabbix ALL=(ALL) NOPASSWD: /sbin/powermt
 zabbix ALL=(ALL) NOPASSWD: /bin/find /var/spool/postfix/ -type f
+zabbix ALL=(ALL) NOPASSWD: /usr/sbin/httpd -v
+zabbix ALL=(ALL) NOPASSWD: /usr/sbin/dmidecode
+zabbix ALL=(ALL) NOPASSWD: /usr/bin/stat
+zabbix ALL=(ALL) NOPASSWD: /usr/bin/md5sum
+zabbix ALL=(ALL) NOPASSWD: /bin/find /var/lib/mysql/ -type f -printf %p+%s=
+zabbix ALL=(ALL) NOPASSWD: /etc/zabbix/bin/haproxy.sh
 Defaults:zabbix        !requiretty
diff --git a/templates/Template App MySQL.xml b/templates/Template App MySQL.xml
index 9c06606030d6e706d22d88c3c5aa254d501f92a9..c31dc516852dc59b32f0889a01a3a9d73f325a31 100644
--- a/templates/Template App MySQL.xml	
+++ b/templates/Template App MySQL.xml	
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <zabbix_export>
     <version>3.0</version>
-    <date>2016-05-02T08:36:10Z</date>
+    <date>2016-05-02T12:01:10Z</date>
     <groups>
         <group>
             <name>Templates</name>
diff --git a/templates/Template App Postfix.xml b/templates/Template App Postfix.xml
index f974cfe98500ad85e93e155096bb2e0298ca0252..659583ed2dd10c8b5cefd960e83cadd60139ac95 100644
--- a/templates/Template App Postfix.xml	
+++ b/templates/Template App Postfix.xml	
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <zabbix_export>
     <version>3.0</version>
-    <date>2016-05-02T08:42:40Z</date>
+    <date>2016-05-02T12:00:46Z</date>
     <groups>
         <group>
             <name>Zabbix Templates</name>
diff --git a/templates/Template_App_Redis.xml b/templates/Template App Redis.xml
similarity index 98%
rename from templates/Template_App_Redis.xml
rename to templates/Template App Redis.xml
index 3b7fc786066eee06eb0a5ba75e447bd0d7948454..d8c2b44bbf03e0e4bd36e658e67ac8bc77146fc2 100644
--- a/templates/Template_App_Redis.xml
+++ b/templates/Template App Redis.xml	
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <zabbix_export>
-    <version>2.0</version>
-    <date>2016-01-28T14:13:31Z</date>
+    <version>3.0</version>
+    <date>2016-05-02T08:43:28Z</date>
     <groups>
         <group>
             <name>Zabbix Templates</name>
@@ -67,13 +67,13 @@
                     <logtimefmt/>
                 </item>
                 <item>
-                    <name>[Redis] $1</name>
+                    <name>[Redis] server is running</name>
                     <type>0</type>
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[repl_backlog_active]</key>
-                    <delay>60</delay>
+                    <key>net.tcp.port[,6379]</key>
+                    <delay>30</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
@@ -106,16 +106,18 @@
                             <name>Redis</name>
                         </application>
                     </applications>
-                    <valuemap/>
+                    <valuemap>
+                        <name>Service state</name>
+                    </valuemap>
                     <logtimefmt/>
                 </item>
                 <item>
-                    <name>[Redis] $1</name>
+                    <name>[Redis] ping test</name>
                     <type>0</type>
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[rejected_connections]</key>
+                    <key>redis-ping</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -135,7 +137,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>0</data_type>
+                    <data_type>3</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -153,17 +155,17 @@
                     <logtimefmt/>
                 </item>
                 <item>
-                    <name>[Redis] $1</name>
+                    <name>Redis version</name>
                     <type>0</type>
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[repl_backlog_first_byte_offset]</key>
-                    <delay>60</delay>
-                    <history>30</history>
-                    <trends>365</trends>
+                    <key>redis.version</key>
+                    <delay>3600</delay>
+                    <history>7</history>
+                    <trends>0</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>1</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -201,12 +203,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[repl_backlog_size]</key>
+                    <key>redis[aof_current_rewrite_time_sec]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -244,12 +246,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[role]</key>
-                    <delay>3600</delay>
+                    <key>redis[aof_enabled]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>4</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -264,7 +266,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>0</data_type>
+                    <data_type>3</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -287,10 +289,10 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[redis_mode]</key>
-                    <delay>3600</delay>
+                    <key>redis[aof_last_bgrewrite_status]</key>
+                    <delay>30</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
                     <value_type>4</value_type>
                     <allowed_hosts/>
@@ -330,12 +332,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[repl_backlog_histlen]</key>
+                    <key>redis[aof_last_rewrite_time_sec]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -373,10 +375,10 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[redis_git_sha1]</key>
-                    <delay>3600</delay>
+                    <key>redis[aof_last_write_status]</key>
+                    <delay>30</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
                     <value_type>4</value_type>
                     <allowed_hosts/>
@@ -416,7 +418,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[rdb_current_bgsave_time_sec]</key>
+                    <key>redis[aof_rewrite_in_progress]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -436,7 +438,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>0</data_type>
+                    <data_type>3</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -459,7 +461,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[rdb_changes_since_last_save]</key>
+                    <key>redis[aof_rewrite_scheduled]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -479,7 +481,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>0</data_type>
+                    <data_type>3</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -502,12 +504,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[rdb_bgsave_in_progress]</key>
-                    <delay>60</delay>
+                    <key>redis[arch_bits]</key>
+                    <delay>3600</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>4</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -522,7 +524,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>3</data_type>
+                    <data_type>0</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -545,12 +547,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[rdb_last_bgsave_status]</key>
-                    <delay>30</delay>
+                    <key>redis[client_biggest_input_buf]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>4</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -588,12 +590,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[rdb_last_bgsave_time_sec]</key>
+                    <key>redis[client_longest_output_list]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -631,7 +633,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[redis_git_dirty]</key>
+                    <key>redis[cluster_enabled]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -674,7 +676,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[rdb_last_save_time]</key>
+                    <key>redis[connected_clients]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -717,7 +719,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[sync_full]</key>
+                    <key>redis[connected_slaves]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -760,7 +762,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[sync_partial_err]</key>
+                    <key>redis[evicted_keys]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -803,12 +805,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[used_cpu_user_children]</key>
+                    <key>redis[expired_keys]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -841,17 +843,17 @@
                     <logtimefmt/>
                 </item>
                 <item>
-                    <name>[Redis] $1</name>
+                    <name>[Redis] GCC version</name>
                     <type>0</type>
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[used_cpu_user]</key>
-                    <delay>60</delay>
+                    <key>redis[gcc_version]</key>
+                    <delay>3600</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>4</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -889,14 +891,14 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[used_memory]</key>
+                    <key>redis[hz]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
                     <value_type>3</value_type>
                     <allowed_hosts/>
-                    <units>B</units>
+                    <units/>
                     <delta>0</delta>
                     <snmpv3_contextname/>
                     <snmpv3_securityname/>
@@ -932,12 +934,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[used_memory_lua]</key>
+                    <key>redis[instantaneous_input_kbps]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -975,7 +977,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[used_memory_rss]</key>
+                    <key>redis[instantaneous_ops_per_sec]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1018,14 +1020,14 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[used_memory_peak]</key>
+                    <key>redis[instantaneous_output_kbps]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
-                    <units>B</units>
+                    <units/>
                     <delta>0</delta>
                     <snmpv3_contextname/>
                     <snmpv3_securityname/>
@@ -1061,12 +1063,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[used_cpu_sys_children]</key>
+                    <key>redis[keyspace_hits]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1104,12 +1106,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[used_cpu_sys]</key>
+                    <key>redis[keyspace_misses]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1147,7 +1149,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[total_commands_processed]</key>
+                    <key>redis[latest_fork_usec]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1190,7 +1192,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[tcp_port]</key>
+                    <key>redis[loading]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1210,7 +1212,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>0</data_type>
+                    <data_type>3</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -1233,7 +1235,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[total_connections_received]</key>
+                    <key>redis[lru_clock]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1276,7 +1278,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[total_net_input_bytes]</key>
+                    <key>redis[master_repl_offset]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1319,14 +1321,14 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[uptime_in_seconds]</key>
+                    <key>redis[mem_fragmentation_ratio]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
-                    <units>s</units>
+                    <units/>
                     <delta>0</delta>
                     <snmpv3_contextname/>
                     <snmpv3_securityname/>
@@ -1362,7 +1364,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[total_net_output_bytes]</key>
+                    <key>redis[migrate_cached_sockets]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1405,12 +1407,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[sync_partial_ok]</key>
-                    <delay>60</delay>
+                    <key>redis[multiplexing_api]</key>
+                    <delay>3600</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>4</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1448,7 +1450,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[pubsub_patterns]</key>
+                    <key>redis[pubsub_channels]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1491,7 +1493,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[client_longest_output_list]</key>
+                    <key>redis[pubsub_patterns]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1534,7 +1536,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[client_biggest_input_buf]</key>
+                    <key>redis[rdb_bgsave_in_progress]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1554,7 +1556,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>0</data_type>
+                    <data_type>3</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -1577,7 +1579,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[cluster_enabled]</key>
+                    <key>redis[rdb_changes_since_last_save]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1620,12 +1622,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[connected_clients]</key>
+                    <key>redis[rdb_current_bgsave_time_sec]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1663,12 +1665,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[evicted_keys]</key>
-                    <delay>60</delay>
+                    <key>redis[rdb_last_bgsave_status]</key>
+                    <delay>30</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>4</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1706,12 +1708,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[connected_slaves]</key>
+                    <key>redis[rdb_last_bgsave_time_sec]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1749,12 +1751,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[arch_bits]</key>
-                    <delay>3600</delay>
+                    <key>redis[rdb_last_save_time]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>4</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1792,7 +1794,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[aof_rewrite_scheduled]</key>
+                    <key>redis[redis_git_dirty]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -1812,7 +1814,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>3</data_type>
+                    <data_type>0</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -1835,12 +1837,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[aof_enabled]</key>
-                    <delay>60</delay>
+                    <key>redis[redis_git_sha1]</key>
+                    <delay>3600</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>4</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1855,7 +1857,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>3</data_type>
+                    <data_type>0</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -1878,12 +1880,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[aof_current_rewrite_time_sec]</key>
-                    <delay>60</delay>
+                    <key>redis[redis_mode]</key>
+                    <delay>3600</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>4</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1921,12 +1923,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[aof_last_bgrewrite_status]</key>
-                    <delay>30</delay>
+                    <key>redis[rejected_connections]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>4</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -1964,12 +1966,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[aof_last_rewrite_time_sec]</key>
+                    <key>redis[repl_backlog_active]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -2007,7 +2009,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[aof_rewrite_in_progress]</key>
+                    <key>redis[repl_backlog_first_byte_offset]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2027,7 +2029,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>3</data_type>
+                    <data_type>0</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -2050,12 +2052,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[aof_last_write_status]</key>
-                    <delay>30</delay>
+                    <key>redis[repl_backlog_histlen]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>4</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -2093,7 +2095,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[pubsub_channels]</key>
+                    <key>redis[repl_backlog_size]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2136,12 +2138,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[expired_keys]</key>
-                    <delay>60</delay>
+                    <key>redis[role]</key>
+                    <delay>3600</delay>
                     <history>30</history>
-                    <trends>365</trends>
+                    <trends>0</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>4</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -2179,7 +2181,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[lru_clock]</key>
+                    <key>redis[sync_full]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2222,7 +2224,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[loading]</key>
+                    <key>redis[sync_partial_err]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2242,7 +2244,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>3</data_type>
+                    <data_type>0</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -2265,7 +2267,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[master_repl_offset]</key>
+                    <key>redis[sync_partial_ok]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2308,12 +2310,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[mem_fragmentation_ratio]</key>
+                    <key>redis[tcp_port]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -2351,12 +2353,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[multiplexing_api]</key>
-                    <delay>3600</delay>
+                    <key>redis[total_commands_processed]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>4</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -2394,7 +2396,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[migrate_cached_sockets]</key>
+                    <key>redis[total_connections_received]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2437,7 +2439,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[keyspace_misses]</key>
+                    <key>redis[total_net_input_bytes]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2480,7 +2482,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[latest_fork_usec]</key>
+                    <key>redis[total_net_output_bytes]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2523,14 +2525,14 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[instantaneous_input_kbps]</key>
+                    <key>redis[uptime_in_seconds]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>0</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
-                    <units/>
+                    <units>s</units>
                     <delta>0</delta>
                     <snmpv3_contextname/>
                     <snmpv3_securityname/>
@@ -2566,12 +2568,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[hz]</key>
+                    <key>redis[used_cpu_sys]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -2609,7 +2611,7 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[instantaneous_output_kbps]</key>
+                    <key>redis[used_cpu_sys_children]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2652,12 +2654,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[instantaneous_ops_per_sec]</key>
+                    <key>redis[used_cpu_user]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -2695,12 +2697,12 @@
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[keyspace_hits]</key>
+                    <key>redis[used_cpu_user_children]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>3</value_type>
+                    <value_type>0</value_type>
                     <allowed_hosts/>
                     <units/>
                     <delta>0</delta>
@@ -2733,19 +2735,19 @@
                     <logtimefmt/>
                 </item>
                 <item>
-                    <name>[Redis] GCC version</name>
+                    <name>[Redis] $1</name>
                     <type>0</type>
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[gcc_version]</key>
-                    <delay>3600</delay>
+                    <key>redis[used_memory]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>4</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
-                    <units/>
+                    <units>B</units>
                     <delta>0</delta>
                     <snmpv3_contextname/>
                     <snmpv3_securityname/>
@@ -2776,12 +2778,12 @@
                     <logtimefmt/>
                 </item>
                 <item>
-                    <name>[Redis] ping test</name>
+                    <name>[Redis] $1</name>
                     <type>0</type>
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis-ping</key>
+                    <key>redis[used_memory_lua]</key>
                     <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
@@ -2801,7 +2803,7 @@
                     <delay_flex/>
                     <params/>
                     <ipmi_sensor/>
-                    <data_type>3</data_type>
+                    <data_type>0</data_type>
                     <authtype>0</authtype>
                     <username/>
                     <password/>
@@ -2819,19 +2821,19 @@
                     <logtimefmt/>
                 </item>
                 <item>
-                    <name>[Redis] Redis version</name>
+                    <name>[Redis] $1</name>
                     <type>0</type>
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>redis[redis_version]</key>
-                    <delay>3600</delay>
+                    <key>redis[used_memory_peak]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
-                    <value_type>4</value_type>
+                    <value_type>3</value_type>
                     <allowed_hosts/>
-                    <units/>
+                    <units>B</units>
                     <delta>0</delta>
                     <snmpv3_contextname/>
                     <snmpv3_securityname/>
@@ -2862,13 +2864,13 @@
                     <logtimefmt/>
                 </item>
                 <item>
-                    <name>[Redis] server is running</name>
+                    <name>[Redis] $1</name>
                     <type>0</type>
                     <snmp_community/>
                     <multiplier>0</multiplier>
                     <snmp_oid/>
-                    <key>net.tcp.port[127.0.0.1,6379]</key>
-                    <delay>30</delay>
+                    <key>redis[used_memory_rss]</key>
+                    <delay>60</delay>
                     <history>30</history>
                     <trends>365</trends>
                     <status>0</status>
@@ -2901,9 +2903,7 @@
                             <name>Redis</name>
                         </application>
                     </applications>
-                    <valuemap>
-                        <name>Service state</name>
-                    </valuemap>
+                    <valuemap/>
                     <logtimefmt/>
                 </item>
             </items>
@@ -2955,7 +2955,7 @@
             <dependencies/>
         </trigger>
         <trigger>
-            <expression>{Template App Redis:net.tcp.port[127.0.0.1,6379].last(0)}=0</expression>
+            <expression>{Template App Redis:net.tcp.port[,6379].last(0)}=0</expression>
             <name>Redis is down</name>
             <url/>
             <status>0</status>
@@ -2995,7 +2995,7 @@
             <dependencies/>
         </trigger>
         <trigger>
-            <expression>{Template App Redis:redis[redis_version].diff(0)}&gt;0</expression>
+            <expression>{Template App Redis:redis.version.diff(0)}&gt;0</expression>
             <name>Redis version has changed</name>
             <url/>
             <status>0</status>
@@ -3113,27 +3113,27 @@
             <ymax_item_1>0</ymax_item_1>
             <graph_items>
                 <graph_item>
-                    <sortorder>1</sortorder>
+                    <sortorder>0</sortorder>
                     <drawtype>0</drawtype>
-                    <color>C80000</color>
+                    <color>00C800</color>
                     <yaxisside>0</yaxisside>
                     <calc_fnc>2</calc_fnc>
                     <type>0</type>
                     <item>
                         <host>Template App Redis</host>
-                        <key>redis[rejected_connections]</key>
+                        <key>redis[connected_clients]</key>
                     </item>
                 </graph_item>
                 <graph_item>
-                    <sortorder>0</sortorder>
+                    <sortorder>1</sortorder>
                     <drawtype>0</drawtype>
-                    <color>00C800</color>
+                    <color>C80000</color>
                     <yaxisside>0</yaxisside>
                     <calc_fnc>2</calc_fnc>
                     <type>0</type>
                     <item>
                         <host>Template App Redis</host>
-                        <key>redis[connected_clients]</key>
+                        <key>redis[rejected_connections]</key>
                     </item>
                 </graph_item>
                 <graph_item>
@@ -3321,7 +3321,7 @@
                     <type>0</type>
                     <item>
                         <host>Template App Redis</host>
-                        <key>net.tcp.port[127.0.0.1,6379]</key>
+                        <key>net.tcp.port[,6379]</key>
                     </item>
                 </graph_item>
             </graph_items>
@@ -3371,4 +3371,19 @@
             </graph_items>
         </graph>
     </graphs>
+    <value_maps>
+        <value_map>
+            <name>Service state</name>
+            <mappings>
+                <mapping>
+                    <value>0</value>
+                    <newvalue>Down</newvalue>
+                </mapping>
+                <mapping>
+                    <value>1</value>
+                    <newvalue>Up</newvalue>
+                </mapping>
+            </mappings>
+        </value_map>
+    </value_maps>
 </zabbix_export>
diff --git a/templates/Template App Rserve.xml b/templates/Template App Rserve.xml
new file mode 100644
index 0000000000000000000000000000000000000000..63b5402e7be53302f2f81921997408b596825ad5
--- /dev/null
+++ b/templates/Template App Rserve.xml	
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<zabbix_export>
+    <version>3.0</version>
+    <date>2016-05-02T08:43:40Z</date>
+    <groups>
+        <group>
+            <name>Zabbix Templates</name>
+        </group>
+    </groups>
+    <templates>
+        <template>
+            <template>Template App Rserve</template>
+            <name>Template App Rserve</name>
+            <description/>
+            <groups>
+                <group>
+                    <name>Zabbix Templates</name>
+                </group>
+            </groups>
+            <applications>
+                <application>
+                    <name>Rserve</name>
+                </application>
+            </applications>
+            <items>
+                <item>
+                    <name>Number of running processes Rserve</name>
+                    <type>0</type>
+                    <snmp_community/>
+                    <multiplier>0</multiplier>
+                    <snmp_oid/>
+                    <key>proc.num[Rserve]</key>
+                    <delay>30</delay>
+                    <history>90</history>
+                    <trends>365</trends>
+                    <status>0</status>
+                    <value_type>3</value_type>
+                    <allowed_hosts/>
+                    <units/>
+                    <delta>0</delta>
+                    <snmpv3_contextname/>
+                    <snmpv3_securityname/>
+                    <snmpv3_securitylevel>0</snmpv3_securitylevel>
+                    <snmpv3_authprotocol>0</snmpv3_authprotocol>
+                    <snmpv3_authpassphrase/>
+                    <snmpv3_privprotocol>0</snmpv3_privprotocol>
+                    <snmpv3_privpassphrase/>
+                    <formula>1</formula>
+                    <delay_flex/>
+                    <params/>
+                    <ipmi_sensor/>
+                    <data_type>0</data_type>
+                    <authtype>0</authtype>
+                    <username/>
+                    <password/>
+                    <publickey/>
+                    <privatekey/>
+                    <port/>
+                    <description/>
+                    <inventory_link>0</inventory_link>
+                    <applications>
+                        <application>
+                            <name>Rserve</name>
+                        </application>
+                    </applications>
+                    <valuemap/>
+                    <logtimefmt/>
+                </item>
+            </items>
+            <discovery_rules/>
+            <macros/>
+            <templates/>
+            <screens/>
+        </template>
+    </templates>
+    <triggers>
+        <trigger>
+            <expression>{Template App Rserve:proc.num[Rserve].last(0)}&lt;1</expression>
+            <name>Rserve is not running</name>
+            <url/>
+            <status>0</status>
+            <priority>5</priority>
+            <description/>
+            <type>0</type>
+            <dependencies/>
+        </trigger>
+    </triggers>
+</zabbix_export>