Using Jabber/XMPP for event notification with Zend Server and/or PHPCloud

Leave a comment

I have removed this service due to possible abuse.  It was intended to be a test and I think I’ve gotten what I need


There was something I’ve wanted to try for a little while.  Messaging is something that’s interested me and with all of the work I’ve been doing on the Zend Developer Cloud I’ve been interested in seeing how to make things communicate a little better.  One of the ideas I’ve wanted to try was to use instant messaging for notification when  slow request or large memory usage events occur.

So to test this out I decided to write a handler that would take events and pass them off to a Jabber server.  That way when the events occur they’ll be passed to your IM client instead of flooding your email client.

It took a little longer than I wanted, mostly due to the fact that the XMPP protocol is new to me, many of the examples don’t work and it required setting up a server that I was not familiar with.  I ended up using the XMPPHP library and the Openfire server to do my dirty work.  I used PHPCloud as dev environment.

So what I’m going to do is open it up to anyone who wants to try it.  I make no guarantees as to its usefulness or stability but I figured that it would be cool to try.

First of all, you will need an XMPP/Jabber IM client.  I used Trillian and it worked fine.

Next, sign up with this form


This will provide an email address for you that you will copy and past into your instance of Zend Server.  Log in to your instance of Zend Server, or click on the link if you are in the DevCloud and go to Server Setup -> Monitor. For the mail server, enter in (because that’s where the notification messages will go), set whatever you want for the Sender Email Address and change the Monitor Rules Default Emails setting to the email address provided in the form above.

Now go to the Monitor settings under Rule Management.

Select all of the rules, or just the ones you want notifications for, select Email Emailing Action and click Change.  You may need to restart Zend Server.

After that you need to take your XMPP/Jabber client and connect it to my server.  Your credentials will be your [email protected], with the password you specified.

Now the next time an event occurs on your Zend Server or DevCloud system you should get a message in your IM like this.

Note that this is NOT an officially supported Zend service, I am just trying this out and wanted to offer it to others to see if they wanted to try it out too.


If you want to see how to set it up, here is a YouTube video of how it works.

The benefit of Zend Server Monitoring

Leave a comment

I was sitting at my computer this morning when an email came in notifying me that there was an error indexing my Lucene content.  This error was generated by the Zend Server event monitoring system.  I went to the site and tried doing a search but saw that the results were coming up double.

I re-ran the indexing task and the searches started coming up the way they should.  Mean time to resolution? 5 minutes.  Customer impact?  Zero.  Why?  Because I knew there was a problem before anyone coming to the site did.  THAT is the benefit of Zend Server Event Monitoring.

Server Monitoring, Studio Tasks and Gmail?

Leave a comment

I deployed this blog about a week ago.  Since then there has been little traffic, mostly  because I have not promoted it and I have also been working on a bunch of other content and such.  Since I also just needed to just get it out the door and running I have not spent a lot of time testing for performance.  This blogging app is based off of Zend_Application and as such there is a bit of overhead.  Since I was not expecting traffic to be that heavy I was not (and am not) overly concerned about snappy performance at this point.  As long as the page loads and displays in the browser I’m fine with it.

One of my goals with this blog is to show real life examples of how to use Zend Server.  While I am not overly concerned about the performance of this blog for the time being I am still monitoring it to make sure that it performs well.  That means Monitoring.

However, Monitoring is really not all that beneficial if you don’t know what is happening on your server.  To get around that issue, Monitoring has a feature where you can send an email to one or more email addresses when an event occurs, such as slow page load times or a fatal error.  This is great… except that people ignore emails.  We’re conditioned to.  As great as Spam in a can is (I’m not Hawaiian, but Spam is a delicacy IMHO), Spam in the Inbox has conditioned us to ignore the things we’re not interested in.  And, to be honest, we’re not interested in fixing problems.  We’d rather be doing new and cool things.

Task driven development is part of the Agile process.  Test driven development is too, but I’m going to talk about Task driven development.  What that basically means is that if there is something to be done, a task is created and it is worked on by the next available developer.  The benefit of this is that with short, well defined tasks, it is easy to track the progress that is being made on a project.  That is why task driven development is part of Zend Studio.

“What?  I thought you were talking about Monitoring?”  Yep.  Still am.  What I am going to show you is how you can integrate Monitoring with Zend Studio using Gmail to make you a better developer.

First, we need to set up our Gmail account.  Log in with your email address and go to Gmail’s “Settings” -> “Labels” section and create a new label called “Task”.

Create Label

Next, click on “Filters”.  Create a new filter and enter a “From” address; [email protected] in my case.  The actual email address is relatively unimportant, and doesn’t really need to exist, as mine doesn't.  What is important is that you can match it up with the “From” address that Monitoring will use, which we will set up later on.  Click on “Next Step” and tell it to apply the label “Task” to any message coming in from that email address.

Filter Step 1

Filter Step 2

Zend Studio has the ability to connect in with Mylyn task connectors.  To access this, go to the Planning perspective in Zend Studio.  On the right hand side you should see a View window that says “Task Repository”.  From there you can right click on the screen and select “Add Task Repository”.  You will be asked to choose a specific type of task repository.  I will use the Gmail type.  If you don’t have the Gmail connector installed click on “Install More Connectors” and install it from there.  You may need to restart Studio (“may” meaning you will need to).  You may (same thing) need to create a TaskTop account.  It seems to be free.

Add Repository

Once you’re back up, go back to the same view and get to the “Add Task Repository” window again.  This time select Gmail as the repository type.  Enter in your email address and your password, but set “Task” as the label.  Click Finish.

Add Label

Then you will probably get a window popping up asking if you want to configure a query.  Of course you do.  Set the title of the query as "Task" and then choose the label that you want to query by.  This should be the new label that you had entered earlier on.

Set Query

Next we will go into the Zend Server admin GUI.  Select “Server Setup” and then “Monitor”.  From there you should see some mail server settings.  The sender email address is the one you set up for the “from” address in the Gmail filter; [email protected] in my case.  Click Save.

Monitor Mail Settings

From there go to the “Rule Management” tab and select the rule that you want to receive alerts for.  Scroll down to “Step 2: Event Action”. Enter in your Gmail email address here, save it and restart PHP.  I chose Slow Request Execution.  And since slow requests are difficult to debug I also chose to enable Code Tracing when a slow request occurs.

Monitor Action

Now you wait for an event to occur.  Me?  I just refreshed the home page.  (I may have some optimizations to do).  Go back to the Planning perspective and right click on the task list and click “Synchronize”.  You should see a new task listed.  Double click on it and you should see something like the following.

Task Received

Now, rather than using your email program and ignoring messages that come in, you can have them directly integrated into a simple task management system.


  1. Create Label in Gmail called "Task" with a filter for the "From" address, set up in Zend Server
  2. Add Mylyn connector for Gmail and set up to use your Gmail account with the label "Task"
  3. Set up Zend Server Monitoring to send monitoring events from the "From" address
  4. For a specific event set it to send an email to your Gmail account
  5. Wait for events to come in.
  6. Fix them