Categories
Archive
Blogroll

Microsoft PowerShell MVP

Cozumpark Bilisim Portali
Posted in Linux Server, Virtual Machine Manager | 11 Comments | 5,977 views | 15/08/2011 01:23

First part, we installed required components for Cacti. In this part, we’ll install and configure Cacti.

After MySQL installation, first we should set MySQL root password.

1
2
mysqladmin --user=root password p@ssw0rd!
mysqladmin --user=root --password reload

Let’s download latest Cacti release.

1
2
cd /home
wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz

Untar tar ball.

1
2
tar -zxvf cacti-0.8.7g.tar.gz
cd cacti-0.8.7g

Create the MySQL database for Cacti. You have to type your root password to create database.

mysqladmin --user=root create cacti --password

Import the default Cacti database.

mysql -u root -p cacti < cacti.sql

Create a MySQL username and password for Cacti for security reasons.

1
2
3
4
mysql -u root -p mysql
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipass!';
flush privileges;
exit

Edit “include/config.php” and specify the database type, name, host, user and password for your Cacti configuration.

nano include/config.php
$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cactiuser”;
$database_password = “cactipass!”;

Move Cacti files into /var/www/html for web access.

1
2
cd /home
mv /home/cacti-0.8.7g /var/www/html/cacti

Go into Cacti directory and set the appropriate permissions for graph/log generation.

1
2
cd /var/www/html
chown -R apache:apache cacti

Add a line to your ”/etc/crontab” file.

nano /etc/crontab
*/5 * * * * cactiuser /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1

Disable SeLinux to web restrictions.

nano /etc/sysconfig/selinux
SELINUX=disabled

Reboot your server to apply changes. After reboot, go to php.ini configuration and change timezone.

nano /etc/php.ini
date.timezone = “Europe/Istanbul”

We finished Cacti installation. Now go to your web browser and connect to http://yourserverip/cacti.

Choose “New Install” and click next.

Correct RRDTool default path.

RRDTool Binary Path: /usr/local/rrdtool/bin/rrdtool

Now Cacti is online!

You can login to Cacti with default username and password. After your first login, you should change password.

username: admin
password: admin

Now you can start adding your graphs :)


Posted in Linux Server, Virtual Machine Manager | 9 Comments | 6,584 views | 14/08/2011 16:22

Cacti is one of the best snmp based monitoring software. I’ll show you how to install and configure it on Hyper-V.
I’ve already posted couple of articles about CentOS 6 installation on Hyper-V, so I won’t mention about that again.

You can see CentOS 6 installation on Hyper-V at the following posts:

So I assume you have a CentOS 6 with Hyper-V LIS v3.1. So lets continue with Cacti installation.
Cacti requires that the following software is installed on your system.

1. Apache
2. PHP 5.x
3. MySQL 5.x
4. RRDTool 1.2.x

It’s time to install Apache on CentOS 6.

yum install httpd

Type “y” and press Enter to accept installation.

Now, start the Apache/httpd.

1
2
chkconfig httpd on
service httpd start

Now let’s install PHP.

yum install php php-mysql php-snmp php-xml

Type “y” and press Enter to accept installation.

Now we will install MySQL.

yum install mysql mysql-server

Type “y” and press Enter to accept installation.

Now, start the MySQL/mysqld.

1
2
chkconfig mysqld on
service mysqld start

It’s time to install last component, RRDTools. First, we need to install required dependencies.

yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel

Type “y” and press Enter to accept installation.

Install gcc to compile RRDTool.

yum install gcc

Type “y” and press Enter to accept installation.

Download latest RRDTool.

1
2
cd /opt/
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz

Untar tar ball.

1
2
tar -zxvf rrdtool-1.4.5.tar.gz
cd rrdtool-1.4.5

You need to set PKG_CONFIG_PATH.

PKG_CONFIG_PATH=/usr/lib/pkgconfig/

Now let’s configure and install RRDTool.

1
2
3
./configure
make
make install

After installation is completed, let’s test RRDTool.

1
2
3
4
cd /usr/local/rrdtool/share/rrdtool/examples/
./stripes.pl
ls -l
cp stripes.png /var/www/html/

Lets see our test graph:

We finished installation of required components for Cacti. Next part, we will see how to install and configure Cacti.

You can continue with Part 2:


Posted in Linux Server, Virtual Machine Manager | 4 Comments | 2,356 views | 07/08/2011 21:54

If you install Hyper-V Linux IS v3.1 on CentOS 6 and assign a new synthetic network card, network device name may change from eth0 to eth1. That’s not a good thing if you work with “Set-LinuxVM” because by default it works with eth0 (yes, you can consider this as a bug :))

Also I’m one of the guys who loves symmetry so I want to use eth0 instead of eth1, because my server has only one network adapter. So let’s look at the CentOS server.

If you go to Setup and network devices, you’ll see eth0 as a device.

I see eth0 in device menu but my server has no internet connection. Why? Let’s see current devices.

ifconfig -a

That’s the problem. Your pre-configured network device is eth0 but current device is changed as eth1.

It’s also same problem when you don’t set Linux VM’s MAC as static in Hyper-V Clusters. When your Linux VM jumps over another Hyper-V node, it may get a new MAC id from MAC pool of the new Hyper-V node. If MAC changes, your device name also changes and your network connection dies.

Actually you can change eth0 config as an eth1 to fix your network connection. Just you need to do:

1
2
cd /etc/sysconfig/network-scripts/
mv ifcfg-eth0 ifcfg-eth1

Also you need to edit ifcfg-eth1 file to change device name. But we want to use eth0 name instead of eth1.

So let’s go to CentOS 6 net rules:

nano /etc/udev/rules.d/70-persistent-net.rules

You will see two network devices in 70-persistent-net.rules.

Just leave the first one and remove ATTR{address}==”xx:xx:xx:xx:xx:xx″ from device.

Also at the end of the line, you will see the device name. That should be “eth0″.

Save the changes and reboot your VM. Let’s check device name again.

ifconfig -a

Now you can use eth0 in your CentOS 6 VM. Nice job!


Posted in Linux Server, Virtual Machine Manager | No Comment | 1,415 views | 28/07/2011 01:04

Microsoft, Hyper-V için Linux Integration Services v3.1 yayınladı.

Özellikler:

  • Sürücü desteği: Linux Integration Services, özellikle Hyper-V için geliştirilmiş Network, IDE ve SCSI depolama araçlarını destekler.
  • Hyper-V için Fastpath Boot desteği: Artık Boot sürücüleri yüksek performans verebilmek için Virtualization Service Client (VSC) avantajından faydalanmaktadır.
  • Timesync: Sanal sunucunun içerisindeki saat ile Hypervisor saati her zaman senkron kalmaktadır.
  • Integrated Shutdown: Sanal sunucular, Hyper-V veya SCVMM üzerindeki “Shut Down” komutuyla kapatılabilmektedir.
  • Symmetric Multi-Processing (SMP) desteği: Desteklenen Linux dağıtımları makina başı 4 sanal işlemci desteklemektedir. SMP desteği 32 bit işletim sistemlerinde bulunmamaktadır.
  • Heartbeat: Hypervisor’un sanal sunucunun açık ve cevap verebilir durumda olup olmadığını kontrol edebilmesini sağlar.
  • KVP (Key Value Pair) Exchange: Key Value Pair exchange özelliği sayesinde Linux sanal sunucu bilgileri ana host üzerinden okunabilmektedir.

Hala bulunmayan özellikler:

  • Entegrasyon servisleri: Volume Snapshot Backup
  • Networking: Jumbo Frames ve TCP Offload
  • Storage: Hot Add/Remove (VHD’ler ve Passthrough Diskler)

Desteklenen işletim sistemleri:

  • Red Hat Enterprise Linux 6.0 ve 6.1 x86 ve x64 (4 vCPU’ya kadar)
  • CentOS 6.0 x86 ve x64 (4 vCPU’ya kadar)

Download:

Kurulum dökümanını dosyanın içerisinde bulabilirsiniz.


Posted in Linux Server, Virtual Machine Manager, Windows Powershell | No Comment | 1,394 views | 27/07/2011 13:59

Yeni Hyper-V Linux Integration Service v3.1 ile birlikte gelen KVP Exchange desteği sayesinde bir çok bilgiyi çekebilmeniz mümkün. Öncelikle yapmanız gereken Get-HyperVKVP dosyasını indirmek ve bir Hyper-V sunucusunun üzerine kurmak olacaktır.

Download:

Scripti Hyper-V sunucusu üzerinde aşağıdaki gibi çalıştırabilirsiniz.

.\Get-HyperVKVP.ps1 VMName

Hyper-V üzerindeki CentOS 6 için örnek bir script çıktısı:

PS C:\> .\Get-HyperVKVP.ps1 Centos6

FullyQualifiedDomainName: centos6.yusufozturk.info
IntegrationServicesVersion: 3.1
NetworkAddressIPv4: 192.168.2.2
NetworkAddressIPv6: fe80::215:5dff
OSBuildNumber: 2.6.32-71.el6.x86_64
OSName: CentOS Linux release 6.0 (Final)
OSVersion: 2.6.32-71.el6.x86_64
ProcessorArchitecture: x86_64

Get-HyperVKVP.ps1 dosyasının kaynak kodu:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$vm = $args[0]
filter Import-CimXml
{
    $CimXml = [Xml]$_
    $CimObj = New-Object -TypeName System.Object
    foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY"))
    {
		if ($CimProperty.Name -eq "Name" -or $CimProperty.Name -eq "Data")
		{
			$CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
		}
    }
    $CimObj
}
$VmObj = Get-WmiObject -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where ElementName='$vm'"
$KvpObj = Get-WmiObject -Namespace root\virtualization -Query "Associators of {$VmObj} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"
$KvpObj.GuestIntrinsicExchangeItems | Import-CimXml

Bilgileri WMI üzerinden çektiği için bu scripti SCVMM üzerinde kullanamazsınız.
Fakat SCVMM üzerinden Hyper-V’ye bir WMI bağlantısı açarak bu işlemi yapmanız da mümkün tabiki.


Posted in Linux Server, Virtual Machine Manager | No Comment | 4,028 views | 27/07/2011 13:28

Bu makalede size CentOS 6 üzerinde nasıl Hyper-V Linux Integration Services v3.1 kurabileceğinizi gösteceğim.

Adım 1: Hyper-V LIC v3.1 indirebilmek için aşağıdaki komutları uygulayın.

1
2
3
cd /home
wget http://www.yusufozturk.info/linux/tools/LinuxICv31.tar
tar -xvf LinuxICv31.tar

Adım 2: untar işlemi sonrası “LinuxICv31″ klasörüne gidin ve dosyaları kontrol edin.

1
2
3
cd LinuxICv31
ls
cd x86_64

Adım 3: CentOS üzerinde “kmod-microsoft-hyper-v-rhel6-60.1.x86_64.rpm” kurulumunu yapın.

rpm -ivh kmod-microsoft-hyper-v-rhel6-60.1.x86_64.rpm

Adım 4: CentOS üzerinde “microsoft-hyper-v-rhel6-60.1.x86_64.rpm” kurulumunu yapın.

rpm –ivh microsoft-hyper-v-rhel6-60.1.x86_64.rpm

Adım 5: Eğer kurulum başarılıysa, aşağıdaki bilgi mesajını görmeniz gerekiyor.

Adım 6: Sanal sunucunuzu kapatıp, emulated network adaptörünü kaldırın ve yerine sentetik network adaptörü ekleyin.

Adım 7: Eski MAC adresinin aynısını yeni network adaptörüne ekleyin ve statik olarak ayarlayın.

Adım 8: Sanal sunucunuzu başlatabilirsiniz.


Posted in Linux Server, Virtual Machine Manager | 15 Comments | 7,216 views | 27/07/2011 12:29

We finished CentOS installation on first part. I’ll show you how to install Hyper-V LIC and mouse support.

Step 19: After installation reboot server and using keyboard, stay at GRUB menu. Press “e” to edit.

Step 20: Select kernel and press “e” again to edit kernel arguments.

Step 21: Go to end and type “3″ to boot in multi user mode without graphical interface. Press “Enter” to save changes.

Step 22: Select kernel again and press “b” button to boot from that kernel.

Step 23: Login with root username and password. Type “uname -a” to see your kernel.

Step 24: Try to ping an ip address to check your network connection.

Step 25: Type the commands below to download integration components.

cd /home
wget http://www.yusufozturk.info/linux/tools/LinuxICv31.tar
tar -xvf LinuxICv31.tar

Step 26: After untar, go into “LinuxICv31″ directory and check files.

cd LinuxICv31
ls
cd x86_64

Step 27: Install “kmod-microsoft-hyper-v-rhel6-60.1.x86_64.rpm” on CentOS.

rpm -ivh kmod-microsoft-hyper-v-rhel6-60.1.x86_64.rpm

Step 28: Install “microsoft-hyper-v-rhel6-60.1.x86_64.rpm” on CentOS.

rpm –ivh microsoft-hyper-v-rhel6-60.1.x86_64.rpm

Step 29: If installation is successful, then you should see this message.

Step 30: After LIC installation turn off your VM.

Step 31: Remove emulated network adapter. Add new synthetic network adapter.

Step 32: Set same MAC address but configure it as static.

Step 33: You can use CentOS 6 Desktop with mouse support.

PS: Mouse support is only available with Hyper-V LIC v3.2 at the moment.