Thursday, September 19, 2013

Install and Configure Zabbix2.0 with mysql

In RHEL5 and RHEL6
Install zabbix as root user


Install mysql
-------------
        # yum install mysql
Install PHP and Apache (http)
------------------------------
        # yum install php
        # yum install http


Installation from packages
-------------------------------
   

Installing repository configuration package

    Install the repository configuration package. This package contains yum configuration files.
    Zabbix 2.0 for RHEL5:
        # rpm -ivh http://repo.zabbix.com/zabbix/2.0/rhel/5/x86_64/zabbix-release-2.0-1.el5.noarch.rpm
    Zabbix 2.0 for RHEL6:
        # rpm -ivh http://repo.zabbix.com/zabbix/2.0/rhel/6/x86_64/zabbix-release-2.0-1.el6.noarch.rpm

Installing Zabbix packages

    Install Zabbix packages. Example for Zabbix server and web frontend with mysql database.

        # yum install zabbix-server-mysql zabbix-web-mysql


Creating initial database

    Create zabbix database and user on MySQL.
          
        # mysql -uroot
        mysql> create database zabbix character set utf8;
        mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
        mysql> exit
   
     
Import initial schema and data.
        # cd /usr/share/doc/zabbix-server-mysql-2.0.4/create
        # mysql -uroot zabbix < schema.sql
        # mysql -uroot zabbix < images.sql
        # mysql -uroot zabbix < data.sql

Starting Zabbix server process

    Edit database configuration in zabbix_server.conf

        # vi /etc/zabbix/zabbix_server.conf
        DBHost=localhost
        DBName=zabbix
        DBUser=zabbix
        DBPassword=zabbix


    Start Zabbix server process.

        # service zabbix-server start

Editing PHP configuration for Zabbix frontend

        Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured.
        php_value max_execution_time 300
        php_value memory_limit 128M
        php_value post_max_size 16M
        php_value upload_max_filesize 2M
        php_value max_input_time 300
        # php_value date.timezone Europe/Riga

    It's necessary to uncomment the “date.timezone” setting and set the 
right timezone for you. After changing the configuration file restart 
the apache web server.

        # service httpd restart
        
    Start MySql service

        # service mysql start
     
Browse the URL and Configure the zabbix  http://hostname/zabbix
    username : admin
    password : zabbix
    note : use localhost in the place of hostname
    database : zabbix
    username : zabbix
    password : zabbix

Have fun.....
    

Tuesday, November 27, 2012

Check the dir size

To check the Dir size.
=====================

[root@TESTBED ~]# du -h --max-depth=1 /opt/ | sort -n -r

[root@TESTBED ]# du -h --max-depth=1 | sort -n -r


File size
=====

[root@TESTBED ]# du -h -s /opt/abc.txt

[root@TESTBED ]# du -h -s /opt/*

Clear the memory cache.

Clear the memory cache.
======================

# sync; echo 3 > /proc/sys/vm/drop_caches

Hardware clock set

# hwclock --show
$ date

Set clock

To set the system clock directly:

# date MMDDhhmmYYYY



Hardware Clock Set
====================
To set the hardware clock directly (the argument must be in local time, even if you keep your hardware clock in UTC.):

# hwclock --set --date="YYYY-MM-DD hh:mm:ss"

# hwclock --set --date=hh:mm:ss"


or

Synch time to hardware to OS / OS to hardware

The hardware clock can be set from the system clock and vice versa:

# hwclock --systohc
# hwclock --hctosys

Create a local compressed tarball from remote system directory

Create a local compressed tarball from remote host directory


# ssh user@host "tar -cf - /path/to/dir" | gzip > dir.tar.gz

Public Key issue while installing rpm through yum


Public Key issue while installing rpm through yum.

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

1. Check keys.
  
    find / -name "*GPG*"

  - Will get answers like below

    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-former
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-rhx
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-auxiliary
    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta


2. Go to the /etc/pki/rpm-gpg/
    # cd /etc/pki/rpm-gpg/

3. type the below command.
   # rpm --import *GPG*

 The above command wont be give any kind of output.

Adding SWAP by dd command

Create and add swap space in linux.
===========================

#dd if=/dev/zero of=/swap1 bs=1024 count=1048576

#dd if=/dev/zero of=/dev/swap1 bs=1G count=4

#mkswap /swap1

#swapon /swap1

#free -m


bs=1024 ( 1MB )
count=1048576 ( 1GB )