Munin Monitoring Mongodb/redis/php-fpm/nginx/mysql

Source: Internet
Author: User
Tags chmod fpm mongodb redis zip install perl in python

munin Monitoring MongoDB

1, download the Munin MongoDB plugin

Https://github.com/erh/mongo-munin

2, installation of Munin MongoDB dependency

# yum Install Pymongo

This plugin is written in Python, and if not installed, the following error will be reported:
# Munin-run Mongo_mem
Traceback (most recent call last):
File "/etc/munin/plugins/mongo_mem", line 8, in <module>
Import Pymongo
Importerror:no module named Pymongo

3, installation configuration Munin MongoDB Plugin

# tar ZXVF comerford-mongo-munin-8980f32.tar.gz
# CD COMERFORD-MONGO-MUNIN-8980F32
# LN-SF/Path/mongo_*/etc/munin/plugins/
# chmod +x/path/mongo_*
#./build.sh

# VIM/ETC/MUNIN/PLUGIN-CONF.D/MONGODB//Create File
[Mongo_*]
User root//To use root, or it will be an error

Can ' t exec "/etc/munin/plugins/pmongo_mem": Permission denied

4, Test and restart

# Munin-run Mongo_btree
Missratio.value 0
Resets.value 0
Hits.value 2
Misses.value 0
Accesses.value 2

# Munin-run Mongo_conn
Connections.value 2

# Munin-run Mongo_docs
Deleted.value 0
Updated.value 0
Inserted.value 3
Returned.value 0

# Munin-run Mongo_lock
Locked.value 0

# Munin-run Mongo_mem
Resident.value 39845888
Virtual.value 623902720
Mapped.value 167772160

# Munin-run Mongo_ops
Getmore.value 0
Insert.value 3
Update.value 0
Command.value 43194
Query.value 3978
Delete.value 0

If there is data above, it means that the plug-in installation is successful

#/etc/init.d/munin-node Restart



munin Monitoring Redis

1, download Munin Redis plugin

Https://github.com/bpineau/redis-munin

2, load Redis plugin

# LN-SF/Path/redis_/etc/munin/plugins/

3, create the munin redis configuration file

# Vim/etc/munin/plugin-conf.d/redis//New files
[Redis_*]
User root//here to root
Env.host 127.0.0.1
Env.port 6379

Can ' t exec "/etc/munin/plugins/redis_": Permission not enough at/usr/share/perl5/vendor_perl/munin/node/service.pm line 263.

This error occurs, basically permissions issues, such as file and folder permissions, users do not have equal

4, test Munin Redis plugin is OK

[Root@node1 plugins]# Munin-run Redis_
Multigraph redis_clients
Clients.value 2
Multigraph redis_blocked_clients
Blocked.value 0
Multigraph redis_memory
Memory.value 735040
Multigraph redis_fragmentation
Frag.value 9.79
Multigraph Redis_changes_since_last_save
Changes.value 0
Multigraph redis_total_connections
Connections.value 154
Multigraph Redis_expired_keys
Expired.value 2
Multigraph Redis_evicted_keys
Evicted.value 0
Multigraph Redis_pubsub_channels
Channels.value 0
Multigraph Redis_commands
Commands.value 157
Hits.value 0
Misses.value 2
Multigraph Redis_dbs
Db0keys.value 4
Db0expires.value 0

5, restart Munin-node, you can see the picture

#/etc/init.d/munin-node Restart



munin Monitoring PHP-FPM


php5.3 previously PHP-FPM and php-cgi were separate, php-fpm as php-cgi, and the Third-party Management toolkit existed, After php5.3, PHP absorbs php-fpm, when you look at the process, you can not see the php-cgi, take the PHP-FPM process. It is necessary to understand the relevant situation of the PHP-FPM process.

1, modify the PHP-FPM configuration

# vim/etc/php-fpm.d/www.conf

Pm.status_path =/status//Remove the previous comment

#/etc/init.d/php-fpm Restart//reboot

2, modify the Nginx configuration

# vim/etc/nginx/conf.d/munin.conf//Add the following

Location ~ ^/(status|ping) $ {
Include Fastcgi_params;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_param script_filename $fastcgi _script_name;
Allow 127.0.0.1;
#allow 192.168.1.101;
#allow munin.51yip.com;
Deny all;
}

#/etc/init.d/nginx Restart//reboot

Access to Http://xxxxx.com/status, if the following content appears, Nginx and PHP-FPM configuration is

Pool:www
Process Manager:dynamic
Start time:14/jan/2015:09:26:23 +0800
Start since:28796
Accepted conn:261
Listen queue:0
Max Listen queue:0
Listen Queue len:128
Idle Processes:6
Active processes:1
Total Processes:7
Max Active Processes:4
Max Children reached:0

3, download the Munin php-fpm plugin

Https://github.com/tjstein/php5-fpm-munin-plugins

4, configure Munin PHP-FPM plugin

# Unzip Php5-fpm-munin-plugins-master.zip
# CD Php5-fpm-munin-plugins-master
# chmod +x phpfpm_*
# ln-s/Path/phpfpm_*/etc/munin/plugins/

# VIM/ETC/MUNIN/PLUGIN-CONF.D/PHP-FPM//Create new file
[phpfpm*]
User Tank
Env.url Http://munin.com/status
Env.ports 80
Env.phpbin PHP-FPM
Env.phppool www

#/etc/init.d/munin-node Restart//reboot

Here to note [phpfpm*] is not casually written, root this is to find plug-ins, if not match, in the run Munin-run Phpfpm_status, will report the following error

Can ' t exec "/etc/munin/plugins/phpfpm_status": Permission denied

5, see if the PHP-FPM plugin is installed

[Root@node1 plugins]# Munin-run phpfpm_memory
Ram.value 277811200

[Root@node1 plugins]# Munin-run Phpfpm_status
Idle.value 6
Active.value 1
Total.value 7

[Root@node1 plugins]# Munin-run phpfpm_processes
Php_processes.value 7

[Root@node1 plugins]# Munin-run phpfpm_connections
Accepted.value 406



munin monitoring Nginx

1, loading Plug-ins

# ln-s/usr/share/munin/plugins/nginx*/etc/munin/plugins

Munin Nginx function on the two, if the third party plug-ins, can be placed into the/etc/munin/plugins, so that the monitoring will be more

2, configure the Nginx Munin

# vim/etc/nginx/conf.d/munin.conf//Add the following

Location/nginx_status {
Stub_status on;
Access_log off;
Allow 127.0.0.1;
Deny all;
}

#/etc/init.d/nginx Restart//reboot Nginx

Then look at whether Http://xxxx.com/nginx_status can access, and if configured correctly, the following will appear

Active Connections:2
Server accepts handled requests
374 374 1726
reading:0 writing:1 waiting:1

3, configure the Munin Nginx

# Vim/etc/munin/plugin-conf.d/nginx//Create File

[nginx*]
Env.url Http://xxxx.com/nginx_status
Env.port 80

[Nginx_error]//view nginx error message, default does not have this plugin
User Tank
Env.logpath/var/log/nginx

#/etc/init.d/munin-node Restart//reboot Munin

4, check that the Munin is properly configured

[Root@node1 plugins]# munin-node-configure |grep nginx//Check that Nginx is active
Nginx_request | Yes |
Nginx_status | Yes |

[Root@node1 plugins]# munin-node-configure--suggest 2>&1 | grep nginx//Check nginx is configured correctly
Nginx_request | Yes | Yes
Nginx_status | Yes | Yes

If the above two steps are Yes, the installed configuration is successful.



Munin 2 methods of monitoring MySQL

Munin has the MySQL monitoring function, but it is not enabled. Try two ways to monitor MySQL.

First, install the Perl extensions for Munin MySQL

# yum Install Perl-cache-cache perl-ipc-sharelite perl-dbd-mysql

Second, create a MySQL user for monitoring

Mysql> CREATE USER munin@localhost identified by ' 123456 ';
Mysql> GRANT super,process on *.* to Munin@localhost;
mysql> FLUSH privileges;

Two, munin with the MySQL

1, establish munin MySQL plug-in soft connection

# ln-sf/usr/share/munin/plugins/mysql_*/etc/munin/plugins

2, create the configuration file

# vim/etc/munin/plugin-conf.d/mysql.conf//Add the following

Env.mysqlconnection dbi:mysql:mytest;host=localhost;port=3306
Env.mysqladmin/usr/bin/mysqladmin
Env.mysqluser Munin
Env.mysqlpassword 123456

3, see if Munin is supporting MySQL

# munin-node-configure |grep MySQL
Mysql_ | Yes |
Mysql_bytes | Yes |
Mysql_innodb | Yes |
Mysql_isam_space_ | Yes |
mysql_queries | Yes |
mysql_slowqueries | Yes |
Mysql_threads | Yes |

4, see Munin mysql configuration is correct

[Root@node1 plugin-conf.d]# munin-node-configure--suggest 2>&1 | grep MySQL
Mysql_ | Yes | Yes (+bin_relay_log +commands +connections +files_tables +

If the Perl module is missing, it will be no|no.

Then reboot the Munin and configure it. The point to note here is that Munin's own MySQL, there are not many things to monitor, and some of the functions do not come out of the picture.

Third, with the Third-party munin MySQL plugin (recommended)

1, download Address: Https://github.com/kjellm/munin-mysql

2, unpack, configure, and install

# Unzip Munin-mysql-master.zip
# CD Munin-mysql-master
# VIM Makefile//Modify installation files
Plugin_dir:=/usr/share/munin/plugins///Munin plugins path

# Vim mysql.conf//original Delete, add the following
Env.mysqlconnection dbi:mysql:mytest;host=localhost;port=3306
Env.mysqladmin/usr/bin/mysqladmin
Env.mysqluser Munin
Env.mysqlpassword 123456

# chmod +x Makefile//Add executable
# make install//installation command

After the installation is complete, the Munin is automatically restarted. With a third party munin MySQL plugin, monitor the function of many, and can generate pictures. The following figure:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.