124
Munin User Group Japan http://munin.jp/ Masahito Zembutsu @zembutsu September 8, 2012 OpenSource Conference 2012 Tokyo/Fall (#osc12tk) “Practical Resource Monitoring with Munin - English Edition”

Practical resource monitoring with munin (English editon)

Embed Size (px)

DESCRIPTION

Hello. I'm @zembutsu. I work in a server hosting company in Japan. I am a solution engineer, and I am in charge of server and network operation mainly. So, as for my presentation, it is a resource monitoring tool about Munin. original version is here ( in Japanese ) http://www.slideshare.net/zembutsu/practical-resource-monitoring-with-munin Munin User Group Japan http://munin.jp/ Masahito Zembutsu @zembutsu September 8, 2012 OpenSource Conference 2012 Tokyo/Fall, Japan (#osc12tk)

Citation preview

Page 1: Practical resource monitoring with munin  (English editon)

Munin User Group Japan http://munin.jp/Masahito Zembutsu @zembutsuSeptember 8, 2012 OpenSource Conference 2012 Tokyo/Fall (#osc12tk)

“Practical Resource Monitoring with Munin - English Edition”

Page 2: Practical resource monitoring with munin  (English editon)

Nice to meet you. I’m @zembutsu.Thank you for giving an opportunity of the presentation to me!

They are characters of Touhou Project, and "Please take it easy!!"(yukkuri site itte ne!) is one of the famous slang in Japan.http://en.wikipedia.org/wiki/Touhou_Project

Page 3: Practical resource monitoring with munin  (English editon)

Recipe for monitoring

Today’s topic is…

Page 4: Practical resource monitoring with munin  (English editon)
Page 5: Practical resource monitoring with munin  (English editon)

I’m expecting that various burdens on operation engineers reduce it by

utilizing Munin.

Page 6: Practical resource monitoring with munin  (English editon)

And now…

Page 7: Practical resource monitoring with munin  (English editon)

Why Am I Here?•    Masahito ZEMBUTSU @zembutsu

– Solutions Engineer ( fiery zeal Otaku mind engineer )• Working as a server infrastructure engineer.• I want to provide relaxation and rest for

theengineers.(Operation/Monitoring/Automation)

– Communities of an opensource and the cloud computing• My website http://pocketstudio.jp/

– Experience• April 2000 - Support engineer of server hosting and the ISP• May 2008 - Company internal network management and support• November 2010 - Service development and upper escalation operation• July 2012 – Operation, Development, Research

at datacenter somewhere.

Don’t mind the careful thing!

http://jaws-ug.jp/http://opencloud.jp/

this is me

Page 8: Practical resource monitoring with munin  (English editon)

filleting mackerelIt resembles server operations.

DevOps!

Page 9: Practical resource monitoring with munin  (English editon)

―Don't forget. always, somewhere,someone is fighting for you.

―As long as you remember her.you are not alone.

(Reference: “Puella Magi Madoka Magica” Episode 12 “My Very Best Friend” )Operation

Monitoring

Page 10: Practical resource monitoring with munin  (English editon)

This Photo is under creative commons license by torkildr http://www.flickr.com/photos/torkildr/3462606643/sizes/l/in/photostream/

This is an image photograph of the data center that I’m working.

Page 11: Practical resource monitoring with munin  (English editon)

A Dedicated Hosting ServicesShutdown Attack, An Unfamiliar Specifications,Cloudcomputing’s Arrival in Japan, Shape of Server,A Business That’s Changing, My Purest Heart for Our Customers.

Troubleshooting The Phone That Never Stop Ringing, The Day a Datacenter Stood

Still, The Choice of Priority, In sickness unto shutdown, and…, Sales

Representative’s Invasion, Customer’s office the Throne of Souls, Tears.

You’re a loser only when you fail to try The Birth of Special task force, The Value of Miracles, At Least, Be Human.

DECISIVE BATTLE

A HUMAN WORK

We can (not) advance.

Page 12: Practical resource monitoring with munin  (English editon)

If you are a server administrator,you will have thought once.

Perhaps…

Page 13: Practical resource monitoring with munin  (English editon)

But, it may work with Muninand a solution of the problem.

My Little Servers Can't Be This Heavy...

flashed

Page 14: Practical resource monitoring with munin  (English editon)

This is that I want to do a share today.

• I think that it is necessary to adopt resource monitoring for an operative flow.

• As a result, it may reduce the burden on administrators. I'm extremely happy. XD

• We need is the culture to leave the office on time!! (Only as for me?)

Page 15: Practical resource monitoring with munin  (English editon)

Agenda

1. What is Munin?

2. Munin’s Architectre

3. How to use Munin

4. Practical trobleshootings!

5. MY VERY BEST MONITORING TOOL

Page 16: Practical resource monitoring with munin  (English editon)

I hope…

2. We improve the efficiency of our working (server and network operations).

1. Let's obtain a weapon called “resource monitoring” for us. Wille zur Macht

“Let's find happiness together.” (Reference: Kiichi Goto, Patlabor: The Movie, 1989) I guess everybody's happy, that's fine.

Page 17: Practical resource monitoring with munin  (English editon)

Munin Community in Japan

Munin User Group Japan

Page 18: Practical resource monitoring with munin  (English editon)

Munin.jp• Munin User Group Japan

– http://munin.jp/

• Wiki– http://munin.jp/wiki/

• Demo– http://demo.munin.jp/

• How to join us– http://munin.jp/mailing-list/

Page 19: Practical resource monitoring with munin  (English editon)

What is Munin?

#1

Page 20: Practical resource monitoring with munin  (English editon)

Munin is a networked resource monitoring tool.

I dare to say, Munin is resource monitoring tool.

I dare to say!!

Page 21: Practical resource monitoring with munin  (English editon)

This is overview (frontpage) of Munin 2.0

Page 22: Practical resource monitoring with munin  (English editon)

When you click it any, a graph of a day / week / month / year are displays it

Page 23: Practical resource monitoring with munin  (English editon)

This zooming function is convenient. It is useful for me to make a report.

Page 24: Practical resource monitoring with munin  (English editon)

Vertical axis is a server, cross axle is metrics. The grouping function is characteristic.

Page 25: Practical resource monitoring with munin  (English editon)

Monitoring is like a box of chocolate

The Melancholy ofServer Administrators

Page 26: Practical resource monitoring with munin  (English editon)

By the Time we Realized It, It Had Already Begun.

• troubles - alert systems can’t detect it (increased)– Mainly clientage for Social Networking Service– When the threshold of the alert exceeds it, it is already late.

• demand of the clientage – rapidly response– Because a loss per one second is wrong number of digits

than before. – a loss of several hundred dollars / minutes :(

Page 27: Practical resource monitoring with munin  (English editon)

“There is something weird, will you check servers? :)”

• Very difficult request...– Clear cause identification often takes time.

• I want to do my best more!– Yes!! I stir myself and go to work.

Administrators got exhausted…– I want to aim at the service improvement, but

this thought is bad. Why? Let’s see the next slide.

Request from my customer of us

Page 28: Practical resource monitoring with munin  (English editon)

WEB

DB

An old network constitution.

One web server and one database server.

It’s very simple!

Page 29: Practical resource monitoring with munin  (English editon)

WEB

DB

BIND

An old network constitution.

If it was a general Web server, it was such a constitution to the utmost.

One web server and one database server.

It’s very simple!

Page 30: Practical resource monitoring with munin  (English editon)

WEBAP

DB

DB

WEBAP

WEB

WEB

monitoring

DB

DB

DB

KVS

KVS

On the other hand, at present…

Page 31: Practical resource monitoring with munin  (English editon)

WEBAP

DB

BINDDB

WEBAP

WEB

WEB

monitoring

DB

DB

DB

KVS

KVS

Number and the management objects of the server are increasing in comparison with the past. Therefore support takes the time, and the degree of difficulty rises, too.

This Just Can't Be Right!!

Page 32: Practical resource monitoring with munin  (English editon)

Why did this happen?

• On the changing environment – Network– Server– Software– Middleware– Application– etc

Page 33: Practical resource monitoring with munin  (English editon)

Ace Console: Fires of Liberation

Be freed from CONSOLE

I make a sortie against troubleshooting!

Page 34: Practical resource monitoring with munin  (English editon)

most important thing, by troubleshooting

• Cause investigation work has top priority. “When we act, it is a first thing to do condition to

notice. If there is a technique, anything cannot be settled. It becomes necessary to notice before a technique. The technical expert is in Japan no matter how much, but cannot be readily settled. The reason is because it does not notice.”Soichiro Honda (2008) "akku baran” (candidness ) PHP inc, 10pp.http://en.wikipedia.org/wiki/Soichiro_Honda

Page 35: Practical resource monitoring with munin  (English editon)

You sure that’s enough armor(tools)?

• “No problem. Everything’s fine.”– ps– top– vmstat– iostat– free– sar (sysstat) …etc Really?

Page 36: Practical resource monitoring with munin  (English editon)

Past Present day

Some consoles MANY consoles….

Page 37: Practical resource monitoring with munin  (English editon)

Situation has changed

Past• One or several servers• Apache, Sendmail, Perl• PostgreSQL, MySQL• Network appliance

(sometimes)• No scale• Upgrading is effective

Now (present day present time, hahaha!!)

• Plural servers in the same network (we assume)

• Conventional software + nginx,Tomcat,ruby,PHP,Python,memcached,Key-Value Store,Hadoop,Cassandra,MongoDB…etc

• The need for scalability• Upgrading is not effective

I think that one of the answers to this problem is resource monitoring using

Munin.

Page 38: Practical resource monitoring with munin  (English editon)

I Know What Your Server Did Last Summer

The essence of Munin is many resources

visualization

Page 39: Practical resource monitoring with munin  (English editon)

Is This MRTG? No, This Is Munin.

MRTG has declined

We have lost a hero to our glorious and noble cause, but does this foreshadow our defeat? No. It is a new beginning. Compared to Cloud Computing Federation the national resources of Dedicated Server are less than one thirtieth of theirs. Despite this major difference, how is it that we have been able to fight the fight for so long? It is because our goal in this war is a righteous one. It’s been over fifty years since the elite of Cloud Computing, consumed by greed took control of the Cloud Computing Federation. We want our freedom. Never forget the times when the Federation has trampled us! We, the Principality of Dedicated Server, have had a long and arduous struggle to achieve freedom for all engineers of our great network. Our fight is sacred, our cause divine. My beloved brother, MRTG, was sacrificed. Why? The war is at a stalemate.

Page 40: Practical resource monitoring with munin  (English editon)

Comparing resource monitoring tool

http://ganglia.info/

http://www.munin-monitoring.org/ http://oss.oetiker.ch/mrtg/http://oss.oetiker.ch/rrdtool/

http://www.cacti.net/ http://www.nagios.org/

http://www.zabbix.com/

I’m interested, too!

Page 41: Practical resource monitoring with munin  (English editon)

http://ganglia.info/

http://www.munin-monitoring.org/ http://oss.oetiker.ch/mrtg/http://oss.oetiker.ch/rrdtool/

http://www.cacti.net/

snmpd

Chttp://www.nagios.org/

http://www.zabbix.com/

Comparing resource monitoring tool

Page 42: Practical resource monitoring with munin  (English editon)

Comparerative tableTool name Type Datastore Config Web interaface alerting

Munin Resource monitoring RRDTool CUI

Cacti Resouce monitoring RRDTool & MySQL CUI/GUI

MRTG Resource monitoring original CUI ×

ZabbixIT

infrastructure monitoring

MySQL, PostgreSQL, etc GUI

NagiosIT

infrastructure monitoring

MySQL or PostgreSQL CUI/GUI

It is good points and bad points both.I use Munin and a Nagios-based tool properly by my

team.

We are friends all the time...

Reference only

Reference only

Page 43: Practical resource monitoring with munin  (English editon)

The Munin We Saw That Day

What is Munin?

Page 44: Practical resource monitoring with munin  (English editon)

About Munin• http://munin-monitoring.org/

• Resource monitoring tool– Munin can analyze resource trends– “what just happened to kill our performance?”

• Plug and Play architecture

– It can monitor many items by default

Munin is a networked resource monitoring tool that can help analyze resource trends and "what just happened to kill our performance?" problems. It is designed to be very plug and play. A default installation provides a lot of graphs with almost no work.

Be alert!

Page 45: Practical resource monitoring with munin  (English editon)

Developers

  Munin project• http://munin-monitoring.org/

github• https://github.com/munin-monitoring

Documents / FAQ / Trac / Wiki Repository / tools / plugins

Page 46: Practical resource monitoring with munin  (English editon)

Progress in development• Community based

– Github• https://github.com/munin-monitoring

– Mailing list• https://lists.sourceforge.net/lists/listinfo/munin-users

– IRC• irc://irc.oftc.net/#munin

• Licence– GNU Public License version2– There is not commercial support

Page 47: Practical resource monitoring with munin  (English editon)

History• 2002 - project began

– The original name is “LRRD”

• 2004 - Munin 1.0 released– “munin-eye” name was changed to “munin-node”– took long time, and daily improvement continued

• 2009 - Munin 1.4 released– Perhaps I think that it is a version spreading most in 1.x.

• May 30, 2012 - Munin 2.0 (stable) released

Page 48: Practical resource monitoring with munin  (English editon)

Where is the Japanese information?

• NOT YET!• Let’s make it together now!

– How about write something to wiki first?• http://munin.jp/wiki/

“Is the number of the invitation to the Munin user group ZERO case this week, too?Hum? Do you have a mind to do?”

“I’m sorry, my applogies…”

Page 49: Practical resource monitoring with munin  (English editon)

The Secret Of Munin

Munin?

Page 50: Practical resource monitoring with munin  (English editon)

This Photo is under creative commons license http://en.wikipedia.org/wiki/File:Odin_hrafnar.jpg

Page 51: Practical resource monitoring with munin  (English editon)

Speaking munin-eye’s mind ( now, munin-node )

What obstacle factors there are!!Are you gettingwise with me?

Page 52: Practical resource monitoring with munin  (English editon)

Summarize the points

• Munin is a resource monitoring tool. (GPL v2)

• Simple and powerful architecture.

• Munin frees us from a console.

(effectiveness)

• Munin mean is “memory”.You are never alone!

Munin always here for you 24x7x365

Page 53: Practical resource monitoring with munin  (English editon)

Munin’s Architecture

#2

Page 54: Practical resource monitoring with munin  (English editon)

The Architecture Of Munin

An Amazing Simple Munin

Page 55: Practical resource monitoring with munin  (English editon)

WEB

USER

HTTP

HTML & Graph

/var/www/html/munin

refer to the data on the server

User’s viewpoint

It is only simple structure.The user refers to the data on the

server.

Page 56: Practical resource monitoring with munin  (English editon)

WEB

USER

http://<host>/munin/HTTP

HTML & Graph

/var/www/html/munin

munin-cgi-graphCGI (Dynamic generator)

User’s viewpoint

refer to the data on the server

Page 57: Practical resource monitoring with munin  (English editon)

Munin Master And Munin Node

Client Server Model

Page 58: Practical resource monitoring with munin  (English editon)

munin-master

Let's watch a little more detailed movement.

Page 59: Practical resource monitoring with munin  (English editon)

HTML & Graph

munin-master

/var/www/html

This is the data which we referred to some time

ago.

Page 60: Practical resource monitoring with munin  (English editon)

HTML & Graph

Executed every 5 minutes ( default )

munin-master

crond (munin-cron) Perl (Munin::Common)

Data Store & Graph

munin-updatemunin-limits

munin-htmlmunin-graph

/var/www/htmlRRD

This is the work of the main Munin master, and a program is executed by cron.It thereby carry out the generation of the collection of data, checking threshold, HTML files and graphs one by one.

Page 61: Practical resource monitoring with munin  (English editon)

HTML & Graph

munin-master

crond (munin-cron) Perl (Munin::Common)

Data Store & Graph

munin-nodedaemon

munin-node-configuremunin-run

plugins

munin-updatemunin-limits

munin-htmlmunin-graph

/var/www/html

apachecpumemory

diskstats loadvmstats

ntp….etc

RRD

This is “munin-node” agent. Munin Master acquires data via

plugins.

Executed every 5 minutes ( default )

Page 62: Practical resource monitoring with munin  (English editon)

HTML & Graph

munin-master

crond (munin-cron) Perl (Munin::Common)

Data Store & Graph

munin-nodedaemon

4949/TCP

munin-node-configuremunin-run

plugins

munin-updatemunin-limits

munin-htmlmunin-graph

/var/www/html

apachecpumemory

diskstats loadvmstats

ntp….etc

RRD

munin-update connects with munin-node.Its port number of munin-node is TCP 4949.

Executed every 5 minutes ( default )

Page 63: Practical resource monitoring with munin  (English editon)

HTML & Graph

munin-master

crond (munin-cron) Perl (Munin::Common)

Data Store & Graph

munin-nodedaemon

4949/TCP

munin-node-configuremunin-run

plugins

munin-updatemunin-limits

munin-htmlmunin-graph

/var/www/html

apachecpumemory

diskstats loadvmstats

ntp….etc

RRDRRD

Plugins are executed in munin-node, and program is a script acquiring various data. Munin-update stores the data which I acquired in RRDTool.And, munin-limits checks the threshold.

Executed every 5 minutes ( default )

Page 64: Practical resource monitoring with munin  (English editon)

HTML & Graph

munin-master

crond (munin-cron) Perl (Munin::Common)

Data Store & Graph

munin-nodedaemon

4949/TCP

munin-node-configuremunin-run

plugins

munin-updatemunin-limits

munin-htmlmunin-graph

/var/www/html

apachecpumemory

diskstats loadvmstats

ntp….etc

RRD

And munin-graph and munin-html generate a graph and HTML for the material in data (.rrd) stored away by RRDtool.

Executed every 5 minutes ( default )

Page 65: Practical resource monitoring with munin  (English editon)

HTML & Graph

munin-master

crond (munin-cron) Perl (Munin::Common)

Data Store & Graph

munin-nodedaemon

4949/TCP

munin-node-configuremunin-run

plugins

munin-updatemunin-limits

munin-htmlmunin-graph

/var/www/html

apachecpumemory

diskstats loadvmstats

ntp….etc

RRD

These flows are basic movement of Munin.

I think that it is really simple and cool!

Executed every 5 minutes ( default )

Page 66: Practical resource monitoring with munin  (English editon)

HTML & Graph

munin-master

crond (munin-cron) Perl (Munin::Common)

Data Store & Graph

munin-nodedaemon

4949/TCP

munin-node-configuremunin-run

plugins

munin-updatemunin-limits

munin-htmlmunin-graph

/var/www/html

apachecpumemory

diskstats loadvmstats

ntp….etc

RRD

WEB

USER

http://<host>/munin/

Executed every 5 minutes ( default )

Page 67: Practical resource monitoring with munin  (English editon)

Constitution of Munin

master ( SERVER )• Perl Libs

– Munin::Common

• munin-cron– munin-update– munin-limits– munin-html– munin-graph

• config: munin.conf

munin-node ( CLIENT )• Perl Libs

– Munin::Common

• munin-node– config: munin-node.conf– Plugins

• Tools– munin-node-configure– munin-cron

Page 68: Practical resource monitoring with munin  (English editon)

About data collection

• munin-node collect various data.• Port 4949(TCP)

– Munin protocol• LIST• CONFIG• FETCH• VERSION• QUIT

(T_T)4949“4949” is onomatopoeia of Japanese "tearful face".

Page 69: Practical resource monitoring with munin  (English editon)

Data storage and graph generation are work of RRDtool

• Data format is RRD (round robin database)– /var/lib/munin/<hostname>/<plugin’s name>.rrd

• 50KByte/one RRD file– More than 200KB/one plugin (MUST)– 150 to 250 files/munin-node (total about 8 to 15MB/node)

-rw-r--r-- 1 munin munin 50612 10 月 18 2010 localhost-cpu-idle-d.rrd-rw-r--r-- 1 munin munin 50612 10 月 18 2010 localhost-cpu-iowait-d.rrd-rw-r--r-- 1 munin munin 50612 10 月 18 2010 localhost-cpu-irq-d.rrd-rw-r--r-- 1 munin munin 50612 10 月 18 2010 localhost-cpu-nice-d.rrd-rw-r--r-- 1 munin munin 50612 10 月 18 2010 localhost-cpu-softirq-d.rrd-rw-r--r-- 1 munin munin 50612 10 月 18 2010 localhost-cpu-steal-d.rrd-rw-r--r-- 1 munin munin 50612 10 月 18 2010 localhost-cpu-system-d.rrd-rw-r--r-- 1 munin munin 50612 10 月 18 2010 localhost-cpu-user-d.rrd

Page 70: Practical resource monitoring with munin  (English editon)

Munin Master And Munin Node

generate graphs per plugin

Page 71: Practical resource monitoring with munin  (English editon)

Munin prepares for much plugins

• System resources– CPU, memory, Load Average, disk, S.M.A.R.T…

• Network– Traffic, SNMP, HTTP loadtime, TCP, UDP, ICMP…

• Applications, middleware– Apache, Nginx, Sendmail, Postfix, MySQL,

PostgreSQL, MongoDB, memcached, PHP… etc

Page 72: Practical resource monitoring with munin  (English editon)

Ex) Load Average plugin

• /etc/munin/plugins/load– “Load average” is five minutes average– It’s a symbolic link

• Original is /usr/share/munin/plugin/load

– Simple shell scriptecho -n "load.value "cut -f2 -d' ' < /proc/loadavgload .value 3.22

Page 73: Practical resource monitoring with munin  (English editon)
Page 74: Practical resource monitoring with munin  (English editon)

How to use Munin

#3

Page 75: Practical resource monitoring with munin  (English editon)

Make My Day

Munin setup!

Page 76: Practical resource monitoring with munin  (English editon)

Environment

• Perl5• OS

– Linux• Source code ( version 2.0.6 )• Binary Package

– Red Hat Enterprise Linux 系 ( EPEL )– Debian – openSUSE

– MacOS X– Windows

Page 77: Practical resource monitoring with munin  (English editon)

Setting up flow

• Install Munin and Perl Libraries• Change a config file ( munin.conf )• Setting up munin-node ( munin-node.conf )• Check its graphs

Page 78: Practical resource monitoring with munin  (English editon)

Case) Red Hat Enterprise Linux

• Use EPEL*1(testing repository) package or source

• procedure– 1. enabling EPEL– 2. “yum install munin”– 3. configure munin.conf– 4. turn on munin-node and setup– 5. check

*1 Extra Packages for Enterprise Linux(EPEL) https://fedoraproject.org/wiki/EPEL

Page 79: Practical resource monitoring with munin  (English editon)

Case) Debian / Ubuntu

• Use apt (Debian PTS is testing) or Source• Procedure

– 1. setting up Perl libraries (via apt-get)– 2. install munin– 3. configure munin.conf– 4. turn on munin-node and setup– 5. check

Page 80: Practical resource monitoring with munin  (English editon)

How To Configure

Basic of the setting

Page 81: Practical resource monitoring with munin  (English editon)

Config files

Munin Master• /etc/munin/munin.conf

– Host tree (targeting nodes)– Graph strategy

• Cron or realtime generation

– Paths• RRD files• logfiles

munin-node• /etc/munin/munin-

node.conf– Access control

• Host (IP address)• Network CIDR

– Node’s hostname– Port number

• Default: TCP 4949 (T_T)

– Plugin’s option

Page 82: Practical resource monitoring with munin  (English editon)

[munin.conf] set target node

[GroupName;node1.pocketstudio.net] address 127.0.0.1 use_node_name yes

Page 83: Practical resource monitoring with munin  (English editon)

[munin-node.conf] Access control

• allow ^127\.0\.0\.1$– Regular expression

• cidr_allow 192.0.2.0/24– Not regular expression

• If you change files, then you must restart munin-node!

Page 84: Practical resource monitoring with munin  (English editon)

How To Configure plugin

Basic of the plugin

Page 85: Practical resource monitoring with munin  (English editon)

Basic knowledge of Munin plugin

• Original files is here ( shell or perl scripts )– /usr/share/munin/plugins/

• How to use– To make symbolic link to /etc/munin/plugins– configure munin-node.conf – munin-node restart (MUST)– Check graph and html

Page 86: Practical resource monitoring with munin  (English editon)

How to debug plugin

• /usr/sbin/munin-run <plugin-name>– “--debug” shows more detail– behavior is same as munin-node– useful

• Command line tool ( I made )– muninwalk & muninget ; perl script

https://github.com/zembutsu/muninwalk

Page 87: Practical resource monitoring with munin  (English editon)

How To Configure plugin

Plugins catalog

Page 88: Practical resource monitoring with munin  (English editon)

Apache• Symbolic link

• munin-node.conf

• httpd.conf

[apache_*] env.url http://127.0.0.1:%d/server-status?auto env.ports 80

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

ExtendedStatus On

<Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1</Location>

Page 89: Practical resource monitoring with munin  (English editon)

MySQL• Symbolic link

• munin-node.conf[mysql*] env.mysqlopts -u root -pPASSWORD env.mysqladmn /usr/bin/mysqladmin

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

Page 90: Practical resource monitoring with munin  (English editon)

BIND• Symbolic link

• munin-node.conf

• named.conf

[bind9_rndc] env.rndc /usr/sbin/rndc env.querystats /var/named/chroot/var/named/data/named_stats.txt user root

# ln -s /usr/share/munin/plugins/bind9_rndc /etc/munin/plugins/

statistics-file "/var/named/data/named_stats.txt";

Page 91: Practical resource monitoring with munin  (English editon)

Plugins Catalog

Plugins I made

Page 92: Practical resource monitoring with munin  (English editon)

https://github.com/zembutsu/AWS-EstimateChargeAmazon Web Services; it estimated charges realtime via

API

Page 93: Practical resource monitoring with munin  (English editon)

Quantity of generation of the electric power company (TEPCO)

Page 94: Practical resource monitoring with munin  (English editon)

And electricity consumption rate (TEPCO).Munin can make anything plug in if

digitized.

Page 95: Practical resource monitoring with munin  (English editon)

Take It Easy

How to make plugin

Page 96: Practical resource monitoring with munin  (English editon)

Sample case; httping plugin

• http://www.vanheusden.com/httping/• "httping" is a command-line tool which can

check response time of the Web server like a “ping” command.

• If you set –S opsion, then you can check response time and processing time.

$ httping -S http://210.239.46.254/PING 210.239.46.254:80 (http://210.239.46.254/):connected to 210.239.46.254:80 (380 bytes), seq=0 time=0.10+0.69=0.79 msconnected to 210.239.46.254:80 (380 bytes), seq=1 time=0.08+0.47=0.55 msconnected to 210.239.46.254:80 (380 bytes), seq=2 time=0.07+0.68=0.75 msconnected to 210.239.46.254:80 (380 bytes), seq=3 time=0.12+0.66=0.77 msGot signal 2--- http://210.239.46.254/ ping statistics ---4 connects, 4 ok, 0.00% failed

Page 97: Practical resource monitoring with munin  (English editon)

Plugin: httping_#!/bin/sh## Plugin to monitor HTTP response (httping)

#%# family=auto#%# capabilities=autoconf

URL=${URL:-"http://localhost/"}COUNT=${COUNT:-"5"}httping_bin=$(which httping)

if [ "$1" = "autoconf" ]; then echo yes exit 0fi

if [ "$1" = "config" ] ; then echo "graph_args -r --lower-limit 0 "; echo "graph_title http response $URL"; echo "graph_category httping"; echo "graph_info httping response time: $URL"; echo 'graph_vlabel msec'

echo "connect.label connect time" echo "connect.draw AREA" echo "connect.type GAUGE" echo "processing.label processing time" echo "processing.draw STACK" echo "processing.type GAUGE" exitfi

# format for httpiing 1.5.3 http://www.vanheusden.com/httping/$httping_bin -c $COUNT -G -S $URL | tr '+|=' ' ' | awk '{connect+=$9; processing+=$10} END{print "connect.value",connect/'$COUNT'"\n""processing.value",processing/'$COUNT'}'

This is substance of a httping plugin, and a file itself is a simple shell script.The contents are the definition about the graph and commands to really acquire a value.A point is to acquire data, and therefore the plug in can make even what kind of language including perl and PHP.

Define graphing

Output format is “xxx.Value ***”

Page 98: Practical resource monitoring with munin  (English editon)

Config: httping_

• /etc/munin/plugin-conf.d/httping

• # ln -s /usr/share/munin/plugins/httping_ /etc/munin/plugins/httping_localhost

[httping_localhost] env.URL http://pocketstudio.jp/ env.COUNT 5

[httping_blog] env.URL http://pocketstudio.jp/log3/ env.COUNT 5

[httping_node1] env.URL http://node1.pocketstudio.net/ env.COUNT 5

Page 99: Practical resource monitoring with munin  (English editon)

httping live demo• http://demo.munin.jp/munin2/httping-day.html

It is a case having any problem neither for this server, response time and processing time.

There is much partial (processing time) of this server group blue.It takes the processing time by certain CMS.On the other hand, I understand that the network is good.

Page 100: Practical resource monitoring with munin  (English editon)

Practical trobleshoot!

#4

Page 101: Practical resource monitoring with munin  (English editon)

Never say never.

• Agility is the pivot of the service (in my case)– LOOKOUT, its cause solution of the trouble

• Hardware or Software or Network

– We need investigation• where a problem happens promptly

Page 102: Practical resource monitoring with munin  (English editon)

Live Munin demo

• http://demo.munin.jp/– Then let's observe the resource situation

through this demonstration site of Munin.• Where is a bottleneck? or will be?• Even if you do not log in to a server, I think that you

can refer to many resources.

Page 103: Practical resource monitoring with munin  (English editon)

A Real Troubleshooting

This Just Can’t Be Right

Page 104: Practical resource monitoring with munin  (English editon)

Case) identified unauthorized access

• By the Time we Realized It, It Had Already Begun.

• situation– 1. Error emails beguns to arrive to postmaster– 2. There was not the alert with the monitoring tool– 3. Therefore at first I checked a resource in Munin– 4. I identified that CMS had vulnerability from the

situation and acted promptly.

I was able to perform the above-mentioned movement quickly in a short time by Munin.

Page 105: Practical resource monitoring with munin  (English editon)

How to find it.

Sendmail’s queue rised suddenly Load Average has no problem

Page 106: Practical resource monitoring with munin  (English editon)

I confirmed the timewhen traffic was strange

MySQL’s queries wererised suddenly, too

From the above-mentioned situation, I supposed illegal access for CMS. Actually, I understood the attack for the specific URL when I investigated log of the time.Identification and the action of the cause should have taken time more if I did not use Munin.

Page 107: Practical resource monitoring with munin  (English editon)

My Bery Vest Monitoring tool

#5

Page 108: Practical resource monitoring with munin  (English editon)

I think that Munin is truly wonderful

New Features of Munin 2.0

Page 109: Practical resource monitoring with munin  (English editon)

Munin 2.0 has new features!

• Better UI and CGI integration– New look, Graph Zooming, FastCGI

• asynchronous I/O support– Better performance

• Native SSH transport– secure (port 22) & easy setup

• asynchronous proxy support– async-server substitutes for munin-node

• And more…– https://

github.com/munin-monitoring/munin/blob/devel/Announce-2.0

Page 110: Practical resource monitoring with munin  (English editon)

[RemoteNetwork;backend-DB] addressssh://210.239.46.254/opt/munin/lib/munin-async-client --spooldir /var/opt/munin/spool/192.168.0.230 –spoolfetch use_node_name yes

A munin-async-server store data to /var/opt/munin/spool/xxx as a text files.

Fetching data from /var/opt/munin/spool/datadirectory ( no access to munin-node )

Page 111: Practical resource monitoring with munin  (English editon)

I'm Not Afraid of Anything Anymore

No munin, No Troubleshoot.

Page 112: Practical resource monitoring with munin  (English editon)

Munin changed support flow (my case)

• If I don’t use tools– Troubleshooting is various command execute (sysstat) and

investigation of the log files.– But, this method need long time and many human

resources need, and is bad for service.

• If I use Munin (now).– Even if I do not log in, I can understand the situation.– I can judge abnormality visually

• “I see the ending of this troubleshooting!”

– Agile Support• Troubleshooting that has Plan-Do-Check-Action (PDCA) cycles.

Page 113: Practical resource monitoring with munin  (English editon)

In work of my dedicated server hosting

• I really depend on Munin– Always, I setup Munin.– Munin is almost in several

hundred servers whichI manage directly.

– I think that Munin is indispensable to our service quality improvement.

BAM BAM!

Neat

I cannot part with Muninfor my work.

You believe it!

Page 114: Practical resource monitoring with munin  (English editon)

Trobuleshoot PDCA

Law of Cycles

Presage!!

Page 115: Practical resource monitoring with munin  (English editon)

Trobuleshoot PDCA

Law of Cycles

Presage!!

Plan

Detecting problem and situation

For real?

What are these alerts?

Page 116: Practical resource monitoring with munin  (English editon)

Trobuleshoot PDCA

Law of Cycles

Presage!!

Plan

Do

Detecting problem and situation

For real?

What are these alerts?

Suppose a causeOK, Munin. Please tell me that trouble lies hidden in wherever?

Fire!

Please stop!!

Page 117: Practical resource monitoring with munin  (English editon)

Trobuleshoot PDCA

Law of Cycles

Presage!!

Plan

Do

Check

Detecting problem and situation

For real?

What are these alerts?

Suppose a causeOK, Munin. Please tell me that trouble lies hidden in wherever?

Fire!

Please stop!!To check resourcesremotely

I just talk about what I just looked in Munin!!

Page 118: Practical resource monitoring with munin  (English editon)

Trobuleshoot PDCA

Law of Cycles

Presage!!

Plan

Do

Check

Action

Detecting problem and situation

For real?

What are these alerts?

Suppose a causeOK, Munin. Please tell me that trouble lies hidden in wherever?

Fire!

Please stop!!To check resourcesremotely

Log in and execute commands

Wow!

click-clack click-clack

I just talk about what I just looked in Munin!!

Page 119: Practical resource monitoring with munin  (English editon)

The Only Thing I Have Left To Guide Me

You are never alone! Munin always here for you

24 x 7 x 365

Page 120: Practical resource monitoring with munin  (English editon)

Munin’s overview

・ Munin is the resource monitoring tool that specialize to notice by the visualization.

・ Simple architecture, and many plug-ins.

・ Ths is most suitable for the system that quick support is necessary in a short time.

Page 121: Practical resource monitoring with munin  (English editon)

While there’s Munin, there’s hope.

Conclusion

Thank you for MUNIN. Good-bye to MRTG.

No munin, No Operation.

MY VERY BEST MONITORING TOOL.

* This is my personal impression.

Page 122: Practical resource monitoring with munin  (English editon)

I wish…

• I would appreciate you use Munin that  if you were interested in Munin by my presentation.

• Tomorrow is another day. Up to you.

Squidn’t you use Munin? (Shoudn’t)

Page 123: Practical resource monitoring with munin  (English editon)

Questions?

• Do you have a questionable point for munin?

I'm glad you asked.Let's give the rights that the reward buys Opoona for you.(but, here is wagon sale...)

Page 124: Practical resource monitoring with munin  (English editon)

References• Munin

– http://munin-monitoring.org/

• Munin User Group Japan– http://munin.jp/– http://munin.jp/wiki/

• Website– Waiting for Munin 2.0 – Introduction – Personal Workflow Blog

• http://blog.pwkf.org/post/2010/06/Waiting-for-Munin-2.0-Introduction

– /tags/2.0.0/ChangeLog – Munin – Trac• http://munin-monitoring.org/browser/tags/2.0.0/ChangeLog

Please feedback me [email protected] or @zembutsu ( twitter )Thank you for your reading!