Search This Blog

Wednesday, May 16, 2012

Trac Hacks - Plugins Macros etc. - Trac

Trac Hacks - Plugins Macros etc. - Trac:

Welcome to Trac Hacks

The purpose of TracHacks is to provide free Subversion hosting for community created Trac hacks.
TracHacks uses the excellent TagsPlugin, which adds basic categorisation to Trac. All hacks are tagged with one or more of the available tags.

Nagios unable to send email

Nagios unable to send email


May 16 13:02:00 d4 nagios: Warning: Attempting to execute the command "/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: Uptime\nHost:\nAddress:\nState: CRITICAL\n\nDate/Time: Wed May 16 13:02:00 IST 2012\n\nAdditional Info:\n\n(Return code of 127 is out of bounds - plugin may be missing)\n" | /bin/mail -s "** PROBLEM Service Alert: is CRITICAL **"" resulted in a return code of 127.  Make sure the script or binary you are trying to execute actually exists...

user@d4:user$ whereis mail
mail: /usr/bin/mail.mailutils /usr/bin/mail /usr/share/man/man1/mail.1.gz

user@d4:user$ sudo ln -s /usr/bin/mail /bin/mail

Monday, May 14, 2012

Relaying through Google Apps using Sendmail to bypass EC2 spam blockage | Looking for the paradigm

Relaying through Google Apps using Sendmail to bypass EC2 spam blockage | Looking for the paradigm:

Update 3 May 2011: I’ve subsequently modified our EC2 systems to relay SMTP mail through Amazon’s SES which doesn’t have the 500 messages per day limit that Google Apps does.
A few months ago I moved a site into EC2. I didn’t want to move the existing IMAP server (ugh) so I moved the email to Google Apps. There are only about 10 mailboxes so we went with “Standard” edition (free). Once we completed the move to EC2 we discovered that emails from our webserver were bouncing due to our EC2 IP address being listed in a spam RBL. This sucked, so I looked into relaying the mail from the EC2 webserver through our Google Apps account. Fortunately this turned out to be pretty easy.
This wiki page on has a procedure for setting up SMTP relaying in Ubuntu with TLS & auth. I’m not running Ubuntu so the paths were different but it was basically the same procedure:
  • Create the file /etc/mail/client-info with these "" "" "P:superpassword", where “” is your Google Apps domain, “bounces” is a valid account, and the password is the account’s password. Mail relayed with these credentials will show “” in the From: field of the message.
  • In /etc/mail, run makemap hash client-info < client-info
  • Edit /etc/mail/, adding or uncommenting these lines:
    define(`SMART_HOST', `')dnl
    FEATURE(`authinfo', `hash /etc/mail/client-info')dnl
  • Recompile m4 > . I got this error: "/etc/mail/ m4: Cannot open /usr/share/sendmail-cf/m4/cf.m4" when running the command, but I resolved it by doing yum install sendmail-cf
  • Restart sendmail.
Once this was done I sent myself a test message from the command line and received it; I checked the SMTP headers and sure enough it went through Google's mail server. One nice side effect is that all the mail sent by the webserver appears in the "Sent" folder for the Google Apps username provided in the client-info file. Hopefully this will resolve the spam issues, since the mail is now coming from Google's IP block.

Integrating Amazon SES with Sendmail - Amazon Simple Email Service

Integrating Amazon SES with Sendmail - Amazon Simple Email Service:

Sendmail was released in the early 1980s, and has been continuously improved ever since. It is a very flexible and configurable MTA, and it has a large installed base.
For information about Sendmail, go to
To configure integration using STARTTLS
  1. Edit the /etc/mail/authinfo file. If the file does not exist, create it. Add the following lines to the file, replacing USERNAME and PASSWORD with your SMTP user name and password. "U:root" "I:USERNAME" "P:PASSWORD" "M:LOGIN" "U:root" "I:USERNAME" "P:PASSWORD" "M:LOGIN"
  2. Save the authinfo file.
  3. At a command prompt, issue the following command to generate the Sendmail configuration file:
    makemap hash authinfo < authinfo
  4. Edit the /etc/mail/ file. If the file does not exist, you can obtain it by installing the package on your system. In the file, add the following lines:
    define(`SMART_HOST', `')dnl
    define(`RELAY_MAILER_ARGS', `TCP $h 25')dnl
    define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl
    FEATURE(`authinfo', `hash -o /etc/mail/authinfo.db')dnl
    Be sure that relaying is allowed for in the /etc/mail/access file.
  5. Save the file.
  6. Issue the following command:
    m4 /etc/mail/ > /etc/mail/

    if you get following error
    m4:/etc/mail/ cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory
    yum install sendmail-cf

AWS Developer Forums: How do I resolve these duplicates ...

AWS Developer Forums: How do I resolve these duplicates ...:

If sudo yum update --skip-broken does not work. Then do the below.

package-cleanup --dupes
package-cleanup --cleandupes

amazon ec2 - Broken yum package tree - Server Fault

amazon ec2 - Broken yum package tree - Server Fault:

update your system
yum clean all
yum update
Then if you need python 2.6 try installing it via yum

AWS Developer Forums: Sendmail not playing nice with SES ...

AWS Developer Forums: Sendmail not playing nice with SES ...:

I understand some of the permissions warnings, as I did open up some of the permissions for testing, but that shouldn't cause a problem, should it?

Does anyone have any suggestions? Email is the last hurdle before I move my entire site to AWS, and I'd like to stick with AWS solutions (namely SES) if possible, but it's starting to look like I need to look around some more for other email relays.
PermlinkReplies: Pages: Last Post: Sep 12, 2011 6:12 AM by: Igor@AWS

Re: Sendmail not playing nice with SES
Posted by:  Igor@AWS
Posted on: Sep 12, 2011 6:12 AM
in response to: Nathan G Barhorst in response to: Nathan G Barhorst
 Click to reply to this threadReply
Hi Nathan,

From your logs, it seems that you’ve configured the mailer correctly (although you need to address the permissions warnings). However, you get errors when sendmail tries to call Here are some debug steps:
  • Stop current sendmail instance
  • Start sendmail in debug mode:
sendmail -bD -O LogLevel=20 -X /tmp/sendmail.log
  • Send a test email
  • Open /tmp/sendmail.log file
  • You should see entries similar to:
EXEC -r -k ... -e -f ...-
  • Check out the errors

Hope this helps,

Sunday, May 13, 2012

TechCauldron: Mobile share of web traffic in Asia has tripled since 2010

TechCauldron: Mobile share of web traffic in Asia has tripled since 2010:

Nearly 50% of web traffic in India is from the mobile ! Not surprising at all given the mobile phone penetartion vs PC, data capability of phones entry level upwards and aggressive push by whole ecosystem (handset manufacturers, operators, content providers) towards increasing data adoption. The mobile is enabling the first internet experience for many !

In just over two years, the share of web traffic in Asia that comes from mobile devices has almost tripled. In fact, in some countries, close to half of all web traffic comes from mobile devices. India is very close to mobile traffic breaking 50% of all web traffic, as are several other countries in Asia as well as Africa.

The world is changing, and it’s changing fast

If you look at the top countries in the world ranked by number of mobile phones, there’s little surprise that China is the number one, followed by India, United States, Brazil, and Indonesia.
But if we look at the percentage of users that go online with a mobile device compared to with a computer, the list changes.
In late 2010, we investigated what part of all web usage across the world was mobile, and we’ve done so again with the latest figures available. This is what it looks like right now:
Mobile versus desktop web traffic
Comparing the figures from 2010 to the current ones reveals a dramatic increase in just over two years:
Mobile share of web traffic
20102012Increase 2010-2012
North America4.71%7.96%69.00%
South America1.46%2.86%95.89%
We should point out that these numbers are percentages out of the total of web traffic and do not reflect any change in the absolute number of people or devices.
But by all accounts, mobile web traffic counted in absolute numbers is virtually exploding in the next few years.

Countries with largest mobile share of web traffic

When we dig a little deeper into this information, we find that, in several countries, mobile web traffic is close to overtaking web traffic from computers.  Over at The Next Web, Jon Russell recently predicted that mobile web traffic in India will overtake PC web traffic this year, which seems pretty likely to happen.
Right now, the countries with the highest share of mobile traffic as part of total web traffic are:
  • 48.87% – India
  • 47.09% – Zambia
  • 44.95% – Sudan
  • 42.36% – Uzbekistan
  • 40.65% – Nigeria
  • 37.95% – Zimbabwe
  • 35.46% – Laos
  • 34.66% – Brunei
  • 31.79% – Ethiopia
  • 29.2% – Kenya
As you can see, Africa and Asia split the list between them. Africa amassed six countries, which left Asia with four.
The first European country is the United Kingdom with 10.71%, and the U.S. showed 8.61% mobile web traffic as share of all web traffic.
It’s worth noting that Europe scored a 183.43% increase in mobile browsing share over this period, not that far behind Asia. But with the mobile share only increasing from 1.81% to 5.13%, Europe is still far behind both Africa and Asia when it comes to the percentage of users accessing the web using mobiles.

The trend is set to continue

Worldwide, mobiles only account for about 10% of web access, but it’s a figure that is growing fast. With some countries already closing in on 50% of web traffic coming from mobiles – with India in the lead – it’s safe to assume this development will only continue.
Clearly, people are taking to their mobile devices all over the world to get on the Internet, but more so in Africa and Asia than elsewhere.
This is a very interesting development to follow, and we’re sure to report on it in future articles.
Note about the data: We used data from StatCounter as the basis for our analysis. The data for 2012 covers the first seven days of May, 2012.

Thursday, May 10, 2012

HOWTO: install APC on Debian or Ubuntu

HOWTO: install APC on Debian or Ubuntu:

Step 1
sudo apt-get install make

Step 2
sudo apt-get install libpcre3-dev

Step 3
sudo pecl install apc

Step 4
echo "" > /etc/php5/apache2/conf.d/apc.ini

Step 5
sudo service apache2 restart

pcre.h: No such file or directory when installing APC (PHP extension) | Christer's blog o' fun

pcre.h: No such file or directory when installing APC (PHP extension) | Christer's blog o' fun:

After a complete reinstall of Ubuntu 10.04 on my laptop I had to recreate my development environment. Part of that included installing some extensions from PECL. When trying to install apc-3.1.2 I got the following error:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
I decided to search the package archives for the pcre.h file. To do this I used a command called apt-file (apt-get install apt-file and apt-file update if you don’t have it installed).
apt-file search -x "/pcre.h$"
The -x informs the command that I want to use a regular expression as the pattern. apt-file provided me with three hits:
  • kannel-dev: /usr/include/kannel/gwlib/pcre.h
  • libajax6-dev: /usr/include/ajax/pcre.h
  • libpcre3-dev: /usr/include/pcre.h
The last one is the one I want:
apt-get install libpcre3-dev
Now that I finally have this package I can run pear install pecl/apc-3.1.2 to install APC.