Showing posts with label centos. Show all posts
Showing posts with label centos. Show all posts

Thursday, January 12, 2012

Creating ramdisk in Linux

A RAMDisk is a portion of RAM which is being used as if it were a disk drive. RAMDisks have fixed sizes, and act like regular disk partitions. Access time is much faster for a RAMDisk than for a real, physical disk. However, any data stored on a RAMDisk is lost when the system is shut down or powered off.

RAMDisks can be a great place to store temporary data. Perfect candidates would be :

1) Mounting Loopback file systems (such as run-from-floppy/CD distributions),
2) Working on unencrypted data from encrypted documents,
3) In many embedded Linux systems, a RAMDisk is used to load initrd (initial Ram Disk), initrd is the final root file system.
4) Things which do not change eg. web images or downloadable files, etc.

The Linux kernel version 2.4 or later have built-in support for ramdisks. You can check if ramdisk is setup by doing:

[root@test-db]# dmesg | grep RAMDISK
RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize

You should get above output on CentOS and RHEL. Other linux flavors will have similar output as well.

1) Changing the Kernel Parameters:

Ramdisk size is controlled by a command-line option that is passed to the kernel during boot. Since GRUB is the default bootloader for CentOs 6.2, I will modify /etc/grub.conf with the new kernel option. The kernel option for ramdisk size is: ramdisk_size=xxxxxx, where xxxxxx is the size expressed in 1024-byte blocks.

Here is what I will add to /etc/grub.conf to configure 4 GB ramdisks (ramdisk_size=4194304):

[root@test-db]# vi /etc/grub.conf

Find the line which looks similar to following:

kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/mapper/vg_lvm-lv_root

add ramdisk_size=4194304 to the end of the line. Now your grub.conf should look like:

--------------------------------------------------------------------------------------
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/vg_lvm-lv_root
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-220.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-220.el6.x86_64 ro root=/dev/mapper/vg_lvm-lv_root rd_LVM_LV=vg_lvm/lv_swap rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_lvm/lv_roo
t rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM ramdisk_size=4194304
initrd /initramfs-2.6.32-220.el6.x86_64.img
--------------------------------------------------------------------------------------

Save and exit grub.conf. At this point you have it configured to have ramdisk with new size but it does not take effect until you reboot your system.

Once you have rebooted your system, we can start doing rest of configurations.

2) Format the ramdisk :
There is no need to format the ramdisk as a journaling file system, so we will simply use the ubiquitous ext2 file system. I only want to use one ramdisk, so I will only format /dev/ram0:

[root@test-db]# mke2fs -m 0 /dev/ram0

The -m 0 option keeps mke2fs from reserving any space on the file system for the root user, which is the default behavior. I want all of the ramdisk space available to a regular user for working with encrypted files.

3) Create a mount point and mount the ramdisk :
Now that you have formatted the ramdisk, you must create a mount point for it. Then you can mount your ramdisk and use it. We will use the directory /mnt/rd for this operation.

[root@test-db]# mkdir /ramdisk

[root@test-db]# mount /dev/ram0 /ramdisk

Now verify the new ramdisk mount:
[root@test-db]# df -h | grep ram0

4) Performance benchmarking :

Now that it has been created, you can copy, move, delete, edit, and list files on the ramdisk exactly as if they were on a physical disk partiton. We can do a IO benchmark by using the dd command.

In the example below the "/hdisk" is a folder on the servers hard drive and "/ramdisk" is the mounted ramdisk.

[root@test-db]# dd if=/dev/zero of=/hdisk/X1 bs=128k count=10240
10240+0 records in
10240+0 records out
1342177280 bytes (1.3 GB) copied, 50.6943 s, 26.5 MB/s
[root@test-db]# dd if=/dev/zero of=/ramdisk/X1 bs=128k count=10240
10240+0 records in
10240+0 records out
1342177280 bytes (1.3 GB) copied, 4.34945 s, 309 MB/s

The difference is clearly visible.

RAMDisk is also a great place to view decrypted GPG or OpenSSL files, as well as a good place to create files that will be encrypted. After your host is powered down, all traces of files created on the ramdisk are gone.

To unmount the ramdisk, simply enter the following:

[root@test-db]# umount -v /ramdisk

If you remount the ramdisk, your data will still be there. Once memory has been allocated to the ramdisk, it is flagged so that the kernel will not try to reuse the memory later. Therefore, you cannot “reclaim” the RAM after you are done with using the ramdisk. For this reason, you will want to be careful not to allocate more memory to the ramdisk than is absolutely necessary. In my case, I am allocating < 10% of the physical RAM. You will have to tailor the ramdisk size to your needs. Of course, you can always free up the space with a reboot!

Automating ramdisk creation :

If you need to create and mount a ramdisk every time your system boots, you can automate the process by adding some commands to your /etc/rc.local init script.

Here are the lines that can be added:

# Formats, mounts, and sets permissions for the 4 GB ramdisk
/sbin/mke2fs -q -m 0 /dev/ram0
/bin/mount /dev/ram0 /ramdisk
/bin/chown apache:apache /ramdisk
/bin/chmod 0750 /ramdisk

Cheers !
Harish.

Tuesday, January 10, 2012

Memory Hotplug for Linux Guests

Recently I was asked to increase the RAM in a couple of the development VM's, but this request came with a twist. We could not afford a reboot. It would waste a lot of time for the dev team to stop all the engines, start them up again after the reboot and wait for the VM to catch up and download all the relevant data from the database.

VMware forums were lacking in detail about the hot-add compatibility with client operating systems, so I realised I’d better lookup for a solution on Google and try it for my self see how it works.

The Hot add hardware feature is only supported on the VM hardware version 7. Once this was verified, I made sure the Edit Settings > Options > General Options was set to the correct OS type. This is important, as the interface will only display the Memory/CPU Hotplug options for supported OSes. In my case I was running CentOS 6.2 x86_64, so selected Red Hat Enterprise linux (64-bit).

Next, the " Memory/CPU Hotplug feature in Edit Settings > Options " should be enabled.

I found that the CentOS build I was using (2.6.32-220.el6.x86_64) recognises hot added memory automatically.

The VM was running with 4GB RAM, so I added another 4GB RAM and now it had 8GB RAM allocated to it.

When memory is hotplugged, the kernel recognizes new memory, makes new memory management tables, and makes sysfs files for new memory’s operation. If firmware supports notification of connection of new memory to OS, this phase is triggered automatically. ACPI can notify this event. If not, “probe” operation by system administration is used instead.

Within the "/sys/devices/system/memory" directory there are a number of folders all named ‘memoryX’ where X represents a unique ‘section’ of memory. How big each section is, and hence how many folders you have is dependant on your environment.

[root@vm24_dev ~]# ls -lrth /sys/devices/system/memory
total 0
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory9
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory8
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory7
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory6
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory5
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory4
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory3
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory2
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory11
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory10
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory1
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory0
--w-------. 1 root root 4.0K Jan 10 14:14 probe
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory71
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory70
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory69
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory68
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory67
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory66
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory65
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory64
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory63
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory62
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory61
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory60
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory59
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory58
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory57
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory56
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory55
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory54
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory53
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory52
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory51
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory50
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory49
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory48
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory47
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory46
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory45
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory44
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory43
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory42
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory41
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory40
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory39
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory38
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory37
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory36
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory35
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory34
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory33
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory32
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory23
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory22
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory21
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory20
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory19
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory18
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory17
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory16
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory15
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory14
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory13
drwxr-xr-x. 2 root root 0 Jan 10 14:14 memory12
-rw-r--r--. 1 root root 4.0K Jan 10 14:14 soft_offline_page
-rw-r--r--. 1 root root 4.0K Jan 10 14:14 hard_offline_page
-r--r--r--. 1 root root 4.0K Jan 10 14:14 block_size_bytes

You can check the file "/sys/devices/system/memory/block_size_bytes" to view the size of sections in bytes. Basically, the whole memory has been divided up into equal sized chunks as per the SPARSEMEM memory model.

[root@vm24_dev ~]# cat /sys/devices/system/memory/block_size_bytes
8000000

In each section’s folder there is a file called ‘state’, and in each file is one of two words; online or offline.
Locate the memoryX folder(s) which account for the hot added memory by working out the section sizes above, or (like me), just check the contents of the state files:

[root@vm24_dev ~]# cat /sys/devices/system/memory/memory39/state
online

Once you locate the offline sections, you can bring them online as follows:

[root@vm24_dev ~]#echo online > /sys/devices/system/memory/memory40/state
Validate the memory change using:

[root@vm24_dev ~]# free
total used free shared buffers cached
Mem: 8060484 262040 7798444 0 8080 60648
-/+ buffers/cache: 193312 7867172
Swap: 11300856 0 11300856

I noticed that William Lam (lamw on the VMware communities) created a nice script to automate the discovery and online process. It’s very neat and can be downloaded from : http://communities.vmware.com/docs/DOC-10492

You can also create it as follows:

[root@vm24_dev ~]# vi online_hotplug_memory.sh

Paste the following content in to the file and save it.
-------------------------------------------------------------------------
#!/bin/bash
# William Lam
# http://engineering.ucsb.edu/~duonglt/vmware/
# hot-add memory to LINUX system using vSphere ESX(i) 4.0
# 08/09/2009

if [ "$UID" -ne "0" ]
then
echo -e "You must be root to run this script.\nYou can 'sudo' to get root access"
exit 1
fi


for MEMORY in $(ls /sys/devices/system/memory/ | grep memory)
do
SPARSEMEM_DIR="/sys/devices/system/memory/${MEMORY}"
echo "Found sparsemem: \"${SPARSEMEM_DIR}\" ..."
SPARSEMEM_STATE_FILE="${SPARSEMEM_DIR}/state"
STATE=$(cat "${SPARSEMEM_STATE_FILE}" | grep -i online)
if [ "${STATE}" == "online" ]; then
echo -e "\t${MEMORY} already online"
else
echo -e "\t${MEMORY} is new memory, onlining memory ..."
echo online > "${SPARSEMEM_STATE_FILE}"
fi
done
-------------------------------------------------------------------------
[root@vm24_dev ~]# chmod +x online_hotplug_memory.sh
[root@vm24_dev ~]# ./online_hotplug_memory.sh

The out put should be as follows :

[root@vm24_dev ~]# ./online_hotplug_memory.sh
Found sparsemem: "/sys/devices/system/memory/memory0" ...
memory0 already online
Found sparsemem: "/sys/devices/system/memory/memory1" ...
memory1 already online
Found sparsemem: "/sys/devices/system/memory/memory2" ...
memory2 already online
Found sparsemem: "/sys/devices/system/memory/memory3" ...
memory3 already online
Found sparsemem: "/sys/devices/system/memory/memory4" ...
memory40 is new memory, onlining memory ...
Found sparsemem: "/sys/devices/system/memory/memory5" ...
memory41 is new memory, onlining memory ...
Found sparsemem: "/sys/devices/system/memory/memory7" ...
memory42 is new memory, onlining memory ...

That’s it! Quite simple really.

Cheers !
Harish.

Monday, January 24, 2011

Step by step guide to install Oracle 11G R2 on x86_64 Linux (CentOS 5.5)

Hardware Requirements:

Physical Memory
[root@centos55 ~]# grep -i memtotal /proc/meminfo
results: should be at least 1GB
Swap
[root@centos55 ~]# grep -i swaptotal /proc/meminfo
results: should be 1.5 the size of memtotal if memtotal <>
should be equal to memtotal if memtotal is between 2GB and 8GB
should be .75 the size of memtotal if memtotal > 8GB
Shared Memory
[root@centos55 ~]# df -k /dev/shm
results: informational
purpose: The shared memory should be sized to be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer.
Disk space in /tmp
[root@centos55 ~]# df -h /tmp
results: should have at least 400MB available
Disk space for Oracle binaries
[root@centos55 ~]# df -h
results: Depending on installation type you should have between 4.5GB and 4.9GB

Software requirements:

Linux distribution :
[root@centos55 ~]# cat /proc/version
Linux version 2.6.18-194.32.1.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Wed Jan 5 17:52:25 EST 2011

Kernel version:
[root@centos55 ~]# uname -r
2.6.18-194.32.1.el5

Required Packages:
[root@centos55 ~] # rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers-2.6.18 ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

It is probably a good idea to do a minimal install of the CentOS and install the following packages using Yum using the following commands.

[root@centos55 ~]# yum -y install compat-db gcc gcc-c++ libstdc++ pdksh sysstat compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static unixODBC unixODBC-devel libaio-devel
to install the missing packages.

[root@centos55 ~]# yum -y groupinstall "X Window System"

Create Oracle user and group

Create groups oinstall & dba

[root@centos55 ~]# groupadd oinstall
[root@centos55 ~]# groupadd dba
Create the Oracle user and change password
[root@centos55 ~]# useradd -g oinstall -G dba -s /bin/bash oracle
[root@centos55 ~]# passwd oracle

Creating Directories to Install the Oracle Software

[root@centos55 ~]# mkdir /u01
[root@centos55 ~]# mkdir /u02
[root@centos55 ~]# chown -Rf oracle:oinstall /u01
[root@centos55 ~]# chown -Rf oracle:oinstall /u02
[root@centos55 ~]# mount -o tcp,rsize=32768,wsize=32768,hard,intr,timeo=600 192.168.xxx.zzz:/vol/u02export /u02
[root@centos55 ~]# chown -Rf oracle:oinstall /u02

Setting shell limits for the Oracle user

[root@centos55 ~]# vi /etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

Add the following lines to /etc/pam.d/login

[root@centos55 ~]# vi /etc/pam.d/login
session required pam_limits.so

Add the following lines to /etc/profile

[root@centos55 ~]# vi /etc/profile

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

export ORACLE_BASE=/opt/app/oracle:$ORACLE_BASE
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0:$ORACLE_HOME
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export ORACLE_SID=orcl

Configuring kernel parameters

[root@centos55 ~]# vi /etc/sysctl.conf

kernel.shmmax = 6442450944
kernel.shmall = 2097152
kernel.shmmni=4096
kernel.sem=250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range=9000 65500
net.core.rmem_default=1048576
net.core.wmem_default=262144
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 262144 16777216
net.ipv4.tcp_wmem = 4096 262144 16777216
net.ipv4.tcp_window_scaling = 1

[root@centos55 ~]# sysctl -p


Unzipping the downloaded setup files:

Unzip the downloaded files to a temporary location.

[root@centos55 opt]# unzip linux.x64_11gR2_database_1of2.zip
[root@centos55 opt]# unzip linux.x64_11gR2_database_2of2.zip

[root@centos55 opt]# ls -lrth
total 2.2G
-rw-r--r-- 1 oracle oinstall 1.2G Mar 10 2010 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 oracle oinstall 1.1G Mar 10 2010 linux.x64_11gR2_database_2of2.zip

Here the files have been unzipped into /opt and the following commands will take you through starting the Oracle installer form that mount point.

[root@centos55 ~]# cd /opt/database

[root@centos55 ~]# ./runInstaller

From this point, Oracle will do a few minor checks on the operating system and then put up the Oracle Installation screen. Our particular configuration did not throw any errors at this point but it should be noted, as it can be helpful, that sometimes the Oracle installer will complain at this very early stage about various Linux system configurations. If this is the case you might be able to bypass them by adding an additional argument to the runInstaller command. Please only use this as a last resort to the normal installation path.

[root@centos55 ~]# ./runInstaller -ignoreSysPrereqs

The installation settings are pretty explanatory. Just go with the defaults, and if there is an error at some point the details panel will explain whats wrong.

At one point you will be asked for the SYSMAN password. Remember it because it will be used to login into the web console.

When you near the very end of the installation, you will be asked to run one or two scripts as root.

Just open up a terminal, su – into root and run the scripts which have their full paths displayed for your convenience.

Execute Configuration scripts

[root@centos55 ~]# /opt/app/oraInventory/orainstRoot.sh
[root@centos55 ~]# /opt/app/oracle/product/11.1.0/db_1/root.sh

1. accept default of /usr/local/bin
2. Click
3. Click
4. Click


Starting And Stoping Oracle

You might need to start oracle back up or stop it at some point so sue these commands which are located in:

/opt/oracle/product/11.2.0/db_1/bin/

emctl start dbconsole
lsnrctl start
dbstart

emctl stop dbconsole
lsnrctl stop
dbstop

Direct NFS Client

For improved NFS performance, Oracle recommend using the Direct NFS Client shipped with Oracle 11g. The direct NFS client looks for NFS details in the following locations:

$ORACLE_HOME/dbs/oranfstab

/etc/oranfstab

/etc/mtab


[root@centos55 ~]# vi $ORACLE_HOME/dbs/oranfstab

server: nas1
path: 192.168.xxx.yyy
export: /vol/u02export mount /u02

Since we already have our NFS mount point details in the "/etc/fstab", and therefore the "/etc/mtab" file also, there is no need to configure any extra connection details.

For the client to work we need to switch the libodm11.so library for the libnfsodm11.so library, as shown below.

SQL>shutdown immediate

[root@centos55 ~]# cd $ORACLE_HOME/lib
[root@centos55 ~]# mv libodm11.so libodm11.so_stub
[root@centos55 ~]# ln -s libnfsodm11.so libodm11.so

SQL>startup

With the configuration complete, you can see the direct NFS client usage via the following views:
v$dnfs_servers
v$dnfs_files
v$dnfs_channels
v$dnfs_stats
For example:
SQL> SELECT svrname, dirname FROM v$dnfs_servers;

SVRNAME DIRNAME
------------- -----------------
nas1 /vol/u02export

SQL>

Wednesday, July 28, 2010

Zabbix 1.8.2 on CenOS 5.5 (x86_64)


Installing Zabbix 1.8.2 on CenOS 5.5 and generating fake load to check the installation
==================================================================================

Install the basic CentOS 5.5 on a machine.

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

Update CentOS using the following command:

yum -y update

Note : Disable firewall and SELinux only for testing

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

Install EPEL using the following command:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

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

Install mysql and php using yum:

yum install mysql mysql-server php php-gd php-bcmath php-xml php-mbstring php-mysql

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

Download Zabbix rpm file from http://fedora.danny.cz/danny-el/5Server/

wget http://fedora.danny.cz/danny-el/5Server/x86_64/zabbix-web-mysql-1.8.2-2.el5.x86_64.rpm
wget http://fedora.danny.cz/danny-el/5Server/x86_64/zabbix-server-1.8.2-2.el5.x86_64.rpm
wget http://fedora.danny.cz/danny-el/5Server/x86_64/zabbix-1.8.2-2.el5.x86_64.rpm
wget http://fedora.danny.cz/danny-el/5Server/x86_64/zabbix-docs-1.8.2-2.el5.x86_64.rpm
wget http://fedora.danny.cz/danny-el/5Server/x86_64/zabbix-agent-1.8.2-2.el5.x86_64.rpm
wget http://fedora.danny.cz/danny-el/5Server/x86_64/zabbix-web-1.8.2-2.el5.x86_64.rpm
wget http://fedora.danny.cz/danny-el/5Server/x86_64/zabbix-server-mysql-1.8.2-2.el5.x86_64.rpm

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

Install the downloaded Zabbix rpm's using the following command :

yum --nogpgcheck localinstall zabbix-1.8.2-2.el5.x86_64.rpm zabbix-server-1.8.2-2.el5.x86_64.rpm zabbix-server-mysql-1.8.2-2.el5.x86_64.rpm zabbix-agent-1.8.2-2.el5.x86_64.rpm zabbix-docs-1.8.2-2.el5.x86_64.rpm zabbix-web-1.8.2-2.el5.x86_64.rpm zabbix-web-mysql-1.8.2-2.el5.x86_64.rpm

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

service httpd restart

chkconfig httpd on

==================================================================================
Configuring the Database part (MySQL)

service mysqld restart

chkconfig mysqld on

mysqladmin -u root password passw0rd!

mysql --user=root --password=passw0rd!

Welcome to the MySQL monitor. Commands end with ; or \g.

mysql> create database zabbix character set utf8;

mysql> create user 'zabbix'@'localhost' identified by 'password';

mysql> grant all on zabbix.* to zabbix;

mysql> flush privileges;

mysql> quit
Bye

Insert schema, data and images

cd /usr/share/doc/zabbix-server-mysql-1.8.2/create/schema

mysql --user=zabbix --password=password zabbix <>

cd ../data/

mysql --user=zabbix --password=password zabbix <>

mysql --user=zabbix --password=password zabbix <>

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

Configuing PHP

edit /etc/php.ini
;...
;max_execution_time = 600
;max_input_time = 600
;memory_limit = 256M
...
;upload_max_filesize = 16M
...
;post_max_size = 32M
...
;date.timezone = Europe/Brussels
...
;mbstring.func_overload = 2
...

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

Config Zabbix-server

edit /etc/zabbix/zabbix_server.conf
...
# Database user
DBUser=zabbix
....
#DBPassword=
DBPassword=
...

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

Config Zabbix-webinterface

create /usr/share/zabbix/conf/zabbix.conf.php (remove the ;)

;
;global $DB_TYPE,
;$DB_SERVER,
;$DB_PORT,
;$DB_DATABASE,
;$DB_USER,
;$DB_PASSWORD,
;$IMAGE_FORMAT_DEFAULT;
;$DB_TYPE = "MYSQL";
;$DB_SERVER = "localhost";
;$DB_PORT = "0";
;$DB_DATABASE = "zabbix";
;$DB_USER = "zabbix";
;$DB_PASSWORD = "";
;$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
;?>

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



service zabbix-server start

chkconfig zabbix-server on

service zabbix-agent start

chkconfig zabbix-agent on

lsof -i:10050

more /var/log/zabbix/zabbix_agentd.log

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

http://server/zabbix

Login using the following credentials :

login: admin / password: zabbix

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

Generate Fake CPU load :

perl -e 'while (--$ARGV[0] and fork) {}; while () {}' 4

top

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

Generate Fake Disk-IO load and Free unused memory currently unavailable :


dd if=/dev/zero of=junk bs=1M count=1K (This will vreate a 1 GB file)

dd if=/dev/zero of=junk bs=1M count=10K (This will vreate a 10 GB file)

This is an useful command for when your OS is reporting less free RAM than it actually has. In case terminated processes did not free their variables correctly, the previously allocated RAM might make a bit sluggis over time.

This command then creates a huge file made out of zeroes and then removes it, thus freeing the amount of memory occupied by the file in the RAM.
In this example, the sequence will free up to 1GB(1M * 1K) of unused RAM. This will not free memory which is genuinely being used by active processes.

rm -rf junk

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

Monitor Disk IO performance using iostat:

yum -y install sysstat

iostat -x 10 > /tmp/iostat.txt

tail -f /tmp/iostat.txt

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

Test network speed without wasting disk

dd if=/dev/zero bs=1M count=1M | ssh root@192.168.160.161 'cat > /dev/null'

The above command will send 1GB of data from one host to the next over the network, without consuming any unnecessary disk on either the client nor the host. This is a quick and dirty way to benchmark network speed without wasting any time or disk space.


ENJOY !