LVM PART 1 data restore after accidental removal of logical volume

 Data Restore after  accidental  remove/delete of logical volume                     
Preparing  testing enviroment :

After creating partition use below command

partx        /dev/sda
pvcreate     /dev/sda4   /dev/sda5
vgcreate  VG1    /dev/sda4 /dev/sda5
vgs                                                              #display vg's
lvcreate  -L  4G -n  lv001   VG1
lvscan         or           lvdisplay


mke2fs -t  ext4  -j  
/dev/volgroup001/lv001
Add more space to logical volume (here lv001 is increased from 4gb to 6gb)
lvresize -L 6GB /dev/volgroup001/lv001                     
After resizing
 resize2fs   /dev/volgroup001/lv001

Accidental removal of logical volume

#lvremove    /dev/volgroup001/lv001     
#ll /etc/lvm/archive   ##contains the arhive of lvm data
[root@demo1 ~]# ll /etc/lvm/archive/
total 44
-rw-------. 1 root root 1761 Oct  8 15:46 vg_demo1_00000-1563239603.vg
-rw-------. 1 root root 1135 Oct 20 18:34 volgroup001_00000-1225438891.vg
-rw-------. 1 root root 1135 Oct 20 18:36 volgroup001_00001-1361506140.vg
-rw-------. 1 root root 1731 Oct 21 19:56 volgroup001_00002-1489665094.vg
-rw-------. 1 root root 1731 Oct 22 18:46 volgroup001_00003-1149849750.vg
-rw-------. 1 root root 1733 Oct 23 10:46 volgroup001_00004-1224808495.vg
-rw-------. 1 root root 1741 Oct 23 10:46 volgroup001_00005-843600971.vg
-rw-------. 1 root root 1733 Oct 23 10:56 volgroup001_00006-965431690.vg
-rw-------. 1 root root 1734 Oct 23 13:24 volgroup001_00007-1544816747.vg
-rw-------. 1 root root 1130 Oct 23 13:29 volgroup001_00008-1538079247.vg
-rw-------. 1 root root 1552 Oct 23 18:02 volgroup001_00009-1668760531.vg

#vgcfgrestore --list  volgroup001                              

  File:        /etc/lvm/archive/volgroup001_00008-1538079247.vg
  VG name:        volgroup001
  Description:    Created *before* executing 'lvcreate -L 4G -n lv001 volgroup001'
  Backup Time:    Thu Oct 23 13:29:51 2014

  
  File:        /etc/lvm/archive/volgroup001_00009-1668760531.vg
  VG name:        volgroup001
  Description:    Created *before* executing 'lvresize -L 6GB /dev/volgroup001/lv001'
  Backup Time:    Thu Oct 23 18:02:56 2014

  
  File:        /etc/lvm/backup/volgroup001
  VG name:        volgroup001
  Description:    Created *after* executing 'lvresize -L 6GB /dev/volgroup001/lv001'
  Backup Time:    Thu Oct 23 18:02:56 2014

#######
read the description and backuptime and select the file eg. /etc/lvm/archive/volgroup001_00009-
1668760531.vg    
#######

######   NOW RESTORRING   ######

#vgcfgrestore   -f    /etc/lvm/archive/volgroup001_00009-1668760531.vg     volgroup001
#lvscan
#lvchange -ay /dev/volgroup001/lv001         ##lvchange= change attribute ,  -ay = activateall -yes
#lvscan




vgcfgrestore -f   /etc/lvm/backup/volgroup001


now mount the lvm again

=================================================================

parted
select /dev/sdb

or   parted /dev/sdb
mklabel msdos
mkpart primary 1  10GB                                #1MB to 10GB = approx. 10 GB partition is created

print  or p ##view partition table

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  525MB   524MB   primary  ext4         boot
 2      525MB   21.5GB  20.9GB  primary               lvm



set   <partition-number>  lvm on
quit

partx /dev/sdb

pvcreate  /dev/sdb5 /dev/sdb6 /dev/sdb7

or

pvcreate /dev/sdb[567]

##extend volume group with name volgroup 001

vgextend  volgroup001 /dev/sdb5 /dev/sdb6 /dev/sdb7  

To expand rest of space in VG enter similar command like below:-

lvextend -l +100%FREE /dev/myvg/testlvm

icinga monitor mysql slave replication

icinga monitor msyql slave replication status

At SLAVE mysql server create a user with replication privileges
mysql> GRANT REPLICATION CLIENT on *.* TO 'nagios'@'%' IDENTIFIED BY '1LumbIni2$';
mysql> flush privileges;

 service mysql restart

At  ICINGA server
download nagios mysql slave monitoring script

wget  http://www.claudiokuenzler.com/nagios-plugins/check_mysql_slavestatus.sh
chown icinga.icinga check_mysql_slavestatus.sh; chmod +x check_mysql_slavestatus.sh;

  #./check_mysql_slavestatus.sh -H 198.50.176.187 -u nagios -p 1LumbIni2$ -P 3306
OK: Slave SQL running: Yes Slave IO running: Yes / master: 5.9.240.235 / slave is 0 seconds behind master | delay=0s

Define commands in commands.cfg
# 'check_mysql_slavestatus' command definition
define command{
command_name check_mysql_slavestatus
command_line $USER1$/check_mysql_slavestatus.sh -H $HOSTADDRESS$ -P $ARG1$ -u $ARG2$ -p $ARG3$
}

# 'check_mysql_slavestatus' command definition with delay check
define command{
command_name check_mysql_slavestatus
command_line $USER1$/check_mysql_slavestatus.sh -H $HOSTADDRESS$ -P $ARG1$ -u $ARG2$ -p $ARG3$ -w $ARG4$ -c $ARG5$
}

Now create service for checking

define service{
use generic-service ; Name of service template to use
host_name gskhanalslave
service_description MySQL Replication Status
check_command check_mysql_slavestatus!3306!nagios!1LumbIni2$
}


inotify inodes

What are inodes?

In a nutshell, inodes are the data structure Linux servers use to store information about a file. inodes are set to a specific number on your server. When you write files to the server, you are using an inode for each file. When your inodes reach their limit, you will get Disk Space errors and other strange behaviors with your site.

How do I view my servers inodes?

Below is the Linux command for finding the inodes for your server. This command is ran through shell.
df -i
Get to know inotify
Inotify is a Linux kernel feature that monitors file systems and immediately alerts an attentive application to relevant events, such as a delete, read, write, and even an unmount operation. 
http://www.infoq.com/articles/inotify-linux-file-system-event-monitoring
Inotify is a file change notification system in the Linux kernel, available since version 2.6.13. 
grep INOTIFY_USER /boot/config-$(uname -r)
CONFIG_INOTIFY_USER=y
# pwd
/proc/sys/fs/inotify
root@web01 [/proc/sys/fs/inotify]# ls
./  ../  max_queued_events  max_user_instances  max_user_watches 
#bydefault value in max_user_watches is = 8192 
#echo 65535 > /proc/sys/fs/inotify/max_user_watches
# cat /proc/sys/fs/inotify/max_user_watches          
65536 
To make the change permanent, edit the file /etc/sysctl.conf and add this line to the end of the file:
fs.inotify.max_user_watches=65535
If this server is a VPS and it is running in a OpenVZ container then you are NOT allowed to modify any kernel parameter of that container. and you will get below error
root@vps01 [/proc/sys/fs/inotify]# sysctl -w fs.inotify.max_user_watches=65535 error: permission denied on key 'fs.inotify.max_user_watches'
change it from host

user and group quota SWAP fstab file and parted command part 2

parted
select /dev/sdb
mklabel msdos
mkpart primary 1  10GB       # here partition starts from 1  that's  1 MB
quit

mkfs.ext4 -j  /dev/sdb1
OR
mke2fs -t ext4 -j /dev/sdb1

-j = journaling is an option as provided for transaction oriented processing of writes to disk in event of posssible corruption introduced by abrupt power outages

usermod -a -G admins  urgen
mount -o remount,rw /

use blkid to ascertain UUID of recently created partion for /etc/fstab
#blkid
UUID="9b317d2e-f873-4f1e-a12c-0a57e54c5657" /projectx ext4 defaults 0  0


when mounted roughly about 2% is used to manage journaling the file system

= = = = = = = = = =USER QUOTA = = = = = = =
yum install quota*
vim  fstab

uuid="sdklfjdskljf"  /home ext4 defaults,usrquota,grpquota 0  0

mount  -o  remount,rw   /drive
  quotacheck -cug   /drive/
  quotacheck -mcug  /home  ##this will create q.check db and generate disk usage table
                                            ##use -m option to overwrite the need of single user mode
  quotaon /drive
edquota urgen
Disk quotas for user urgen (uid 501):
  Filesystem                blocks       soft        hard             inodes     soft     hard
  /dev/sdb1                 90        2000000    2097000          4        0        0
                          [used block] <-- [around 2GB]-->
  repquota -a

Note:quotacheck should be run in SINGLE user mode when system reboots
quotacheck should be run in SINGLE user mode when system reboots
use:
m = dont remount filesystem read-only
a = (all)check all filesystems
g = check group files
u = check user files
c = create new quota files
quotacheck -mcug  /home  ##this will create quota check db and generate disk usage table

quotacheck -avug   #checks quotas
quotacheck -mavug   #force check quota or update quota data

edquota username

quota username
repquota  /drive  #report quota for all user

 = = = =  = = = =  = = = = = GROUP QUOTA = = = = = = = = = = = = = =
#quotaon /drive
[root@demo1 drive]# edquota -g urgen

Disk quotas for group urgen (gid 501):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/sdb1                     11000      10000      11000          6        5        0

Make sure of the group owner ship of filecreated
-------------------------------------------------

# quota -g urgen     ##check quota usage for group urgen



Do not attempt to resize a partition on a device that is in use.
Before resizing a partition, boot into rescue mode (or unmount any partitions on the device and turn off any swap space on the device).
Start parted, where /dev/sda is the device on which to resize the partition:
parted /dev/sda       
View the current partition table to determine the minor number of the partition to resize as well as the start and end points for the partition:
print
To resize the partition, use the resize command followed by the minor number for the partition, the starting place in megabytes, and the end place in megabytes. For example:
resize 3 1024 2048

= = = = = = = = =SWAP Space = = = = = = = = =
TRY TO MAKE SWAP PARTITIN ON A DEDICATED PARTITION OR DRIVE
check Swap with  top | free -m | swapon -s
 [root@monitor1 ~]# parted /dev/sdb
GNU Parted 2.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                              
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  10.2GB  10.2GB  primary  ext4
(parted) help mkpart                                                                                    #displays help for mkpart
(parted) mkpart  primary   linux-swap  10.2GB   11.2GB                          ##add 1 GB swap
(parted)print
Number  Start   End     Size    Type     File system  Flags
 1      1049kB  10.2GB  10.2GB  primary  ext4
 2      10.2GB  11.2GB  959MB   primary
# we might not see filesystem type here in parted ,we check with fdisk -l /dev/sdb command

# mkswap /dev/sdb2
vim /etc/fstab
UUID=05bb80f0-2c4e-46d8-98bf-2f7d8cbf8a8f none swap defaults 0 0
swapon -s   ##check your current unchanged swap
swapon -a   ## reload fstab with changed swap

swapoff -a  ##disables swap

++++++++++SWAP File+++++++++++++++++
dd  if=/dev/zero  of=/swapdir/swapfile3GB   bs=1024   count=3145728
mkswap   /swapdir/swapfile3GB
vim /etc/fstab
/swapdir /swapfile3GB  none swap defaults 0 0
OR
/swapdir /swapfile3GB  none swap sw 0 0

swapon -a



user and group quota fstab file part 1

UUID="2c6180d9-8ecd-41bb-a3b7-7be2c9e29395"  /drive  ext4 defaults,usrquota,grpquota 0 0

first  column=device
2nd column= mount point
3rd = type of FS
4th = mount options,

auto and noauto  =  With the auto option,"auto is default"[auto cause FS to mount at boot noauto the opposite]
user and nouser = user means allow norrmaluser to mount FS ,"no user is default"nouser disable normal user to mount.
exec and noexec= exec is default, exec allow execute binaries on that partition and noexec dont allow,
ro and rw = rw is default

sync and async=async is default,    in "sync"when you, for example, copy a file to the floppy, the changes are physically

written to the floppy at the same time you issue the copy command.
in "async" the changes may be physically written to it long time after issuing the command.

defaults Uses the default options that are rw, suid, dev, exec, auto, nouser, and async.

5th and 6th columns: Dump and fsck options

5th is dump option. Dump checks it and uses the number to decide if a file system should be backed up. If it's zero,
dump will ignore that file system. If you take a look at the example fstab, you'll notice that the 5th column is zero in

most cases.

The 6th column is a fsck option. fsck looks at the number in the 6th column to determine in which order the file systems

should be checked. If it's zero, fsck won't check the file system. 

change screen resolution ubuntu vmware

Run: xrandr
this will display available resolutions. Then you can perform the following:

xrandr -s 1024x768

Multiple SSL Certificate install on apache2 server [Ubuntu 12.04]



Multiple SSL Certificate install on apache2 server  [Ubuntu 12.04]
Enable SSL on your webserver
sudo a2enmod ssl
Follow up by restarting Apache.
sudo service apache2 restart
Copy your SSL certificate and key to any location
Eg. Here we copied to /etc/apache2/ssl  
Make sure permission of those files are 400 or 600 [root only read/write]
In   sites/sites-available/<your domains>

vim btlg.com.au
<VirtualHost *:80>
ServerName btlg.com.au 
ServerAlias 
www.btlg.com.au
DocumentRoot /home/bootleg/public_html
</VirtualHost>
<VirtualHost *:443>
ServerName btlg.com.au
ServerAlias 
www.btlg.com.au
DocumentRoot /home/bootleg/public_html
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/btlg/281027f6c6f445.crt
SSLCertificateKeyFile /etc/apache2/ssl/btlg/www_btlg_com_au.key 
SSLCertificateChainFile /etc/apache2/ssl/btlg/sf_bundle-g2-g1.crt
</VirtualHost>

vim example.com.au
<VirtualHost *:80>
ServerName btlg.com.au 
ServerAlias
example.com.au
DocumentRoot /home/example.com/public_html
</VirtualHost>
<VirtualHost *:443>
ServerName
example.com.au
ServerAlias www.example.com.au
DocumentRoot /home/example.com/public_html
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/example/281027f6c6f445.crt
SSLCertificateKeyFile /etc/apache2/ssl/example/www_example_com_au.key 
SSLCertificateChainFile /etc/apache2/ssl/btlg/sf_bundle-g2-g1.crt
</VirtualHost>


Restart apache2 and browse to your domain with http or https
#######################################


On Ubuntu 14.04.1 x64 bit
Enable ssl

a2enmod ssl

Generate certificates  for site  example.com
----------------------------------------------------
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/example.com/apache.key -out /etc/apache2/ssl/example.com/apache.crt

**generate certificates for site example.org**
-------------------------------------------------------------
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/example.org/apache.key -out /etc/apache2/ssl/example.org/apache.crt
##Virtual Host Configuration <note:  the vhost file should have .conf extension###

root@server1:/etc/apache2/sites-available# vim  example.com.conf
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName example.org
        DocumentRoot /var/www/html/example.org

</VirtualHost>


<IfModule mod_ssl.c>
<VirtualHost *:443>

        ServerAdmin webmaster@localhost
        ServerName example.org
        DocumentRoot /var/www/html/example.org

        #   SSL Engine Switch:
        #   Enable/Disable SSL for this virtual host.
        SSLEngine on

        SSLCertificateFile /etc/apache2/ssl/example.org/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/example.org/apache.key
</VirtualHost>

</IfModule>

#Configure ports

#cat /etc/apache2/ports.conf

NameVirtualHost *:80
NameVirtualHost *:443
Listen 80

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

#Enable sites#
  a2ensite example.com
  a2ensite example.org

Step Four — Activate the SSL Virtual Host

Now that we have configured our SSL-enabled virtual host, we need to enable it.
We can do this by typing:
sudo a2ensite default-ssl.conf
We then need to restart Apache to load our new virtual host file:
sudo service apache2 restart


check process is running




[root@mx12 sshadmin]# crontab -l
*/3 * * * * /opt/checkclam.sh
[root@mx12 sshadmin]# cat /opt/checkclam.sh
#!/bin/bash
if ! pgrep clamd > /dev/null;
then
/etc/init.d/clamd restart > /dev/null;
else
echo "OK `date +%T\ %F`" >> /program.log; #'\ ' is for space use %t for tab
fi


Task: Find out process pid

Simply use ps command as follows:
ps aux | grep {process-name}
For example find out if mysqld process (mysqld pid) is running or not:
$ ps aux | grep mysqld

mysql    28290  1.1  2.7 340496 56812 ?        Sl   Jul31 348:27 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
 # pidof mysqld

check mysql replication status with bash script

[root@DBASE01 ~]# crontab -l
45 14,21 * * * /root/dbstatus.sh


[root@DBASE01 ~]# cat dbstatus.sh
#!/bin/bash
#/usr/bin/mysql -uroot -p1Lumbini2# -e "show slave status\G;" > /root/status.txt
/usr/bin/mysql  -e "show slave status\G;" > /root/status.txt
i=0
if grep "Slave_IO_Running: Yes" /root/status.txt
then
((i=i+1))
fi
if grep "Slave_SQL_Running: Yes" /root/status.txt
then
((i=i+1))
fi
##########
if [ $i -ne 2 ]
then
 /bin/cat /root/status.txt | mail -s "Mysqlslave replication status for AusIT" alerts@nepallink.net
else
    :              ##colons
fi

Note: make sure the file /root/status.txt have write permission

ICINGA + pnp4nagios installation



Icinga web with pnp4nagios
PNP is an addon for the Nagios Network Monitoring System. PNP provides easy to use, easy to configure RRDTools based performance charts feeded by the performance data output of the Nagios Plugins.


Setting up icinga using repository:-
OS used in this env = CentOS release 6.5 X64bit

1. Install CentOS 6.4 minimal version

2. Prepare your system
# yum groupinstall Development tools
# yum install vim mc
3. Add EPEL and Remi repositories
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
#wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-13.ius.centos6.noarch.rpm
#rpm -Uvh ius-release*.rpm
4. Check your repolist[the under lined repos should be present]

5. Installing packages
#yum install php php-cli php-pear php-xmlrpc php-xsl php-pdo php-soap php-gd php-ldap php-mysql
# yum install icinga icinga-gui icinga-doc icinga-idoutils-libdbi-mysql               or    yum install icinga*
# yum install nagios-plugins-all
# yum install mysql-server mysql-client libdbi libdbi-dbd-mysql libdbi-devel icinga-idoutils-libdbi-mysql libdbi-drivers
6. Database setup
 # mysql -u root -p
 mysql> CREATE DATABASE icinga_web;
        GRANT USAGE ON *.* TO 'icinga_web'@'localhost' IDENTIFIED BY 'icinga_web' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
        GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX ON icinga_web.* TO 'icinga_web'@'localhost';
        quit;

#echo "CREATE DATABASE icinga; \
GRANT USAGE ON *.* TO 'icinga'@'localhost' \
  IDENTIFIED BY 'icinga' \
  WITH MAX_QUERIES_PER_HOUR 0 \
  MAX_CONNECTIONS_PER_HOUR 0 \
  MAX_UPDATES_PER_HOUR 0; \
GRANT SELECT , INSERT , UPDATE , DELETE, DROP, CREATE VIEW \
  ON icinga.* TO 'icinga'@'localhost'; \
FLUSH PRIVILEGES;" \
| mysql -uroot -p

                               
7. Import the schema
mysql -u root -p   icinga_web < /usr/share/doc/icinga-web-1.7.2/schema/mysql.sql
mysql -u root -p icinga < /usr/share/doc/icinga-idoutils-libdbi-mysql-1.8.4/db/mysql/mysql.sql

chkconfig ido2db on
chkconfig icinga on
chkconfig httpd on
service ido2db start
service icinga start
service httpd start


8. Test classic Web GUI
Set a SHA encrypted administrator password for Basic Authentication
htpasswd -s /etc/icinga/passwd icingaadmin

Icinga- Web
Test New Web GUI
Open the URL https://ICINGA_SERVER_IP/icinga-web and login with user “root” and password “password”
Set the Timezone
Proper time setting is required to make the scheduled check commands work.
Set the variable TIMEZONE to your timezone, e.g. "Europe/Berlin"
export TIMEZONE="Europe/Berlin"
sed -i "s|^[ ;]*date.timezone *=.*|date.timezone='$TIMEZONE'|" /etc/php.ini
Example 2
ln -s /usr/share/zoneinfo/Canada/Central /etc/localtime
[root@VM156 ~]# date
Mon Sep 22 03:29:14 CDT 2014
[]#vim /etc/php.ini
 [Date]                  #line number 943
date.timezone = "Canada/Central"                      ##line number 946
Install pnp4nagios
Install the required packages:
# yum install rrdtool rrdtool-devel rrdtool-perl openssl-devel gcc php-rrdtool php-gd php php-pdo php-common perl-Time-HiRes
# yum install wget
Download pnp4nagios source
# wget -c 
http://sourceforge.net/projects/pnp4nagios/files/PNP-0.6/pnp4nagios-0.6.21.tar.gz
# tar -xvzf pnp4nagios-0.6.21.tar.gz
# cd pnpnagios-0.6.21
Compile and install pnp4nagios for Icinga user:
# ./configure --with-nagios-user=icinga --with-nagios-group=icinga
# make all
# make install
# make install-webconf
# make install-config
# make install-init

Configure pnp4nagios for Icinga Core:
# vim /etc/icinga/icinga.cfg
................
#process_performance_data=0
process_performance_data=1
.................
broker_module=/usr/local/pnp4nagios/lib/npcdmod.o config_file=/usr/local/pnp4nagios/etc/npcd.cfg
..................

Add new command for check configuration files of the Icinga:
# alias icicheck='/usr/bin/icinga -v /etc/icinga/icinga.cfg'
Integration Icinga htpasswd file in pnp4nagios:
# vim /etc/httpd/conf.d/pnp4nagios.conf    [check the highlighted values]
AuthName "Nagios Access"                   #line number 12
AuthType Basic
AuthUserFile /etc/icinga/passwd

Restart following services:
# service httpd restart
# /etc/init.d/npcd start && chkconfig npcd on
# icicheck
# /etc/init.d/icinga restart
Please check correct installation of pnp4nagios.
Go to web http://<server name>/pnp4nagios/
If you see in the end web page following "Your environment passed all requirements." so you must remove or rename the /usr/local/pnp4nagios/share/install.php file
# mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.testfile
Configure main config file of the pnp4nagios:
# cd /usr/local/pnp4nagios/etc/
# mv rra.cfg-sample rra.cfg
# vim npcd.cfg

user = icinga
group = icinga
log_type = file
log_level = -1
load_threshold = 10.0

After that check icinga configuration
# icicheck
Total Warnings: 0
Total Errors: 0
# vim config.php
# Link back to Nagios or Thruk
#
$conf['nagios_base'] = "/icinga/cgi-bin";

Please, overwrite all settings for perfdata:
# vim /etc/icinga/icinga.cfg
#host_perfdata_file=/tmp/host-perfdata
#service_perfdata_file=/tmp/service-perfdata
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
#host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
#service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
#host_perfdata_file_mode=a
#service_perfdata_file_mode=a
host_perfdata_file_mode=a
service_perfdata_file_mode=a
#host_perfdata_file_processing_interval=0
#service_perfdata_file_processing_interval=0
host_perfdata_file_processing_interval=30
service_perfdata_file_processing_interval=30
#host_perfdata_file_processing_command=process-host-perfdata-file
#service_perfdata_file_processing_command=process-service-perfdata-file
host_perfdata_file_processing_command=process-host-perfdata-file
service_perfdata_file_processing_command=process-service-perfdata-file

After that check icinga configuration
# icicheck
Total Warnings: 0
Total Errors: 0
Either edit or append. A sample is provided within /usr/local/pnp4nagios/etc/misccommands.cfg:
# cp /usr/local/pnp4nagios/etc/misccommands.cfg-sample /etc/icinga/misccommands.cfg
# vi /etc/icinga/misccommands.cfg
and uncomment following strings
define command {
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}
define command {
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}
After that check icinga configuration
# icicheck
Total Warnings: 0
Total Errors: 0
# /etc/init.d/httpd restart
# /etc/init.d/icinga reload
Check for perfdata
# ls -la /usr/local/pnp4nagios/var/perfdata/localhost
In this directory you must see files: .rrd+.xml
Useful tools
Clear web cache
#/usr/bin/icinga-web-clearcache

Reference:-
https://wiki.icinga.org/display/howtos/Setting+up+Icinga+Web+on+RHEL