Icinga-web Installation
The previous period of time research will Icinga and Icinga-web, he is nagios two times development, support Chinese language, domestic to icinga-web research document seems relatively few, here to share to everyone
A Environmental requirements:
Related libraries: Yum install–y libdbi-devel libdbi libdbi-drivers libdbi-dbd-mysql
Yum install-y gcc glibc glibc-common gd gd-devel openssl-devel
Yum install-y libjpeg libjpeg-devel libpng libpng-devel
Yum install-y rsync vim wget curl git zip unzip mlocate make spawn-fcgi
(Note: libdbi libdbi-drivers Do data transfer, Libdbi-dbd-mysql used to connect to the database if not installed, ido2db process will have no
If the data is not transmitted to the database, it may be a problem in these places.
Related installation package: icinga-cn-web-1.5.2.tar.bz2 gnosek-fcgiwrap-4b2151e.tar.gz
System environment: CentOS 5.5*64
Installation Environment: LNMP
Nmp:nginx version:nginx-1.4.1
Mysql version:mysql-5.5.17
PHP version:php 5.3.8
1). Note: PHP compilation options:
#./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql\
--WITH-GD--with-zlib--with-xsl--with-ldap--with-gettext\
--with-pdo-mysql=/program2/mysql--enable-soap--with-xmlrpc
If PHP is compiled, you can choose the method of dynamically expanding the library to add the missing dynamic: (column: Dynamic expansion: SOAP)
# Cd/download/php-5.3.1/ext/soap &&/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config--with-soap
#make && make Install
See if soap.so already exists:
# ll/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/soap.so
Add extension=soap.so to the/usr/local/php/lib/php.ini.
Restart PHP: #/etc/init.d/php-fpm restart
Detects if PHP has the required extension script installed (the PHP path of the test script needs to be modified first):
# vim/usr/local/icinga_web/bin/testdeps.php
Change to: #!/usr/local/php/bin/php
Execution: #/usr/local/icinga_web/bin/testdeps.php
If it appears: All over Result:pass indicates success, and if Fail is found, which libraries are not installed in the output,
Then add it using the dynamic installation method.
Two Installation and configuration of Fcgiwrap:
1). Install Fcgiwrap
# yum Install Fcgi-devel fcgi
# tar XVF gnosek-fcgiwrap-4b2151e.tar.gz
# CD GNOSEK-FCGIWRAP-4B2151E
#./configure--prefix=/usr/local/fcgiwrap
# Make && make install
2). Configure and start Fcgiwrap
Fcgiwrap's role is to make CGI programs run like fastcgi programs on Nginx.
To create a fcgiwrap startup script:
# Cp/etc/init.d/spawn-fcgi/etc/init.d/fcgiwrap
# Vi/etc/init.d/fcgiwrap Modify two of the following red fonts
Exec= "/usr/bin/spawn-fcgi"
Prog= "Fcgiwrap"
Config= "/etc/sysconfig/fcgiwrap"
3). Create a configuration file for Fcgiwrap
# mkdir-p/var/run/fcgiwrap
# Chown-r Icinga:icinga/var/run/fcgiwrap
# Vim/etc/sysconfig/fcgiwrap
Add to:
Fcgi_socket=/var/run/fcgiwrap/fcgiwrap.socket
Fcgi_program=/usr/local/fcgiwrap/sbin/fcgiwrap
Fcgi_pidfile=/var/run/fcgiwrap/fcgiwrap.pid
Fcgi_user=icinga
Fcgi_group=icinga
Fcgi_extra_options= "-M 0600"
Options= "-u $FCGI _user-g $FCGI _group-s $FCGI _socket-s
$FCGI _extra_options-f 1-p $FCGI _pidfile-f $FCGI _program "
Start Fcgiwrap:
#/etc/init.d/fcgiwrap Start
Three Installation and configuration of Icinga-web:
1). Unzip the Icinga-web and enter the installation directory
# TAR-JXVF ICINGA-CN-WEB-1.5.2.TAR.BZ2
# CD icinga-cn-web-1.5.2
#./configure Prefix=/usr/local/icinga-web--with-app-name=icinga\
>--with-web-user=icinga--with-web-group=icinga\
>--with-api-cmd-file=/usr/local/icinga/var/rw/icinga.cmd
# Make && make install
2). Configure and start Idoutils
# cd/usr/local/icinga/etc && MV Modules/idoutils.cfg-sample modules/idoutils.cfg
<1> Creating databases and users
# Mysql–u Root-p
# CREATE DATABASE icinga DEFAULT CHARACTER SET UTF8;
# GRANT USAGE on icinga.* to ' icinga ' @ ' localhost '
Identified by ' YourPassword '
With Max_queries_per_hour 0
Max_connections_per_hour 0
Max_updates_per_hour 0;
# GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE on
Icinga.* to ' icinga ' @ ' localhost ';
# CREATE DATABASE icinga_web DEFAULT CHARACTER SET UTF8;
# GRANT USAGE on icinga_web.* to ' icinga_web ' @ ' localhost '
Identified by ' YourPassword '
With Max_queries_per_hour 0
Max_connections_per_hour 0
Max_updates_per_hour 0;
# GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE
On icinga_web.* to ' icinga_web ' @ ' localhost ';
# FLUSH privileges;
# quit
# # #MAX_QUERIES_PER_HOUR 0 Number of times a database can be queried per hour 0 means no limit
# # #MAX_CONNECTIONS_PER_HOUR 0 times per hour You can connect to a database
# # #MAX_UPDATES_PER_HOUR 0 times per hour You can modify the database
<2> Import Database
# mysql-u Root-p Icinga <\
/usr/local/etc/icinga-cn-1.9.3/module/idoutils/db/mysql/mysql.sql
# mysql-u Root-p Icinga_web </usr/local/icinga-web/etc/schema/mysql.sql
<3> Database Connection Configuration
# Cd/usr/local/icinga-web
# vim App/config/databases.xml Modify the password of the Icinga_web table
<ae:parameter
Name= "DSN" >mysql://icinga_web:[email protected]:3306/icinga_web</ae:parameter>
<!--Generic Credentials--
<ae:parameter name= "username" >icinga_web</ae:parameter>
<ae:parameter name= "Password" >yourpassword</ae:parameter>
<!--DB encoding type--
<ae:parameter name= "CharSet" >utf8</ae:parameter>
...
<database xmlns= "http://agavi.org/agavi/config/parts/databases/1.0" name= "Icinga"
class= "Icingadoctrinedatabase" >
<ae:parameter name= "DSN" >mysql://icinga:[email Protected]:3306/icinga
</ae:parameter>
<!--must be removed for Oracle databases--
<ae:parameter name= "prefix" >icinga_utf8
<4> Clean up the cache
You need to clean up the cache after modifying the configuration file
#./bin/clearcache.sh
<5> Configuration Ido2db.cfg
#vim/usr/local/icinga/etc/ido2db.cfg
Db_socket=/tmp/mysql.sock #不开启并制定好mysql. Sock location data will not be imported into the database
Db_host=localhost
db_port=3306
Db_name=icinga
Db_user=icinga
Db_pass=yourpassword
3). Start ido2db:/etc/init.d/ido2db start
IDO2DB process must be started before the Icinga process, or the data will not be recorded in the database, close the Icinga
It is best to close ido2db before the process, or sometimes icinga boot will be problematic
The correct restart method is:
/etc/init.d/ido2db stop &&/etc/init.d/icinga stop &&/etc/init.d/ido2db start &/etc/init.d/icinga Start
View Log appears idomod:successfully connected to data sink indicates a successful database configuration
If there is a large number of services in the monitoring, view Log discovery:
idomod:successfully connected to data sink. 6081 items lost, queued ...
Modify # Vim/usr/local/icinga/etc/idomod.cfg
output_buffer_items=50000 (this value depends on the demand)
This value is due to the loss of data too large to create a buffer, the excess data will be put in slowly write Icinga data
Library, if the value is too small to lead to inaccurate data
Four Configuration of Nginx:
Check to see if the Icinga is ready for a soft connection, if none:
# ln-s/usr/local/icinga/share/data/www/icinga
1). Nginx Configuration
# ln-s/usr/local/icinga-web//data/www/icinga-web
# vim/usr/local/nginx/conf/vhosts/icinga_web.conf
server {
Listen 8088;
server_name localhost;
Index index.php index.html index.htm;
Root/data/www/icinga-web/icinga-web/pub;
Error_log Logs/icinga-web_error.log;
Location =/favicon.ico {
Log_not_found off;
Access_log off;
Expires Max;
}
Location =/robots.txt {
Allow all;
Log_not_found off;
Access_log off;
}
# Deny all attempts to access hidden files such as. htaccess,. htpasswd
Location ~/\. {
Deny all;
Access_log off;
Log_not_found off;
}
Location/icinga-web/styles {
Alias/data/www/icinga-web/icinga-web/pub/styles;
}
location/icinga-web/images {
Alias/data/www/icinga-web/icinga-web/pub/images;
}
Location/icinga-web/js {
Alias/data/www/icinga-web/icinga-web/lib;
}
Location/icinga-web/modules {
Rewrite ^/icinga-web/(. *) $/index.php?/$1 last;
}
Location/icinga-web/web {
Rewrite ^/icinga-web/(. *) $/index.php?/$1 last;
}
Location/{
Root/data/www/icinga-web/icinga-web/pub;
Index index.php;
Location ~* ^/(robots.txt|static|images) {
Break
}
if ($uri!~ "^/(favicon.ico|robots.txt|static|index.php)") {
Rewrite ^/([^?] *) $/index.php?/$1 last;
}
}
Location ~ \.php ($|/) {
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
# Classic Interface
Location/icinga {
Alias/data/www/icinga/share;
Index index.html;
Auth_basic "Icinga Access";
Auth_basic_user_file/usr/local/icinga/etc/htpasswd.users;
}
Location ~ \.cgi$ {
# define root directory for CGIs
Root/usr/local/icinga/sbin;
Rewrite ^/icinga/cgi-bin/(. *) \.cgi/$1.cgi break;
Rewrite ^/cgi-bin/icinga/(. *) \.cgi/$1.cgi break;
Include Fastcgi_params;
Fastcgi_pass Unix:/var/run/fcgiwrap/fcgiwrap.socket;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Auth_basic "Icinga Access";
Auth_basic_user_file/usr/local/icinga/etc/htpasswd.users;
Fastcgi_param auth_user $remote _user;
Fastcgi_param Remote_user $remote _user;
}
}
2). Reboot # Nginx:/etc/init.d/nginx restart
Can log in http://ip:8088 view, the initial user name and password is root and password, please log in and modify
icinga-web1.7 loading this file is going to take a long time, icinga-web1.5 version does not have this case if the actual
In order to use version 1.7, you need to use Google Chrome and other browsers that will cache the file.
Five Installation and configuration of Icinga-report:
The default installation requires PostgreSQL support, slow, MySQL, and much faster
1). Preparatory work
From Icinga 1.8 There is a database feature that provides all the required SLA information. This feature needs to be attached to your existing
The Icinga report for the Idoutils database.
Download Icinga-report, I download here is icinga-reports-1.9.0.tar.gz
# tar ZXVF icinga-reports-1.9.0.tar.gz
# mysql–uroot–p Icinga <\
/downloads/jasperserver/icinga-reports-1.9.0/db/icinga/mysql/availability.sql
2). Tomcat Installation and configuration
Download jdk6.0, I download here is Jdk-6u45-linux-x64.bin
# CHOMD 755 jdk-6u45-linux-x64.bin &&./jdk-6u45-linux-x64.bin
# MV jdk1.6.0_45//USR/LOCAL/JDK
Download Tomcat, I'm here to download the apache-tomcat-6.0.37.tar.gz
# tar ZXVF apache-tomcat-6.0.37.tar.gz
# MV Apache-tomcat-6.0.37/usr/local/apache-tomcat
Configuring the JDK Environment
# Vim/etc/profile
Export Python_egg_cache=/tmp/.python-eggs
Java_home=/usr/local/jdk
Classpath=.: $JAVA _home/lib/tools.jar
Path= $JAVA _home/bin: $PATH
Export Java_home CLASSPATH PATH
# Source/etc/profile
The monitor machine is a 16 cpu,16g memory configuration, add the following red statement to the catalina.sh script
(due to the large amount of data, the Jasperserver report will cause memory overflow, the Icinga process will also die, so the boot
Make sure that Tomcat's memory allocation is adequate before using the reporting feature)
# vim/usr/local/apache-tomcat/bin/catalina.sh
...
If [$have _tty-eq 1]; Then
Java_opts= "-xms1024m-xmx1024m-xss1024k-xx:permsize=512m-xx:maxpermsize=512m
-xx:maxnewsize=512m "
echo "Using catalina_base: $CATALINA _base"
#/usr/local/apache-tomcat/bin/catalina.sh Start
If http://ip:8080 can display the Tomcat welcome page, the Tomcat configuration succeeds, if there is a problem, the view environment variable is
Not configured correctly, such as to see if there are multiple spaces at the end (I was in the JAVA_HOME=/USR/LOCAL/JDK language
Add a space to the end of the sentence, causing a problem)
#echo $JAVA _home && echo $ CLASSPATH && echo $ PATH
See if all the paths appear, if none, check environment variables, fix and re-soure/etc/profile
3). Installation and configuration of Jasperserver
More than 5.0 versions of Jasperserver only support 1.9 or more icinga-report, or in the partial report will appear
The following error
Because jasperserver5.0 's default installation only supports PostgreSQL and Tomcat, we use a custom installation package
Installation (version 4.1 of the Jasperserver default installation version mysql5.1 also supports only previous versions of mysql5.1)
Download the Jasperserver Custom installation package on the website:
Http://sourceforge.net/projects/jasperserver/files/JasperServer/JasperServer%205.0.0/Ja
Sperreports-server-cp-install-guide.pdf
I'm downloading jasperreports-server-cp-5.0.0-bin.zip here.
# cd/downloads/jasperserver && Unzip Jasperreports-server-cp-5.0.0-bin.zip
# MV Jasperreports-server-cp-5.0.0-bin/usr/local/jasperreports-server
# cd/usr/local/jasperreports-server/buildomatic
# CP Sample_conf/mysql_master.properties Default_master.properties
# Vim Default_master.properties
Appservertype = Tomcat6
Appserverdir =/usr/local/apache-tomcat
Dbtype=mysql
Dbhost=localhost
Dbusername=root
Root Password for dbpassword= database
dbport=3306
The custom installed jasperserver requires a JDBC driver and can be downloaded using Yum or installed in a well-icinga-report
Inside the package copy a past, I'm here to copy the past directly from the Icing-report installation package
# cp/downloads/jasperserver/icinga-reports-1.9.0/jsp-server/classes/connector/mysql-co\
Nnector-java-5.1.18/mysql-connector-java-5.1.18-bin.jar conf_source/db/mysql/jdbc/
Before executing the script, turn off Tomcat and make sure that MySQL is turned on
#/usr/local/apache-tomcat/bin/catalina.sh Stop
#./js-install-ce.sh
If you have previously installed the same version of Jasperserver, you can skip the steps to build the table (select N), if a different version is installed,
You also need to overwrite the original table (select y), because different versions of the table will cause Jasperserver to run smoothly
The typeface indicates that the Jasperserver installation was successful and the Tomcat was turned on
#/usr/local/apache-tomcat/bin/catalina.sh Start
In the browser input http://ip:8080/jasperserver if you see the login page, the installation is complete
The initial user name and password are jasperadmin, please enter and modify
4). Installation and configuration of Icinga-report
<1> do a soft connection to Tomcat and MySQL first
# ln-s/usr/local/apache-tomcat/usr/local/jasperreports-server
# ln-s/usr/local/mysql/usr/local/jasperreports-server
<2> download Icinga-report, I download here is icinga-reports-1.9.0
# cd/download/icinga-reports-1.9.0
#./configure--with-jasper-server=/usr/local/jasperreports-server
# Make && make Install-mysql-connector
See if the JDBC driver is in Tomcat's Lib
# Ll/usr/local/apache-tomcat/lib/mysql-connector-java-5.1.18-bin.jar
If it exists, restart Tomcat.
#/usr/local/apache-tomcat/bin/catalina.sh Stop
#/usr/local/apache-tomcat/bin/catalina.sh Start
# make Install
The installation succeeds when the typeface appears
<3> modifying JDBC link files for Jasperserver engineering files
Since Jasperserver is the default installation of the Postgres database, the js.jdbc.properties file inside the project is still
Postgres The connection parameters, delete the file directly, create a new MySQL connection file, as follows
# cd/usr/local/apache-tomcat/webapps/jasperserver/web-inf/
# Vim Js.jdbc.properties
# property that determines the Hibernate dialect
Metadata.hibernate.dialect=org.hibernate.dialect.mysqlinnodbdialect
# jasperserver Repo db settings
Metadata.jdbc.driverclassname=com.mysql.jdbc.driver
Metadata.jdbc.url=jdbc:mysql://localhost:3306/jasperserver_ce_410?useunicode=true&a
mp;characterencoding=utf-8&autoreconnect=true&autoreconnectforpools=
True
Metadata.jdbc.username=root
Metadata.jdbc.password=efunfun
Metadata.jndi=jdbc/jasperserver
Metadata.database.generate=true
# FoodMart DB Settings
Foodmart.jdbc.driverclassname=com.mysql.jdbc.driver
Foodmart.jdbc.url=jdbc:mysql://localhost:3306/foodmart?useunicode=true&character
Encoding=utf-8&autoreconnect=true&autoreconnectforpools=true
Foodmart.jdbc.username=root
Foodmart.jdbc.password=efunfun
Foodmart.jndi=jdbc/foodmart
# SugarCRM DB Settings
Sugarcrm.jdbc.driverclassname=com.mysql.jdbc.driver
Sugarcrm.jdbc.url=jdbc:mysql://localhost:3306/sugarcrm?useunicode=true&charact
Erencoding=utf-8&autoreconnect=true&autoreconnectforpools=true
Sugarcrm.jdbc.username=root
Sugarcrm.jdbc.password=efunfun
Sugarcrm.jndi=jdbc/sugarcrm
# SugarCRM is also referenced as test in unit tests
Test.jdbc.driverclassname=com.mysql.jdbc.driver
Test.jdbc.url=jdbc:mysql://localhost:3306/sugarcrm?useunicode=true&characterenc
Oding=utf-8&autoreconnect=true&autoreconnectforpools=true
Test.jdbc.username=root
Test.jdbc.password=efunfun
Test.jndi=jdbc/sugarcrm
# flag used to skip some unit tests or to use uppercase schema files
Test.databaseflavor=mysql
Test.createminimaldata=${test.set.createminimaldata}
Foodmart.uppercasenames=false
Sugarcrm.uppercasenames=false
# used to add parms to Tomcat Datasource:context.xml
# Todo:still used?
datasource.extra.params=
<3> give host and service initial value
Start Icinga-web report function also need to give the service a default initial value, otherwise the reports are inaccurate
The reporting function is based on the Icinga log out report.
# vim/usr/local/icinga/etc/icinga.cfg
Set this value to 1 and restart Icinga
(Pay attention to the service more, Icinga process basically will die, so let the log have the initial state, kill the Icinga process,
Reset the parameters to 0, then restart, the Icinga process will restart the detection, icing-report data will be normal)
But so far the Chinese version of the Icinga in time to give the initial state, the classic version of the availability is still not normal, as long as the service
Service from the beginning of the test is always normal, the availability of its values have been outstanding
Use of the <4> reporting function
Restart Tomcat, log on to the Icinga-web page, select Reporting, open the directory
If a list of dead loops is present here (the versions prior to icinga-web1.7 will appear), viewing the Tomcat error log appears
Error reports:possible security hack, try accessing Jasper server on
/icinga/reports/samples without matching root path
Modify the document/usr/local/icinga-web/app/modules/reporting/config/module.xml
Change Icinga to Icinga and restart Tomcat to solve
The TimePeriod option in the report needs to be filled in, and the following is the Timeperidos parameter
List of defined timeperiods:
* Today and today
* Last24hours = Last Hours
* Yesterday = Yesterday
* ThisWeek = this week
* Last7days = 7 days
* Lastweek = last week
* Thismonth = this month
* Last31days = Last
* Lastmonth = last month (default)
* Thisyear = this year
* LastYear = last year
* Custum = Custom Period report
Six Post-maintenance:
1). Configure Boot Start
Configuring the boot-up auto-Start process
# vim/etc/rc.d/rc.local
#icinga and Icinga-web start
/etc/init.d/ido2db start
/etc/init.d/fcgiwrap start
/ETC/INIT.D/PHP-FPM start
/etc/init.d/nginx start
/etc/init.d/icinga start
#jasperserver start
/usr/local/apache-tomcat/bin/catalina.sh start
2). Scripting
<1> write scripts that detect Icinga and ido2db process runs if the process is automatically restarted Icinga and ido2db
and put the script into the crontab for a certain time to execute once
<2> write start Icinga and ido2db process scripts, due to the boot sequence is fastidious, write reload script convenient update monitoring
<3> Write Backup monitoring configuration, backup on the local and test virtual machine, put into crontab every day to run a
To prevent loss of configuration files due to machine failure or operational errors
3). configuration file re-specification
The existing configuration file naming, monitoring detection interval and other aspects do not standardize, and curel June and other people to discuss how to
Control Service configuration file re-specification, easy to manage the monitoring configuration later, and optimize the monitoring system
Reference to monitoring service grouping levels in combination with previous experience
<1>P1: Core Service levels:
Serious impact on the number of business visitors, earnings revenue, the company's brand of external services
Network level:
Computer room A line outlet off the network (lost packets close to 100%);
Engine room a line of export seriously lost, more than 40% cases;
Security Level:
P1, P2-level applications are attacked, large amounts of sensitive information is stolen, and data is corrupted or tampered with
<2>P2: Sub-core Service level:
Network level:
The loss rate of a certain line of the engine room is not more than 40%, and the packet loss occurs intermittently, and the core business is not used
Cause a large area effect;
Office network Export packet loss or off-grid situation;
Security Level:
P1, P2-level applications are attacked, some sensitive information is stolen, but data is not corrupted or tampered with
<3>P3: Edge Service level:
The situation of local fault net and packet loss in the same carrier line between engine room
Third party cooperation services
Non-critical services are compromised, but information is not stolen
<4>P4: Operational Optimization level:
All disk space monitoring points, application log alarms, unless otherwise noted
In addition to the special note, all services have a load-balanced host-level monitoring alarm (service port, CPU, memory,
Number of connections)
In addition to the special note, network equipment traffic monitoring alarm
This level of monitoring can be customized by modifying the monitoring service picture, or by customizing the variables to group the levels
Add "parents name" to the configuration file to adjust the state diagram
4). The web version of the alarm display time and the classic version of the display time 4-5 minutes apart, but the above alarm time consistent
However, these do not affect the sending time of the alarm email or SMS
Seven Introduction to use:
http://icinga02.efunfun.tw/
1). admin button
Add Delete user, user group view log, modify XML configuration also need to click the Clear button under the task here (or
Execute clearcache.sh script)
2). Users to modify their own password and define their own personalized interface, as well as the Exit User button
3). Customizing the user's Cronk
<1> Add custom categories, modify position numbers to adjust the top and bottom positions of the category catalog
<2> Right click on the Right tab, there will be a save Cronk option, you can choose to save in your own settings in the category directory
The tab slider function in the <3> settings allows the right label to move right at a certain time in the user preferences setting
4). The function button on the Right tab bar
Filter button to filter the items shown below the service
5). This icon in the upper right corner shows the host/service active monitoring/passive monitoring number, the host/Service execution time, the main
Detection delay for machine/service
6). The icon in the upper-left corner
<1> search function
The overall situation of <2> service shows, the right is the instance function, 1.5 version temporarily without a function of Cronk, temporarily ignore
This article is from the "pit Daddy Xia boss" blog, please be sure to keep this source http://xiaoking.blog.51cto.com/4024863/1408898