Installing Icinga 1.6.1 on Debian Squeeze with icinga-web

This small how-to briefly describes the installation of icinga 1.6.1 on debian squeeze 6.0 and details the install and configuration of the newest icinga-web (1.6.0).

Unfortunately, the latest icinga package version in debian are:

Because of that we have two choices getting the latest 1.6.1 version of icinga:
Install from source or use the debian packages of icinga in unstable tree (icinga itself is very stable).

  1. simply add

    deb http://ftp.debian.org/debian sid main

    as new line in file /etc/apt/sources.list

  2. do an

    apt-get -t unstable install icinga icinga-idoutils icinga-phpapi

  3. configure icinga & idoutils according to your needs (there is plenty information on the web on this)
  4. Clone recent icinga from git repository (the icinga debian maintainer won’t include icinga-web)

    cd /usr/src && git clone git://git.icinga.org/icinga-web.git

  5. Build icinga-web

    cd icinga-web/ && ./configure –with-api-cmd-file=/var/lib/icinga/rw/icinga.cmd –with-conf-dir=/etc/icinga-web –with-log-dir=/var/log/icinga-web –with-cache-dir=/var/cache/icinga-web

  6. Install Icinga-web

    make install

  7. Install Apache2 config for Icinga-web

    make install-apache-config

  8. Create icinga-web database in mysql

    mysql -u root -p icinga_web < /usr/src/icinga-web/etc/schema/mysql.sql

  9. change database settings in configuration file for icinga itself and icinga-web

    vi /usr/local/icinga-web/app/config/databases.xml

    Line 28: mysql://icinga_web:password@localhost:3306/icinga_web
    Line 79: mysql://icinga-idoutils:password@localhost:3306/icinga

  10. Clear the cache
  11. You should now be able to login to icinga-web with username “root” and password “password” on http://localhost/icinga-web (change password afterwards)

have fun!

Next: Installation and integration of the new InGraph Grapher Addon into icinga-web

Source: Icinga Wiki

Related Posts:

Installing Apache Solr on Debian Squeeze 6.0 and tomcat7

Apache solr logoDue to the lack of an official Apache Solr Package in Debian Squeeze 6.0 this post will briefly describe the installation of tomcat7 together with Apache (Lucene) Solr from Source.

Install tomcat7 package:

apt-get install tomcat7

Download Apache Solr from here, for example:

cd /opt/ && wget http://apache.lehtivihrea.org//lucene/solr/3.4.0/apache-solr-3.4.0.tgz

unpack the package

tar xzfv apache-solr-3.4.0.tgz

copy the solr file to tomcat webapps directory

cp apache-solr-3.4.0/dist/apache-solr-3.4.0.war /var/lib/tomcat7/webapps/solr.war

copy example configs and files to tomcat solr directory

cp -fr example/solr/ /var/lib/tomcat7/

change owner to tomcat

chown -R tomcat7:tomcat7 /var/lib/tomcat7/solr/

restart tomcat

/etc/init.d/tomcat restart

If everything went well you should be able to see the Solr Admin page on http://yourhost.com:8080/solr/admin.
Have Fun!

Related Posts:

NGINX, WordPress and php-fpm on Debian Squeeze

A while ago i published a howto on running nginx+serendipiy+php-fpm with apache style rewriting as implemented in s9y. The described installation is obsolete now – php-fpm made the jump into the regular php versions beginning with php 5.3.3 (see here). In addition to that i made s9y obsolete on my blog and migrated it to wordpress.
The netcraft webserver survey from April 2011 shows that nginx is still increasing slightly and is currently providing access to 8,68% of all monitored domains:

Netcraft Webserver survey april 2011
Time for me to switch to nginx again :)

Manual compiling is cool, but also a bit old-school, that’s why we use packages from Dotdeb in this example:

  1. Add the following two lines into your /etc/apt/sources.list file (example for debian squeeze, see lenny instructions here:

  2. deb http://packages.dotdeb.org stable all
    deb-src http://packages.dotdeb.org stable all

  3. fetch and apply GnuPG key:

  4. wget http://www.dotdeb.org/dotdeb.gpg
    cat dotdeb.gpg | sudo apt-key add -

  5. refresh your sources

  6. apt-get update

  7. Install packages including php5-fpm and nginx:

  8. apt-get install php-apc php-auth php-net-smtp php-net-socket php-pear php5 php5-cgi php5-cli php5-common php5-curl php5-dev php5-gd php5-imagick php5-imap php5-mcrypt php5-mysql php5-pspell php5-sqlite php5-suhosin php5-xmlrpc php5-xsl php5-fpm nginx

  9. First of all i did some modifications (gzip compression and tcp tweaks) to the nginx.conf located in /etc/nginx/nginx.conf

  10. #/etc/nginx/nginx.conf
    worker_processes 2;
    tcp_nopush on;
    tcp_nodelay on;
    # Gzip Settings
    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 1;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

  11. Thanks to the new try_files directive in nginx the vhost configuration (found in /etc/nginx/sites-available) for wordpress is fairly straight forward. (In addition Igor often mentioned that using the if directive in nginx equal to apache usage is evil.). Example vhost configuration code for my blog:

    #/etc/nginx/nginx.conf
    server {
    listen :80;
    server_name andreas-lehr.com;
    server_tokens off;
    root /var/www/virtual/andreas-lehr.com/htdocs;
    index index.php index.html index.htm;
    access_log /var/log/nginx/andreas-lehr.com/access_log;
    error_log /var/log/nginx/andreas-lehr.com/error_log;

    location / {
    index blog/index.php ;
    }

    location /blog/ {
    try_files $uri $uri/ /blog/index.php?q=$uri;
    }

    location ~ \.php$ {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass unix:/dev/shm/php-fastcgi.socket;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
    gzip on;
    }
    }

    please be aware that the blog in the example is running from the sublocation /blog.

  12. php-fpm configuration is located in /etc/php5/fpm. The file php-fpm.conf is the main configuration file which includes everything in the subdirectory pool.d, where i made some modifications to the default www.conf pool file:

  13. #/etc/php5/fpm/pool.d/www.conf
    ;listen = 127.0.0.1:9000
    listen = /dev/shm/php-fastcgi.socket
    php_flag[display_errors] = off
    php_admin_value[error_log] = /var/log/fpm-php.www.log
    php_admin_flag[log_errors] = on
    php_admin_value[error_reporting] = 0
    php_admin_value[memory_limit] = 128M
    php_admin_value[date.timezone] = Europe/Berlin

    As you see i configured only one pool which is running through the unix socket in /dev/shm/php-fastcgi.socket, which should be a bit faster than via local TCP socket. In addition i didn’t change any other performance values in first place (Blog is running with pm = dynamic, pm.max_children = 50, pm.start_servers = 20, pm.min_spare_servers = 5, pm.max_spare_servers = 35, pm.max_requests = 0 which is a lot more than ever needed).
    Finally i changed some php_admin_flags and values accordingly.

  14. Start php-fpm

  15. /etc/init.d/php5-fpm start

  16. Start nginx

  17. /etc/init.d/nginx start

Conclusion:
Now thats really a easy and fast way to install nginx with php-fpm on debian squeeze. This configuration is now running for several weeks on this domain and the pingdom monitoring shows an average response time improvement of about 300ms. In addition the machine now has a lot more reserves considering RAM and CPU.
Coming up next:
Adapting this changes to the piwik and gallery3 installations running here, integration of varnish-cache in this setup.

Related Posts:

Fixing Redmine “undefined local variable or method `version_requirements’” Error

redmine logoAfter a recent update on one of our service machines, redmine (version 1.1.2) crashed during startup with the following error:

Error message:
undefined local variable or method `version_requirements' for #
Exception class:
NameError

Application root:
/opt/redmine

Backtrace:
# File Line Location
0 /var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb 119 in `requirement'
1 /usr/lib/ruby/1.8/rubygems/source_index.rb 269 in `search'
2 /var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/vendor_gem_source_index.rb 119 in `search'
3 /usr/lib/ruby/1.8/rubygems.rb 247 in `activate'
4 /usr/lib/ruby/1.8/rubygems.rb 1276 in `gem'
5 /var/lib/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb 73 in `add_load_paths'
6 /var/lib/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 301 in `add_gem_load_paths'
7 /var/lib/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 301 in `each'
8 /var/lib/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 301 in `add_gem_load_paths'
9 /var/lib/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 132 in `process'
10 /var/lib/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 113 in `send'
11 /var/lib/gems/1.8/gems/rails-2.3.5/lib/initializer.rb 113 in `run'
12 /opt/redmine/config/environment.rb 20
13 /usr/lib/ruby/1.8/rubygems/custom_require.rb 36 in `gem_original_require'
14 /usr/lib/ruby/1.8/rubygems/custom_require.rb 36 in `require'
15 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 318 in `preload_application'
16 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 267 in `initialize_server'
17 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/utils.rb 323 in `report_app_init_status'
18 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 246 in `initialize_server'
19 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 194 in `start_synchronously'
20 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 163 in `start'
21 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/railz/application_spawner.rb 222 in `start'
22 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 253 in `spawn_rails_application'
23 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb 126 in `lookup_or_add'
24 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 247 in `spawn_rails_application'
25 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb 80 in `synchronize'
26 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server_collection.rb 79 in `synchronize'
27 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 246 in `spawn_rails_application'
28 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 145 in `spawn_application'
29 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/spawn_manager.rb 278 in `handle_spawn_application'
30 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 352 in `__send__'
31 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 352 in `main_loop'
32 /var/lib/gems/1.8/gems/passenger-2.2.15/lib/phusion_passenger/abstract_server.rb 196 in `start_synchronously'
33 /var/lib/gems/1.8/gems/passenger-2.2.15/bin/passenger-spawn-server 61

I believe the error came up with the recent version of the rubygems packe provided in debian testing, which is rubygems_1.6.2-1_all.deb in our case.
The error is described in the official redmine “redmine” right here. More information could also be found in the official redmine bulletin board.

We put the code provided in hint 3 of issue 7516 in line 19 of the file config/environment.rb. This hack fixed the error for us for now.
You could also switch over using the unstable trunk version of redmine, roll back your rubygems or wait for the 1.2.0 release of redmine.

Related Posts:

Open Source Data Center Conference 2011 – Speaker gesucht

osdc_logoDie in diesem Jahr bereits zum dritten Mal stattfindende Open Source Data Center Conference zum Thema Einsatz von Open Source Software in Rechenzentren und großen IT Umgebungen ist in diesem Jahr auf den 06. bis 07. April 2011 terminiert. Diesmal steht die in Nürnberg stattfindende Konferenz unter dem zur Zeit allgegenwärtigen Thema “Automatisiertes Systems Management“.
Zur Zeit läuft der Call for Papers für die Konferenz und interessierte Speaker mögen sich bitte unter diesem Formular als Referent bewerben. Wird ein Vorschlag akzeptiert, so ist die Teilnahme und Verpflegung an der kompletten Veranstaltung kostenlos. Zur Inspiration und Entscheidungsfindung ist das bis dato feststehende Vortragsprogramm hier einzusehen.

Ich selbst werde auch in diesem Jahr wieder versuchen, als Teilnehmer dabei zu sein. Die Konferenz bietet nebst interessanten Vorträgen und Workshops ein hervorragendes Ambiente und außerdem die Möglichkeit, sich mit anderen Kollegen auszutauschen.

Nähere Informationen zur Konferenz findet ihr auf der Eventseite zur OSDC bei Netways.

Related Posts:

OpenX Performance optimization with Amazon S3 and CloudFront as CDN

On one of my current projects called diginights.com we are heavily using the popular and free Ad server solution OpenX for banner delivery. To optimize its performance and spread the http connections over multiple domains to boost the page speed we decided to outsource the ad images to a Content Delivery Network (CDN). We chose the Amazon Web Services for a first test due to the easy installation and configuration of their cloud services.
The two services to enable in your Amazon Web Management Console are Amazon S3 (storage solution) and CloudFront (CDN distribution). We sync the images between our root servers and Amazon S3 with the help of the fuse integrated and free filesystem s3fs (FuseOverAmazon).

First of all you need to get an Amazon S3 account on http://aws.amazon.com/s3/ and set up a new S3 Bucket (beware that every bucket name needs to be unique) in a region that fits your needs, create a CloudFront Distribution for the Bucket and wait until its enabled. The images below should be enough to help you with setting up AWS:

Please note the *.cloudfront.net. You’ll need it later for OpenX configuration. You could also set up a CNAME in your DNS system, configure this CNAME in the CloudFront Console and deliver the ad images via this CNAME from OpenX.

Installation of s3fs on our Debian Linux servers is fairly easy:

  1. Grab the recent version of s3fs from its download page and extract it somewhere (eg. /usr/src)
  2. Install installation prequisites via

    apt-get install build-essential libfuse-dev fuse-utils libcurl4-openssl-dev libxml2-dev mime-support

  3. Compile and install s3fs
    • cd s3fs-1.16/
    • ./configure –prefix=/usr
    • make
    • make install (as root)

  4. Put your security credentials either in /root/.passwd-s3fs or the system-wide file /etc/passwd-s3fs. Please take care of the file permissions. The syntax in the file is simple accessKeyId:secretAccessKey ( or bucketName:accessKeyId:secretAccessKey for multiple buckets)
  5. Enable fuse module, if it isn’t already in use:

    modprobe fuse

  6. You should then be able to mount your bucket to your local filesystem:

    s3fs bucketName mountpoint

  7. Put a similar entry in the fstab of your servers:

    s3fs#bucketName /space/amazons3 fuse default_acl=public-read,allow_other 0 0

    public-read is necessary to make sure that copied files are available online for every user.

  8. That’s it for the s3fs part. Now you have to reconfigure your OpenX Installation
  9. Change the Local Directory under Global Settings -> Banner Storage Settings to the directory where your S3 mountpoint is located.
  10. Change the Image Store URL for HTTP & HTTPS under Global Settings -> Banner Delivery Settings to your *.cloudfront.net Domain (Or your own CNAME URL).
  11. Save the settings, sit back and relax! But don’t forget to check your AWS account balance ;)

Related Posts:

Monitoring ESXi and HP Hardware with Nagios/Icinga

All of you might be aware of VMWare ESXi, VMWares powerful and free Hypervisor with 64-bit architecture.
Unfortunately most of the monitoring features from the licensed (and expensive) full version are missing – SNMP gets aren’t possible either, only traps. But there is a way out of this drawback, at least if you’re using HP hardware (should work with G5+) and nagios/icinga as monitoring tool.

First of all the best way to use ESXi on HP hardware is by instaling the ESXi version supplied by HP which can be downloaded here for free. In this version all needed agents and tools in order to monitor the ESXi server with nagios/icinga are already included.

For those who want to upgrade their existing ESXi server(s) HP offers its ESXi bundle as additional ESXi patch (hp-esxi4.0uX-bundle-1.2.zip), download here. In order to deploy it onto the ESXi servers the VMware vSphere CLI is needed, could be obtained from here.

After installing all the prequisites you have to deploy the ESXi bundle to your server. If you`re using a Windows client the command line, called from \bin directory of your vSphere Cli Installation (e.g. C:\Program Files\VMware\VMware vSphere CLI\bin), just use:

vihostupdate.pl –server –install –bundle c:\hp-esxi4.0uX-bundle-1.2.zip

After the next reboot of your server (unfortunately a reboot is necessary) you should be able to find new monitoring sensors in the configuration tab of your vSphere client as shown in the screenshot, e.g. the disk status:

If this works fine we continue with the next step: Monitoring multiple ESXi Servers with nagios/icinga
There are mulitiple versions of the python script check_esx_wbem.py in the net, but only some of them work properly with HP Hardware. (there is also a version which should be working with hardware from dell )
Requirements for the script are Python 2.6 and the Python extension pywbem.
The script we are using has proofed its functionality several times, you can obtain it from here or directly from my site here.

Command usage is:

Command: python $USER1$/check_esxi_wbem.py https://$HOSTADDRESS$:5989 $ARG1$ $ARG2$ $ARG3$

example error would look like this:

/libexec # python check_esx_wbem.py https://vmware42.google.dmz:5989 statistics password hp
CRITICAL : Disk 4 on HPSA1 : Port 1I Box 1 Bay 4 : 136GB : Data Disk : Disk Error

if everything is fine:

/libexec # python check_esx_wbem.py https://vmware00.microsoft.dmz:5989 statistics password hp
OK hp hardware

Links:
Download ESXi version supplied by HP
HP ESXi Offline Bundle
VMware vSphere CLI
checK-esxi_wbem.py download

Related Posts: