Turn on SNMP in Asuswrt-Merlin

Asus routers like the RT-N66U have support for SNMP in the latest firmware. Here is how to enable and test it (here using the awesome Asuswrt-merlin alternative firmware ).

Go To Administration and click on SNMP. Enable SNMP, enter a system name, system location, SNMP Get Community (just any text, this acts like a password). Click on Apply to activate the changes.


To test if SNMP is working you can use the snmpwalk command. If your router IP address is and your SNMP Get Community string is ‘public’, run

snmpwalk -Os -c public -v2c iso.

The output should look like “iso. = STRING: “Linux RT-N66U #1 Thu Nov 20 13:57:15 EST 2014 mips” if SNMP is working. If it is not working you will receive a message like “Timeout: No Response from”.

To get more data from SNMP run ‘snmpwalk -Os -c public -v2c’


HTML status update for old people

Has it been a while till you created your last webpage? Here is a quick update on what happened since the last century.

A basic HTML template would look like this now.

<!DOCTYPE html>

        <title>Title of the page</title>



The long DOCTYPE declaration is gone, in HTML5 you only need to write <!DOCTYPE html>. This should always be your first line on every page so that the browser knows your page is an HTML page.

If you want to add JavaScript code only specify

  // your code

Do not add type=”text/javascript” to the script tag, JavaScript is the default script language nowadays.

We useJavaScript libraries now instead of writing everything from scratch. These provide useful functions that will automagically work in all the different browsers, be it on a desktop PC, tablet, phone or whatever kind of networked device. jQuery is one example for a good library, ou can learn how to use at http://learn.jquery.com/ and http://www.w3schools.com/jquery/default.asp. If you need some help with JavaScript first, check out http://www.w3schools.com/js/default.asp.
Instead of downloading jQuery, you only need to link to a copy of it on Microsoft’s or Google’s servers, e.g. with <script src=”//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js”></script>. A complete HTML page template will follow at the end of this post. Please note the two  forward slashes, these make sure that the library is loaded with the same protocol as the webpage (http or https). Groovy.

In general we need to write way less code, there are tons of libraries, frameworks, tools and web services to make our lives easier. One of these frameworks is Bootstrap which will help you create beautiful, professional looking websites without you having to design anything. The huge advantage of such tools is that the code is tested and works in multiple browsers. If you remember testing websites on Internet Explorer or Netscape on a Mac that is something that you will really appreciate. Like with jQuery there is no need to download a local copy of Bootstrap and you can directly include it from an external server with <link href=”//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css” rel=”stylesheet”>. Take a look here to see more examples of Bootstrap in action.

And here a complete template for a modern HTML5 page.

<!DOCTYPE html>
<html lang="en">

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>Title of the page</title>
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">


                <h3>My first project</h3>

            </div> <!-- /header -->
                 <h1>HTML is fun again</h1>

                <p>Just believe you can do it and you are halfway there.</p>
        </div> <!-- /container -->
        <!-- JavaScript at the end so the page loads faster -->
        <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
        <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>


This template is just a start, there are websites like html5boilerplate.com where people spend a lot of time to create the perfect HTML5 template. But it is simple and before going further, just try to modify this page with some jQuery code and find out what else you can do with bootstrap.


Google Adsense disappoints

I recently received a message that my Google AdSense account has been disabled. A search shows that this actually happens quite a lot. The email says it is due to invalid activity on my website but they are not willing to provide more information.

I did not get any money from the ads so far and it looked like they will only cover the monthly hosting costs but I was still looking forward to receive my first payment. However now Google will just keep the money I earned in the last months. Not the way to do business.

After the recent disappointments with Google Apps and Google Reader plus the various Google contact forms where you never receive a reply I am at a point where I will be very careful before recommending any of Google products. The same is true for products from Microsoft and Oracle but that is another story.


Planning for High Availability in the cloud

Cloud computing makes high availability affordable. You can launch extra servers when your system goes down and do not need any extra hardware in stock any more. Costs for your failover systems are low since you only pay for what you actually use.

High availability does not mean your system will never be offline. But you can reduce the downtime to a minimum and to a level that has been agreed to between the IT department and senior management in form of a Service Level Agreement (SLA). The higher the availability the higher the costs, so you will need to find an acceptable balance here.

The goal in designing your system is to have a certain amount of fault tolerance. That means if a part of your system goes down your application will still function, albeit a bit slower or otherwise limited. You might have two database servers that are in sync for example, so that one can take over if the other one fails. This also means you have to prevent single points of failure (SPOF).

Part of the planning for high availability is to prepare a disaster recovery (DR) plan which should include processes, policies and procedures for restoring your systems after a catastrophic event. In it you also need to define how long your system may be offline in the worst case. We call this the Recovery Time Objective (RTO). Then there is a Recovery Point Objective (RPO) that defines how much data loss is acceptable, for example it may be acceptable to loose the data of people that subscribed to your newsletter in the last hour. If you don’t need to recover all data you might be able to get your systems back up faster, e.g. from a snapshot that is made in regular intervals, thus reducing your recovery time.


Optimize Apache for EC2 micro and small instances

If you are running a blog or content management system like WordPress or Drupal on an Amazon micro or small instance you will likely have to make some optimizations to the Apache configuration. Otherwise the Apache webserver or the MySQL database will crash sooner or later and the dmesg command will show something like

[9681301.397227] Out of memory: Kill process 23954 (apache2) score 26 or sacrifice child
[9681301.397260] Killed process 23954 (apache2) total-vm:361812kB, anon-rss:32540kB, file-rss:4kB
[9749304.960885] type=1400 audit(1358511480.422:43): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=30604 comm="apparmor_parser"

You can test if your site needs optimization by running the simple ab Apache benchmarking tool that comes bundled with the Apache installation.

ab -n 5000 -c 20 http://www.yourserver.com/

This command may slow down your server a bit but may never crash it. If it does, edit the /etc/apache2/apache2.conf configuration file and make the following changes.

KeepAliveTimeout 3
<IfModule mpm_prefork_module>
    StartServers           1
    MinSpareServers        1
    MaxSpareServers        5
    ServerLimit           50
    MaxClients            50
    MaxRequestsPerChild 5000

Now restart Apache

/etc/init.d/apache2 restart

and run the ab command again to see if this fixes the issue. If it does not, check http://library.linode.com/troubleshooting/memory-networking#sph_mysql-low-memory-settings and reduce the MySQL memory usage, disable MySQL InnoDB support if you don’t use it, check the memory_limit in your php.ini and further reduce the Apache settings.


This week in IT

This week in IT saw the release of Fedora 18. It comes with Secure Boot support, a new installer and all the latest software packages. For example Samba 4 that allows Fedora to be used as an Active Directory domain controller.
The tmp folder for temporary files now resides fully in memory thanks to Tmpfs. Bigger files must therefore be stored in /var/tmp/.
The upgrade process changed a bit and you have to use a tool called FedUp to upgrade from the previous release. How do they come up with these names? More Fedora 18 features can be found at http://fedoraproject.org/wiki/Releases/18/FeatureList.

We also saw what happens when big corporations own news channels: http://news.cnet.com/8301-30677_3-57563877-244/the-2013-best-of-ces-awards-cnets-story/.

And last and least Microsoft requires cell phones to come with CD drives now: http://media.bestofmicro.com/A/Y/368458/original/Windows-phone-installation-disc.jpg