The cacti template of percona is still very handsome, but for multiple instances such as redis and memercache, only the default 6379 or one other port can be monitored (in short, all instances cannot be monitored ), this is a pity. To achieve monitoring of all objects that can be monitored, you must customize the template. After half a day of exploration, we finally achieved it. Let's take a look at the handsome one:
Steps:
1. Download The percona template and decompress it. Because the previous version was 1.0.1, it was modified based on the original version.
Wget http://www.percona.com/redir/downloads/percona-monitoring-plugins/1.0.1/percona-monitoring-plugins-1.0.1.tar.gz
2. Add the option port2 Based on the redis default template configuration file. When creating a redis monitoring image, you must enter the redis port number. If this parameter is left blank, the default port number is 6379, the ss_get_by_ssh.php script uses the port2 option to connect to the redis instance on the specified port:
CD percona-monitoring-plugins-1.0.1/cacti/bin
? Bin./PMP-cacti-template \
> -- Script ../scripts/ss_get_by_ssh.php ../Definitions/redis. Def \
> -- Mpds port2> ../templates/cacti_host_template_percona_redis_server_ht_for_multi_instance.xml
Instructions for creating template scripts
? Bin./PMP-cacti-template -- Help
PMP-cacti-template generates a cacti template from a definition file. For more
Details, please use the -- help option, or try 'perldoc PMP-cacti-template'
Complete documentation.
Usage: PMP-cacti-template <Options> File
Options:
-- Cactiver create templates for this cacti version
-- Graph_height height of generated graphs (default 120)
-- Graph_width width of generated graphs (default 500)
-- Help show this help message
-- Lint_check complain about unused data found in the script
-- Mpds comma-separated list of input method options to make
Per-data-Source
-- Name_prefix Template Name prefix (default percona)
-- Poll_interval polling interval (default 300)
-- Script command-line script to use (required)
-- Smallint create templates for 32-bit MySQL
-- Version output version information and exit
Options and values after processing arguments:
-- Cactiver (no value)
-- Graph_height 120
-- Graph_width 500
-- Help true
-- Lint_check false
-- Mpds
-- Name_prefix percona
-- Poll_interval 300
-- Script (no value)
-- Smallint false
-- Version false
? Bin
3. Import the newly created redis template cacti_host_template_percona_redis_server_ht_for_multi_instance.xml on the cacti Web Management page.
Console-> Import/Export-> Import templates-> choose file-> Import
4. Modify the title of the image in the apsaradb for redis template to distinguish the image from the instance. This example uses the port number you entered when creating the image, and uses the variable in cacti | reference
Console-> templates-> graph templates-> Search 'redis 'and select a redis template-> in graph template title-> | host_description |-redis commands-| input_port2 |-> Save
5. Create a monitoring image for redis. Enter the port number.
6. If you have monitoring redis 6379 before importing a new template, the image display name is abnormal, for example, 192.168.0.19 _ redis19-redis unsaved changes-| input_port2 |, not 192.168.0.19 _ redis19-redis unsaved changes-6382
Datasource before modification
Console-> Create-> data sources-> Search 'redis 'and select a data source-> in the Custom Data, let port2 = 6379-> Save
7. The script refreshes the image display name.
Under the cacti server script directory:
[[Email protected] CLI] # pwd
/Var/www/cacti/CLI
[[Email protected] CLI] # PHP-Q poller_graphs_reapply_names.php-id = All-d-s = redis
Warning: Do not interrupt this script. Interrupting during rename can cause issues
Debug: There are '000000' graphs to rename
Debug: Graph name '2017. 168.0.19 _ redis19-redis commands-192 'starting
Debug: Graph rename done for graph '192. 168.0.19 _ redis19-redis commands-100'
Debug: Graph name '2017. 168.0.19 _ redis19-redis connections-192 'starting
Debug: Graph rename done for graph '192. 168.0.19 _ redis19-redis connections-100'
Debug: Graph name '1970. 168.0.19 _ redis19-redis memory-100' starting
Debug: Graph rename done for graph '192. 168.0.19 _ redis19-redis memory-100'
8. OK. Refresh the Web image and it will display normally. See the beginning of this article.
Percona_template_for_cacti added support for redis multi-instance monitoring Images