The following certifications have in common that you can self-study for the exams and do not need to attend expensive classroom training. Especially in unsure economic times these certifications can give you an advantage and improve your career. Continue reading
Sometimes you need to replace a word / sentence / string that appears multiple times on a website. With the command line this is a very easy task.
This command replaces the string “old-string” with “new-string” in all files in the current directory:
sed -i 's/old-string/new-string/g'
For a recursive find and replace that will also replace strings in subfolders use this instead:
grep -rlZ 'old-string' * | xargs -0 sed -i 's/old-string/new-strjng/g'
The Z and 0 parameters are needed to handle filenames with spaces in the filename. They prevent the dreaded “No such file or directory” error message when using xargs and sed.
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.
To prevent MySQL from starting up after a reboot edit /etc/init/mysql.conf and comment out the lines with the ‘start on’ directive:
#start on (net-device-up # and local-filesystems # and runlevel ) stop on runlevel 
Unfortunately Ubuntu behaves different than other Debian based distributions here, where you would use the command
update-rc.d -f mysql remove
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.
If you receive the error “scp: ambiguous target” when trying to copy files over the network, it is likely because you forgot to escape a space or other special character in the path (you can escape them with a \).
So instead of
scp file root@server:/some folder/
you will need to write
scp file root@server:/some\ folder/
Here is how-to install Zabbix 2.0.4 on Ubuntu 12.04 Precise.
Edit /etc/apt/sources.list and add the following Zabbix repository:
deb http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main deb-src http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main
Install the public key of the repository and update your package index:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C407E17D5F76A32B sudo apt-get update
2. Install the Zabbix server with
apt-get install zabbix-server-mysql zabbix-frontend-php
This will also install Apache, PHP and MySQL if they have not been installed yet. Then create a user and database called zabbix on the server. Edit /etc/zabbix/zabbix_server.conf and edit the following settings to match your database:
DBName=zabbix DBUser=zabbix DBPassword=<your_password>
Import the database structure
cd /usr/share/zabbix-server-mysql/ gunzip *.gz mysql -u zabbix -p zabbix < schema.sql mysql -u zabbix -p zabbix < images.sql mysql -u zabbix -p zabbix < data.sql
The order in which you import the sql files is important, if you import them in another order your will receive foreign key constraint errors. The Zabbix server is set up now and you can start it. First edit /etc/default/zabbix-server and set start
The output of ps aux should show /usr/sbin/zabbix_server in the process list, if not please check the log file /var/log/zabbix-server/zabbix_server.log for errors.
3. Configure the Zabbix webinterface
Zabbix has certain PHP requirements, so edit /etc/php5/apache2/php.ini and set
post_max_size = 16M max_execution_time = 300 max_input_time = 300 date.timezone = UTC
Copy the sample Apache configuration file into the Apache directory, make sure the Apache alias module is enabled and restart Apache
cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/conf.d/zabbix.conf a2enmod alias /etc/init.d/apache2 restart
Copy the sample php configuration file to the Zabbix folder
cp /usr/share/doc/zabbix-frontend-php/examples/zabbix.conf.php.example /etc/zabbix/zabbix.conf.php
and update your database details in /etc/zabbix/zabbix.conf.php
$DB['DATABASE'] = 'zabbix'; $DB['USER'] = 'zabbix'; $DB['PASSWORD'] = '<your_password>';
The installation is now complete and you can login to the webinterface at http://<your_server>/zabbix/ with the default user admin and the password zabbix.
4. Install the Zabbix client
To install the Zabbix client just follow the prerequisites in step 1 if not done so already, then install the client with
apt-get install zabbix-client
Edit /etc/zabbix/zabbix_agentd.conf and set the Server variable to the hostname or IP address of your Zabbix server.
Restart the Zabbix agent with
and login to the Zabbix webinterface, go to Configuration > Hosts and click on Create host. Enter the client host name and an IP address or DNS name, select a group it should be part of, e.g. Linux servers, click on Templates and select a template like Template OS Linux, and finally click Save.