Welcome!

Python Authors: Ignacio M. Llorente, Carmen Gonzalez, Elizabeth White, John Wetherill, Trevor Parsons

Blog Feed Post

How I built a monitor for RabbitMQ

When you are going to monitor your engine, you probably try first to find some tool that can do it. Very likely, of course, that tool should be able to handle monitoring online and to notify you when the health of your engine is starting to go bad. There are already several well-known and widespread online monitoring tools available for many systems. Super! But what if I try to find a suitable tool for my specific application and… ohh, failure – I cannot find what I need. Unfortunately, it’s also very likely that no one can even suggest a suitable tool. What can I do in such a situation? Probably try to do it myself. Who can help me? You’ve probably already guessed that I am talking about Monitis.  You may ask “why Monitis?”  Because Monitis suggests Monitis Open API, and that gives you a chance to build any monitoring tool yourself. In line with Monitis slang, such a monitor has been named the custom monitor.

But let’s cease the generic talk and get back to my story.

Recently, I had to use RabbitMQ server in one of my projects, and naturally I had a wish to monitor it; just to measure data that I want to monitor. RabbitMQ contains a nice plugin named RabbitMQ Management that in fact provides monitoring of RabbitMQ via any browser (thanks to the embedded WEBUI). Well, it is undoubtedly good, but I don’t want to sit whole days next to the monitor waiting for a problem to come in. I want to monitor online, to have the possibility to go back in time by viewing the monitoring history and, why not, to get a notification on my mobile while having a beer in the bar. I think every admin dreams of such a life.

Well, since I use an Ubuntu server I have decided to implement my custom monitor as Bash script to avoid any unnecessary dependencies and to take into account that the Bash script wrapper for Monitis API  is already implemented.

First of all I have to install RabbitMQ server. The easiest way to do this is to download the “deb” package from the original RabbitMQ site and install it by using the following command:

 

sudo dpkg -i rabbitmq-server_2.8.x_all.deb

 

So far so good. Next step – enabling the RabbitMQ Management HTTP API  that allows, in addition, getting necessary information by using REST technology. The management plugin has been included in the RabbitMQ distribution since version 2.8.1. To enable it, use the following command:

 

sudo rabbitmq-plugins enable rabbitmq_management

 

Please note that for older versions you have to install this plugin separately.

That’s all. Now I can use the RabbitMQ server by writing the following command to control RabbitMQ:

 

sudo /etc/init.d/rabbitmq-server {start|stop|status|rotate-logs|restart}

 

For instance, RabbitMQ server status will be shown as depicted below:

 

 

All is okay up to now. Well, after some investigation I have decided to measure the following available metrics:

  •  osd_pr – The percentage of open socket descriptors RabbitMQ server to the allowed maximum number of open sockets by process.
  •  ofd_pr – The percentage of open file descriptors RabbitMQ server to the allowed maximum number of open files by process.
  •  cpu_usage – the percentage of cpu usage by RabbitMQ server.
  •  mem_usage – the percentage of memory usage by RabbitMQ server.
  •  msg_in_queue – the number of messages that are still in the queue.
  •  timeout – queues timeout in seconds.
  •  pub_rate – Average value of total published messages into queues per second.
  •  from_client_rate – Total inbound throughput value estimated in Kbytes per second.
  •  to_client_rate – Total outbound throughput value estimated in Kbytes per second.
  •  get_rate – Average value of total got messages from queues per second.
  •  status – the evaluation of health status of RabbitMQ server (OK, IDLE, NOK, FAIL)

 

The health status of RabbitMQ should be evaluated as ‘NOK’ when at least one of the following events is detected:

  • The percentage of open file descriptors (ofd_pr) exceeds 90%
  • The percentage of open socket descriptors (osd_pr) exceeds 90%
  • The percentage of used Erlang processes to available Erlang processes exceeds 90%
  • The percentage of memory usage (mem_usage) exceeds 95%
  • The percentage of cpu usage (cpu_usage) exceeds 95%
  • There are messages in the queue (msg_in_queue > 0)

The health status ‘FAIL’ should be generated when RabbitMQ server is unavailable for some reason and the health status ‘IDLE’ should be generated when RabbitMQ server isn’t receiving any messages from clients.

It seems that is all I want for now. Okay, I developed quite quickly such a Bash Script for monitoring and got the following set of files:

monitis_api.sh         Monitis API wrapper implementation

monitis_util.sh        Utilities function set

monitis_global.sh      Monitis API wrapper global variables

monitis_constant.sh    Monitis API constants

rabbitmq_monitor.sh    RabbitMQ custom monitor implementation

monitor_constant.sh    RabbitMQ monitor constants

rmqmon_start.sh        Main executable script

ticktick.sh            Bash JSON parser

Note that I have really developed only the “rabbitmq_monitor.sh” script. The other scripts were simply adapted. Please also notice that I have to use the third party open source JSON parser (to allow processing JSON in bash script) because RabbitMQ Management HTTP API responses are in the JSON form.

 

Well, now it’s time for testing.

I have prepared two clients on JavaScript (Node.js) and Java for connecting to RabbitMQ. In addition, the load simulator was prepared in a way that is intended to generate quite a big load for processing.

So, I have run the monitor and simulator and after some time opened my dashboard in Monitis. The tests showed nice results which I saw in the Monitis dashboard:

 

Beside this, double-clicking on any line leads to an alternate view which shows additional data about the RabbitMQ state at that moment.

 

Eventually, you can also see a graphical representation of your data:

 

I built a rule for notification by using Monitis dashboard features and, satisfied, went to rest.

Perfect, let me summarize. I have obtained in a very short time the desired tool and moreover it can send me a notification any time of day about any troubling situation in my RabbitMQ engine.

Finally, I have uploaded the monitor I created into GitHub where you can find more details about it.

 

 

 

Share Now:del.icio.usDiggFacebookLinkedInBlinkListDZoneGoogle BookmarksRedditStumbleUponTwitterRSS

Read the original blog entry...

More Stories By Hovhannes Avoyan

Hovhannes Avoyan is the CEO of Monitis, Inc., a provider of on-demand systems management and monitoring software to 50,000 users spanning small businesses and Fortune 500 companies.

Prior to Monitis, he served as General Manager and Director of Development at prominent web portal Lycos Europe, where he grew the Lycos Armenia group from 30 people to over 200, making it the company's largest development center. Prior to Lycos, Avoyan was VP of Technology at Brience, Inc. (based in San Francisco and acquired by Syniverse), which delivered mobile internet content solutions to companies like Cisco, Ingram Micro, Washington Mutual, Wyndham Hotels , T-Mobile , and CNN. Prior to that, he served as the founder and CEO of CEDIT ltd., which was acquired by Brience. A 24 year veteran of the software industry, he also runs Sourcio cjsc, an IT consulting company and startup incubator specializing in web 2.0 products and open-source technologies.

Hovhannes is a senior lecturer at the American Univeristy of Armenia and has been a visiting lecturer at San Francisco State University. He is a graduate of Bertelsmann University.

@ThingsExpo Stories
The Internet of Things is not new. Historically, smart businesses have used its basic concept of leveraging data to drive better decision making and have capitalized on those insights to realize additional revenue opportunities. So, what has changed to make the Internet of Things one of the hottest topics in tech? In his session at @ThingsExpo, Chris Gray, Director, Embedded and Internet of Things, discussed the underlying factors that are driving the economics of intelligent systems. Discover how hardware commoditization, the ubiquitous nature of connectivity, and the emergence of Big Data a...
"BSQUARE is in the business of selling software solutions for smart connected devices. It's obvious that IoT has moved from being a technology to being a fundamental part of business, and in the last 18 months people have said let's figure out how to do it and let's put some focus on it, " explained Dave Wagstaff, VP & Chief Architect, at BSQUARE Corporation, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
The major cloud platforms defy a simple, side-by-side analysis. Each of the major IaaS public-cloud platforms offers their own unique strengths and functionality. Options for on-site private cloud are diverse as well, and must be designed and deployed while taking existing legacy architecture and infrastructure into account. Then the reality is that most enterprises are embarking on a hybrid cloud strategy and programs. In this Power Panel at 15th Cloud Expo (http://www.CloudComputingExpo.com), moderated by Ashar Baig, Research Director, Cloud, at Gigaom Research, Nate Gordon, Director of T...
SYS-CON Events announced today that IDenticard will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. IDenticard™ is the security division of Brady Corp (NYSE: BRC), a $1.5 billion manufacturer of identification products. We have small-company values with the strength and stability of a major corporation. IDenticard offers local sales, support and service to our customers across the United States and Canada. Our partner network encompasses some 300 of the world's leading systems integrators and security s...
SYS-CON Events announced today that Windstream, a leading provider of advanced network and cloud communications, has been named “Silver Sponsor” of SYS-CON's 16th International Cloud Expo®, which will take place on June 9–11, 2015, at the Javits Center in New York, NY. Windstream (Nasdaq: WIN), a FORTUNE 500 and S&P 500 company, is a leading provider of advanced network communications, including cloud computing and managed services, to businesses nationwide. The company also offers broadband, phone and digital TV services to consumers primarily in rural areas.

ARMONK, N.Y., Nov. 20, 2014 /PRNewswire/ --  IBM (NYSE: IBM) today announced that it is bringing a greater level of control, security and flexibility to cloud-based application development and delivery with a single-tenant version of Bluemix, IBM's platform-as-a-service. The new platform enables developers to build ap...

The BPM world is going through some evolution or changes where traditional business process management solutions really have nowhere to go in terms of development of the road map. In this demo at 15th Cloud Expo, Kyle Hansen, Director of Professional Services at AgilePoint, shows AgilePoint’s unique approach to dealing with this market circumstance by developing a rapid application composition or development framework.
“In the past year we've seen a lot of stabilization of WebRTC. You can now use it in production with a far greater degree of certainty. A lot of the real developments in the past year have been in things like the data channel, which will enable a whole new type of application," explained Peter Dunkley, Technical Director at Acision, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
DevOps Summit 2015 New York, co-located with the 16th International Cloud Expo - to be held June 9-11, 2015, at the Javits Center in New York City, NY - announces that it is now accepting Keynote Proposals. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long development cycles that produce software that is obsolete at launch. DevOps may be disruptive, but it is essential.
"People are a lot more knowledgeable about APIs now. There are two types of people who work with APIs - IT people who want to use APIs for something internal and the product managers who want to do something outside APIs for people to connect to them," explained Roberto Medrano, Executive Vice President at SOA Software, in this SYS-CON.tv interview at Cloud Expo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
Nigeria has the largest economy in Africa, at more than US$500 billion, and ranks 23rd in the world. A recent re-evaluation of Nigeria's true economic size doubled the previous estimate, and brought it well ahead of South Africa, which is a member (unlike Nigeria) of the G20 club for political as well as economic reasons. Nigeria's economy can be said to be quite diverse from one point of view, but heavily dependent on oil and gas at the same time. Oil and natural gas account for about 15% of Nigera's overall economy, but traditionally represent more than 90% of the country's exports and as...
The Internet of Things is a misnomer. That implies that everything is on the Internet, and that simply should not be - especially for things that are blurring the line between medical devices that stimulate like a pacemaker and quantified self-sensors like a pedometer or pulse tracker. The mesh of things that we manage must be segmented into zones of trust for sensing data, transmitting data, receiving command and control administrative changes, and peer-to-peer mesh messaging. In his session at @ThingsExpo, Ryan Bagnulo, Solution Architect / Software Engineer at SOA Software, focused on desi...
"At our booth we are showing how to provide trust in the Internet of Things. Trust is where everything starts to become secure and trustworthy. Now with the scaling of the Internet of Things it becomes an interesting question – I've heard numbers from 200 billion devices next year up to a trillion in the next 10 to 15 years," explained Johannes Lintzen, Vice President of Sales at Utimaco, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
"For over 25 years we have been working with a lot of enterprise customers and we have seen how companies create applications. And now that we have moved to cloud computing, mobile, social and the Internet of Things, we see that the market needs a new way of creating applications," stated Jesse Shiah, CEO, President and Co-Founder of AgilePoint Inc., in this SYS-CON.tv interview at 15th Cloud Expo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that Gridstore™, the leader in hyper-converged infrastructure purpose-built to optimize Microsoft workloads, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. Gridstore™ is the leader in hyper-converged infrastructure purpose-built for Microsoft workloads and designed to accelerate applications in virtualized environments. Gridstore’s hyper-converged infrastructure is the industry’s first all flash version of HyperConverged Appliances that include both compute and storag...
Today’s enterprise is being driven by disruptive competitive and human capital requirements to provide enterprise application access through not only desktops, but also mobile devices. To retrofit existing programs across all these devices using traditional programming methods is very costly and time consuming – often prohibitively so. In his session at @ThingsExpo, Jesse Shiah, CEO, President, and Co-Founder of AgilePoint Inc., discussed how you can create applications that run on all mobile devices as well as laptops and desktops using a visual drag-and-drop application – and eForms-buildi...
We certainly live in interesting technological times. And no more interesting than the current competing IoT standards for connectivity. Various standards bodies, approaches, and ecosystems are vying for mindshare and positioning for a competitive edge. It is clear that when the dust settles, we will have new protocols, evolved protocols, that will change the way we interact with devices and infrastructure. We will also have evolved web protocols, like HTTP/2, that will be changing the very core of our infrastructures. At the same time, we have old approaches made new again like micro-services...
Code Halos - aka "digital fingerprints" - are the key organizing principle to understand a) how dumb things become smart and b) how to monetize this dynamic. In his session at @ThingsExpo, Robert Brown, AVP, Center for the Future of Work at Cognizant Technology Solutions, outlined research, analysis and recommendations from his recently published book on this phenomena on the way leading edge organizations like GE and Disney are unlocking the Internet of Things opportunity and what steps your organization should be taking to position itself for the next platform of digital competition.
The 3rd International Internet of @ThingsExpo, co-located with the 16th International Cloud Expo - to be held June 9-11, 2015, at the Javits Center in New York City, NY - announces that its Call for Papers is now open. The Internet of Things (IoT) is the biggest idea since the creation of the Worldwide Web more than 20 years ago.
As the Internet of Things unfolds, mobile and wearable devices are blurring the line between physical and digital, integrating ever more closely with our interests, our routines, our daily lives. Contextual computing and smart, sensor-equipped spaces bring the potential to walk through a world that recognizes us and responds accordingly. We become continuous transmitters and receivers of data. In his session at @ThingsExpo, Andrew Bolwell, Director of Innovation for HP's Printing and Personal Systems Group, discussed how key attributes of mobile technology – touch input, sensors, social, and ...