Wednesday, 22 May 2013

Linux Disk performance tuning


Last weekend I had problems with heavily active server. I check and see that iostat is showing high disk activity service time was about 100. Also that caused cpu load. I try to find which process is causing disk activity. For this I turn on kernel messages about I/O. Normally for old kernels you could not directly see which process is causing heavy disk activity.

echo 1 > /proc/sys/vm/block_dump

dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head

I found kjournald causing disk activity. And I know many files are created in short term for that server. So I decide to tune filesystem. Filesystem is ext3. I decide to move writeback journaling. The writeback  mode does not preserve data ordering when writing to the disk, so commits to the journal may happen before the file system is written to. This method is faster because only the meta data is journaled, but is not quite as neurotic about protecting your data as the default.
I edit fstab and add writeback option
LABEL=/                 /                       ext3    defaults,data=writeback      1 1

Before reboot run this command.If not your server won't boot.
tune2fs -o journal_data_writeback /dev/sda1

Disable banner for ssh scripts

LogLevel=Error disables ssh banner in your script.

ssh -o LogLevel=Error -n  $ip  

Friday, 5 October 2012

Linux Disk performance tuning


Last weekend I had problems with heavily active server. I check and see that iostat is showing high disk activity service time was about 100. Also that caused cpu load. I try to find which process is causing disk activity. For this I turn on kernel messages about I/O. Normally for old kernels you could not directly see which process is causing heavy disk activity.

echo 1 > /proc/sys/vm/block_dump
 

dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head 


I
 found kjournald causing disk activity. And I know many files are 
created in short term for that server. So I decide to tune filesystem. 
Filesystem is ext3. I decide to move writeback journaling. The writeback
 mode does not preserve data ordering when writing to the 
disk, so commits to the journal may happen before the file system is 
written to. This method is faster because only the meta data is 
journaled, but is not quite as neurotic about protecting your data as 
the default.
I edit fstab and add writeback option
LABEL=/                 /                       ext3    defaults,data=writeback      1 1

Before reboot run this command.If not your server won't boot.
tune2fs -o journal_data_writeback /dev/sda1


Linux Disk performance tuning

Last weekend I had problems with heavily active server. I check and see that iostat is showing high disk activity service time was about 100. Also that caused cpu load. I try to find which process is causing disk activity. For this I turn on kernel messages about I/O. Normally for old kernels you could not directly see which process is causing heavy disk activity.

echo 1 > /proc/sys/vm/block_dump
 

dmesg | egrep "READ|WRITE|dirtied" | egrep -o '([a-zA-Z]*)' | sort | uniq -c | sort -rn | head 


I found kjournald causing disk activity. And I know many files are created in short term for that server. So I decide to tune filesystem. Filesystem is ext3. I decide to move writeback journaling. The writeback mode does not preserve data ordering when writing to the 
disk, so commits to the journal may happen before the file system is 
written to. This method is faster because only the meta data is 
journaled, but is not quite as neurotic about protecting your data as 
the default.
I edit fstab and add writeback option
LABEL=/                 /                       ext3    defaults,data=writeback      1 1

Before reboot run this command.If not your server won't boot.
tune2fs -o journal_data_writeback /dev/sda1

Friday, 16 March 2012

Python Cx_oracle ImportError "libclntsh.so.11.1"

I started to use cx_oracle module for inserting data to oracle. I get error below if i put related script to cron. 
"ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory"
 For solution you can run command like below in cron
 
* * * * * (/bin/ksh;export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib/;/usr/local/smthng.py) 

Monday, 3 October 2011

move volume group to another system


move volume group to another system

servera# umount /folder
vgname datasan, move volume inactive , and export
servera# vgchange -an datasan
servera# vgexport datasan

in serverb for import
serverb# vgimport datasan
serverb# vgchange -ay datasan
serverb# mount /dev/datasan/datalvname /fodler

Friday, 2 September 2011

check_by_ssh Remote command execution failed

"Remote command execution failed: *************************************************************************** "

try -E option for fixing this problem for check_by_ssh

Monday, 1 August 2011

500 OOPS: cannot change directory

I got this error in Red Hat 5.5 vsftp; 500 OOPS: cannot change directory
For this just run command below
setsebool -P ftp_home_dir on

Monday, 11 July 2011

find the WWN of a disk/LUN on Red Hat Enterprise Linux 5

find the WWN of a disk/LUN on Red Hat Enterprise Linux 5
# systool -c fc_host -v

Tuesday, 21 September 2010

Clone and Split 2G Virtualbox disk

In Virtual Box Media Manager release and remove disk this is important.
Run command below. Give full path, if not it will create disk in your home folder .
VBoxManage clonehd /media/VirtualBox/xpDomain/xpDomain.vdi /media/VirtualBox/xpDomain/xpSplited.vdi --format VMDK --variant Split2G

Wednesday, 28 July 2010

GPG error Synaptic Package Manager

For error
W: GPG error: http://download.virtualbox.org lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54422A4B98AB5139

run this command
# sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 54422A4B98AB5139

Tuesday, 15 June 2010

ssh initial connection slow

Check /etc/resolv.conf file and verify dns is working for the remote server.

Thursday, 20 May 2010

Citrix Client in Linux

Download and install package
http://www.citrix.com/English/ss/downloads/details.asp?downloadId=3323&productId=186&c1=sot2755&c2=ost1349860#top

Opening from web page
1. For the .mailcap file modification, in $HOME, create or modify the .mailcap file and add the line:
application/x-ica; /usr/lib/ICAClient/wfica.sh %s; x-mozilla-flags=plugin:Citrix ICA
2. For the MIME file modification, in $HOME, create or modify the .mime.types file and add the line:
application/x-ica ica


For ssl error

$ sudo cp /usr/share/ca-certificates/mozilla/GlobalSign_Root_CA.crt /usr/lib/ICAClient/keystore/cacerts/

Now you can use citrix client.

Wednesday, 28 April 2010

User Profile Deletion Utility

User Profile Deletion Utility (Delprof.exe)
Delprof.exe is available in the Windows Server 2003 Resource Kit. It is a command-line utility that you can use to delete user profiles on a local or remote computers running Windows 2000, Windows XP, and Windows Server 2003. User profiles can grow large and may take up considerable disk space, especially if there are several users using one computer. Because of this, you may want to use Delprof.exe to free disk space by deleting profiles that are no longer required. However, because each profile on the computer is presented in order when you run the utility, you may want to use the graphical interface instead of the command-line tool whenever possible.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=901a9b95-6063-4462-8150-360394e98e1e

Tuesday, 27 April 2010

Put Close/Maximize/Minimize Buttons on the Left in Ubuntu

Ubuntu 10.04 buttons are on the right side. I move them to right
Alt+F2
Go apps \ metacity \ general
You will see button_layout
change order
close,maximize,minimize:
to
:minimize,maximize,close

Tuesday, 23 February 2010

Mysql reset root password

# /etc/init.d/mysqld stop
# mysqld_safe --skip-grant-tables &
# mysql -u root

mysql> use mysql;
mysql> update user set password=PASSWORD("yournewpasswordhere") where User='root';
mysql> flush privileges;
mysql> quit

# /etc/init.d/mysqld stop
# /etc/init.d/mysqld start

Now you can login with your new password
# mysql -u root -p

Monday, 22 February 2010

Ubuntu set week start to monday

locale | grep LC_TIME
LC_TIME=en_US.UTF-8
cd /usr/share/i18n/locales
sudo cp en_US en_US_custom
sudo gedit en_US_custom
first_weekday 1 --> 2
sudo gedit /etc/environment
LC_TIME="en_US_custom.UTF-8"

Thursday, 18 February 2010

Linux Remove file start with special character

Delte file name --help or -help

rm ./--help
rm -- --help

Linux Remove file start with special character

Delte file name --help or -help

rm ./--help
rm -- --help

Friday, 12 February 2010

Ubuntu installing same packages to another ubuntu

I want to prepare test OS for my ubuntu. Before appyling patches or new software I do testing on that machine (running on virtualbox)
MachineA $ dpkg --get-selections > mypackages.txt

MachineB $ sudo dpkg --set-selections < mypackages.txt
MachineB $ sudo apt-get dselect-upgrade

Saturday, 30 January 2010

nagios create readonly user

# cd /etc/nagios/

htpasswd passowrdfile readonlyuser
# htpasswd htpasswd.users nagiosuser

Enter you password.

Then edit cgi.cfg file.There are different access you can enable.
# SYSTEM/PROCESS INFORMATION ACCESS
# CONFIGURATION INFORMATION ACCESS
# SYSTEM/PROCESS COMMAND ACCESS
# GLOBAL HOST/SERVICE VIEW ACCESS
# GLOBAL HOST/SERVICE COMMAND ACCESS

"GLOBAL HOST/SERVICE VIEW ACCESS" access is enough for read only users.
authorized_for_all_services=nagiosadmin,nagiosuser
authorized_for_all_hosts=nagiosadmin,nagiosuser

Friday, 29 January 2010

Moving Ubuntu in Company

M$ Windows OS is only supported OS in my company. But I decided to move linux, because i am administrating around 180 Linux bases machine. These are tools which used before and afer .

M$ Office 2007 --> Installed Crossover Linux and M$ Office 2007
M$ Office Communicator --> Pidgin with Office communicator plug in
Windows share --> samba smb://domain;username@host/share and add "connect to a server" applet to panel.
Remote Desktop --> Terminal Server Client
Securcrt --> ssh in console itself with ssh key and clusterssh
wireless --> Also wireless is ok with dynamic wep protected eap with ca certificate and mschapv2 authentication.
internet explorer --> firefox and google chrome
babylon dictionary --> stardict
backup --> ddrescue and rsync for individual folders
gtalk --> cntlm and pidgin
vpn --> kvpnc
itunes --> gtkpod and rhythmbox

Monday, 25 January 2010

Pidgin ntlmaps gtalk behind isa proxy

I need to connect gtalk. Because support team of vendor companies using gtalk.
Nntlmaps; proxy software that allows you to authenticate via an MS Proxy Server

Install ntlmaps
# sudo apt-get install ntlmaps

configure ntlmaps
# vi /etc/ntlmaps/server.cfg

PARENT_PROXY: your isa proxy ip adress
PARENT_PROXY_PORT: you isa proxy port
NT_DOMAIN: domainname
USER: nt username
PASSWORD: nt password
LISTEN_PORT:5865 (ntlmaps listen port)

Pidgin --> accounts --> manage accounts --> modify --> advanced
check force old ssl clear others
connect port: 443
connect server: talk.google.com

In proxy tab
Proxy type: http
Host: 127.0.0.1
Port: 5865 (ntlmaps port)
Username: nt username
password : nt password

Monday, 18 January 2010

Ssh user config file

I got bored running command ssh -Y root@hostname everytime. So I created ssh config file my user. So my user connects remote computer with ssh command and allowed X11 forwarding.

edit ssh config file in your home directory
vi ~/.ssh/config

Add this line
User root
ForwardX11 yes


I use ssh passwordless login (ssh keygen) for remote computers. Also clusterssh for executing remote commands one time.

ClusterSSH controls a number of xterm windows via a single graphical console window to allow commands to be interactively run on multiple servers over an ssh connection.

Wednesday, 23 December 2009

Flash player in Google Chrome Linux

Copy flash library from mozilla to chrome plugin directory.Then restart chrome.

# cd /opt/google/chrome
# mkdir plugins
# cp /usr/lib/mozilla/plugins/flashplugin-alternative.so /opt/google/chrome/plugins/

Install Tora on Ubuntu 9.10

Tora is client for oracle like Toad. http://torasql.com

OS: Ubuntu 9.10
Tora version: 2.2.0
Oracle client version: 11.1.0.1


Download oracle client packages for linux from http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
oracle-instantclient-basiclite-11.1.0.1-1.i386.rpm
oracle-instantclient-sqlplus-11.1.0.1-1.i386.rpm
oracle-instantclient-devel-11.1.0.1-1.i386.rpm

Install alien for rpm packages on Ubuntu
# sudo apt-get install alien

Install oracle client packages.
# sudo alien -i oracle-instantclient-basiclite-11.1.0.1-1.i386.rpm
# sudo alien -i oracle-instantclient-sqlplus-11.1.0.1-1.i386.rpm
# sudo alien -i oracle-instantclient-devel-11.1.0.1-1.i386.rpm


Edit /etc/ld.so.conf.d/oracle.conf
# sudo vi /etc/ld.so.conf.d/oracle.conf
add this line /usr/lib/oracle/11.1.0.1/client/lib
# sudo ldconfig
# sudo apt-get install libaio1


run sqlplus and see it is working.
# sqlplus
SQL*Plus: Release 11.1.0.6.0 - Production on Tue Dec 22 10:06:27 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Enter user-name


Building TORA
Continue as root
# sudo -i
Get packages for compiling.
# apt-get build-dep tora
# apt-get install libqt3-mt-dev libqt3-compat-headers libqscintilla-dev build-essential g++ gcc autoconf automake flex zlib1g-dev docbook-xsl debhelper alien libaio1 dpatch fakeroot xsltproc texi2html texinfo libqt3-mt-psql libqt3-mt-odbc config-package-dev cmake qt4-dev-tools
# cd tora-2.0.0
Environment variables also add this lines to your users .bashrc file.
# export ORACLE_HOME="/usr/lib/oracle/11.1.0.1/client"
# export LD_LIBRARY_PATH="${ORACLE_HOME}/lib"
# export TNS_ADMIN="${ORACLE_HOME}"
# ln -s /usr/include/oracle/11.1.0.1/client/ ${ORACLE_HOME}/include
# debian/rules binary
# dpkg -i ../tora_2.0.0-4build2_i386.deb

Now you can run Tora. Log out and log in to be sure you set environment variables. Also put your tnsnames.ora here /usr/lib/oracle/11.1.0.1/client

Saturday, 19 December 2009

How to boot from an existing Windows 7 partition under Ubuntu

This configuration could damage your Windows 7 installation, Backup you data.

Disk structure
Device Boot Start End Blocks Id System
Windows 7 /dev/sda1 * 1 46 364544 7 HPFS/NTFS
Windows 7 /dev/sda2 46 8515 68029440 7 HPFS/NTFS


# sudo apt-get install mbr
# sudo -i
# cd .Virtualbox


Create mbr
# install-mbr --force myBootRecord.mbr

Create your sda1 pointer
# VBoxManage internalcommands createrawvmdk -filename ./Win71.vmdk -rawdisk /dev/sda -partitions 1 -mbr ./myBootRecord.mbr -relative -register

Create sda2 pointer
# VBoxManage internalcommands createrawvmdk -filename ./Win72.vmdk -rawdisk /dev/sda -partitions 2 -relative -register

Now you can create your machine and add Win71.vmdk and Win72.vmdk disks.

Thursday, 17 December 2009

M$ Office Communicator on Linux

Use pidgin plugin for logon to Microsoft Office Communicator. This is for ubuntu.

# sudo apt-get install pkg-config libglib2.0-dev libgtk2.0-dev pidgin-dev libpurple-dev libtool intltool comerr-dev

Get plugin from http://sourceforge.net/projects/sipe/

# tar -xjvf pidgin-sipe*.tar.gz
# cd pidgin-sipe*
# ./configure --prefix=/usr
# make
# sudo make install

Now you can find M$ Office Communicator in Pidgin.

Tuesday, 10 November 2009

Can't log in after upgrade to 9.10

There is a bug in Ubuntu 9.10. Description is just like this stated in http://ubuntuforums.org/showthread.php?t=1305693

"I get as far as the gdm login screen, enter my info, get a brief flash, and am promptly returned to the login screen again. No error message; nothing."

First you have to edit .bashrc in your home directory and comment out this line
# export XAUTHORITY=$HOME/.Xauthorit

than delete monitors.xml file under $HOME/.config

Tuesday, 28 July 2009

Performance Analysis of Logs (PAL) Tool

This tool helps to analyse and create report from perfomance counter of Windows systems.
Just collect performance counters and you will find everything in the gui.
Best part is you can select server types like Exchange or Sql is running on server.
http://www.codeplex.com/PAL

Thursday, 16 July 2009

Configure smart host sendmail

Install sendmail
# yum install sendmail sendmail-cf
Edit sendmail.mc change the line
define(`SMART_HOST', `your.smart.host')dnl

Edit your /etc/hosts file and define your.smart.host
x.x.x.x your.smart.host

Friday, 3 July 2009

ubuntu clean /var/cache/apt/archives

Clean /var/cache/apt/archives directory with command;
# sudo apt-get clean

Tuesday, 2 June 2009

Process check in nagios with python

I wanto to implement nagios plugin to check process if it is running for servers. I used paramiko module for ssh in python
My restrictions:
I do not want to install any nagios agent to servers.
I do not want to use ssh autologin.
Reason I am lazy I do not want to visit all servers to generate public keys and copy to nagios server.


nagios configuration file command line
define command{
command_name check_process.py
command_line $USER1$/check_process.py $HOSTADDRESS$ $ARG1$ $ARG2$
}




Add lines below to check_process.py and make executable.

#!/usr/bin/python
# useage command ipaddress process maxcount
import paramiko, getpass
import os,sys,re
import signal


userName="user"
userPass="password"
server=sys.argv[1]
command="ps -ef | grep " + sys.argv[2] + " | grep -v grep |wc -l"
maxcount=int(sys.argv[3])


t = paramiko.Transport((server,22))
try:
t.connect(username=userName,password=userPass,hostkey=None)
except:
print server + ": Bad password or login!"
t.close()
else:
ch = t.open_channel(kind = "session")
ch.exec_command(command)
if (ch.recv_ready):
if int( ch.recv(1000) ) >= maxcount:
print "OK " + sys.argv[2]
t.close()
sys.exit(0)
else:
print "NOK " + sys.argv[2]
sys.exit(2)
t.close()

Thursday, 28 May 2009

How to convert snoop output to read in Ethereal

Snoop to a file in Solaris
# snoop -o test.snoopraw

Transfer your file in binary mode to your windows machine.
under your wireshark installation folder find editcap application and convert your file to wireshark
"D:\Program Files\Wireshark\editcap.exe" "d:\testsnoopraw" "d:\testsnoopraw.snoop"

Wednesday, 20 May 2009

Load balance and failover in Red Hat with qla driver

OS Red Hat Enterprise Linux AS release 4 (Nahant Update 3)
HBA Fibre Channel: QLogic Corp. QLA2312 Fibre Channel Adapter (rev 02)

download and install driver hp_qla2x00src-8.01.03p4-20b
backup your initrd files under /boot directory.

# cat /proc/scsi/qla2xxx/0
# cat /proc/scsi/qla2xxx/1

See your LUNs there under "SCSI LUN Information:"
SCSI LUN Information:
(Id:Lun) * - indicates lun is not registered with the OS.
( 0: 0): Total reqs 3, Pending reqs 0, flags 0x0*, 1:0:81 00
( 0: 1): Total reqs 58, Pending reqs 0, flags 0x0, 1:0:81 00

cd /opt/hp/src/hp_qla2x00src/
# ./set_parm
Choice: 1
Writing new /etc/hp_qla2x00.conf...done
adding line to /etc/modprobe.conf: alias scsi_hostadapter1 qla2xxx_conf
adding line to /etc/modprobe.conf: alias scsi_hostadapter2 qla2xxx
adding line to /etc/modprobe.conf: alias scsi_hostadapter3 qla2300
adding line to /etc/modprobe.conf: alias scsi_hostadapter4 qla2400
adding line to /etc/modprobe.conf: alias scsi_hostadapter5 qla6312
adding line to /etc/modprobe.conf: options qla2xxx ql2xmaxqdepth=16 qlport_down_retry=30 ql2xloginretrycount=16 ql2xfailover=1 ql2xlbType=1 ql2xautorestore=0x80

Would you like to create a new initrd to reflect the changes in the parameters (Y/n)? Y
Creating new initrd - initrd-2.6.9-55.0.2.ELsmp.img

---Press ENTER to continue---


reboot server.

If you want to be sure disconnect fiber cables and test failover. You will see dmesg output like below


qla2300 0000:42:01.0: LOOP DOWN detected (2).
qla2x00: FAILOVER device 0 from wwn-> wwn- LUN 01, reason=0x2
qla2x00: FROM HBA 0 to HBA 1
qla2300 0000:42:01.0: LIP reset occured (f700).
qla2300 0000:42:01.0: LOOP UP detected (2 Gbps).
scsi(0) :Loop id 0x0081 is an XP device
qla2x00: FAILBACK device 0 -> wwn LUN 01
qla2x00: FROM HBA 1 to HBA 0

vmware booting USB-harddrives workaround

I have installed Ubuntu to my usb disk. And later try to open ubuntu on usb disk from vmware. Vmware could not boot from usb disk. So I attach my usb disk physically to Vmware guest.

Edit preferences
in the hardware tab, delete hard disk
click add
choose hard disk
use physical disk (for advanced user) click next
in the device tab select your usb disk, it is physicaldrive3 for me. You can identify with disconnecting and trying it again.
click next and boot your machine

HP Product Bulletin

The HP Product Bulletin application provides you with the latest QuickSpecs, photos, drawings etc.
It is good, if you are working with HP hardware
http://h18000.www1.hp.com/products/quickspecs/productbulletin.html#intro


The HP Product Bulletin website is a convenient central resource providing technical overviews and specifications for HP hardware and software. The downloadable HP Product Bulletin application is loaded with features to aid with the purchase, sale and support of HP products.

QuickSpecs
Quick Quote
Product Photos
Locate by Name
Advanced Search Capabilities
Favorites
Retired Products
Tip of the Day

Monday, 18 May 2009

Repair Master Boot Record

When installing Ubuntu you may delete MBR. MBR point grub instead of Windows bootloader. If you want to move Windows bootloader again you can use fixmbr command.
Fixmbr - Repair Master Boot Record with MBRFix from Windows 2000, XP etc. instead of using fdisk /mbr. FixMbr could help you recreating original master boot record (MBR) that works with any Windows (Win2k), XP, 95, 98 when Linux LILO damaged it.
download from here http://www.ambience.sk/fdisk-master-boot-record-windows-linux-lilo-fixmbr.php
If you have one disk enter this command. If you have more than 1 physicial hard disk (hard drive), you have to use proper number for your disk
mbrfix /drive 0 fixmbr

If you could not boot your OS then use Windows Cd boot in recovery mode and in the command prompt use fdisk /mbr

Thursday, 14 May 2009

Bootchart

Bootchart is a tool for performance analysis and visualization of the GNU/Linux boot process.


Get bootchart http://www.bootchart.org/download.html
# bunzip2 bootchart-0.9.tar.bz2
# tar xvf bootchart-0.9.tar
# cd bootchart-0.9
# ./install.sh
# vi /boot/grub/grub.conf
change default=0 which is "title Bootchart logging"
# bootchartd init
# reboot


For compiling image processing
wget ftp://ftp.univie.ac.at/systems/linux/fedora/releases/10/Everything/i386/os/Packages/libgcj-src-4.3.2-7.i386.rpm
rpm -ivh libgcj-src-4.3.2-7.i386.rpm
# yum --disablerepo=\* --enablerepo=alteredupdate,alteredbase,dag install ant.i386


# cd bootchart-0.9
run for java compiling
# ant

Run bootchart to get your image
# java -jar bootchart.jar
Parsing /var/log/bootchart.tgz
Wrote image: ./bootchart.png


Here is my boot process image fedora 10 running on Vmware

Comparison of SVN and CVS

Concurrent Versions System (CVS), also known as the Concurrent Versioning System, is a free software revision control system
Subversion (SVN) is a version control system , maintain current and historical versions of files such as source code, web pages, and documentation

You can find a comparison here
http://www.pushok.com/soft_svn_vscvs.php

Tuesday, 12 May 2009

/var/spool/clientmqueue filling up

You can delete files in this directory.
Files are coming from script output in crontab. You can check which script causing this files with more and cat command in that directory
Edit your crontab file and add below to end of your crontab entries.
>/dev/null 2>&1

Thursday, 7 May 2009

Upgrade Fedora 7 to Fedora 8 Fedora 9 and finally to Fedora 10

Ok I am very late to upgrade from Fedora 7, but I found a mirror for Fedora 8 packages.

Fedora 7 to Fedora 8
# yum clean all

Get release files for fedora 8
# wget ftp://mirror.fraunhofer.de/archives.fedoraproject.org/fedora/linux/releases/8/Fedora/i386/os/Packages/fedora-release-notes-8.0.0-3.noarch.rpm
# wget ftp://mirror.fraunhofer.de/archives.fedoraproject.org/fedora/linux/releases/8/Fedora/i386/os/Packages/fedora-release-8-3.noarch.rpm

Install release files
# rpm -Uvh fedora*


Create test.repo file /etc/yum.repos.d/test.repo
Add the lines below:
[alterede]
name=alterercore
baseurl=ftp://mirror.fraunhofer.de/archives.fedoraproject.org/fedora/linux/releases/8/Everything/i386/os/
enabled=1
gpgcheck=0


Now start upgrade process
# yum --disablerepo=\* --enablerepo=alterede upgrade



Fedora 8 to Fedora 9
# yum clean all

edit /etc/yum.repos.d/test.repo
change
baseurl=ftp://mirror.fraunhofer.de/download.fedora.redhat.com/fedora/linux/releases/9/Everything/i386/os/

# wget ftp://mirror.fraunhofer.de/download.fedora.redhat.com/fedora/linux/releases/9/Everything/i386/os/Packages/fedora-release-9-2.noarch.rpm
# wget ftp://mirror.fraunhofer.de/download.fedora.redhat.com/fedora/linux/releases/9/Everything/i386/os/Packages/fedora-release-notes-9.0.0-1.noarch.rpm
# rpm -Uvh fedora-release-*
# yum --disablerepo=\* --enablerepo=alterede upgrade





Fedora 9 to Fedora 10

edit /etc/yum.repos.d/test.repo change line below
baseurl=ftp://mirror.fraunhofer.de/download.fedora.redhat.com/fedora/linux/releases/10/Everything/i386/os/

# yum clean all
# wget ftp://mirror.fraunhofer.de/download.fedora.redhat.com/fedora/linux/releases/10/Fedora/i386/os/Packages/fedora-release-10-1.noarch.rpm #
# wget ftp://mirror.fraunhofer.de/download.fedora.redhat.com/fedora/linux/releases/10/Fedora/i386/os/Packages/fedora-release-notes-10.0.0-1.noarch.rpm
# rpm -Uvh fedora-release-*



# yum --disablerepo=\* --enablerepo=alterede upgrade

If avahi package fails Error: Missing Dependency: libcap.so.1 is needed by package avahi-0.6.17-1.fc7.i386 (installed)
do uninstall of avahi with noscripts option
# rpm -e avahi-0.6.17-1.fc7.i386 --noscripts

Receive remote machine syslog messages.

Edit /etc/sysconfig/syslog file
change SYSLOGD_OPTIONS="-m 0 "
to
SYSLOGD_OPTIONS="-m 0 -r"

Restart syslogd deamon
service syslog restart

Wednesday, 29 April 2009

nagios directory update plugin

nagios plugin for checking a directory is updated. You need to give two argument first for directory and second for minutes.

PROGNAME=`basename $0`
PROGPATH=`echo $0 sed -e 's,[\\/][^\\/][^\\/]*$,,'`
. $PROGPATH/utils.sh

SEARCH=$1
MIN=$2
COUNT=$(find $1 -mmin -$2 wc -l sed -e 's/ //g' )


if [[ $COUNT -eq 0 ]]
then
echo "NOK " $SEARCH $COUNT "" $SEARCH"COUNT="$COUNT";;;; "
exit $STATE_CRITICAL
else
echo "OK " $SEARCH $COUNT "" $SEARCH"COUNT="$COUNT";;;;"
exit $STATE_OK
fi

nagios file count plugin

nagios plugin for checking a directory for count of file. You need to give two argument first for directory and second for file count.

PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
. $PROGPATH/utils.sh

SEARCH=$1
MAX=$2
COUNT=$(find $1 | wc -l| sed -e 's/ //g')


if [[ $COUNT -gt $MAX ]]
then
echo "NOK " $SEARCH $COUNT "|" $SEARCH"COUNT="$COUNT";;;;"
exit $STATE_CRITICAL
else
echo "OK " $SEARCH $COUNT "|" $SEARCH"COUNT="$COUNT";;;;"
exit $STATE_OK
fi

Friday, 24 April 2009

Nagios Installation CentOS 5.2

Change your repository
http://tlepsh.blogspot.com/2009/03/yum-ftp-only-repository.html
Add dag repository to your configuration

[dag]
name=CentOS-5 - Plus
baseurl=ftp://ftp-stud.fht-esslingen.de/dag/redhat/el5/en/x86_64/dag/
enabled=0
gpgcheck=0

Install nagios
#yum --disablerepo=\* --enablerepo=dag,alteredbase install nagios

Start nagios
#/etc/init.d/nagios start

Restart web service
#/etc/init.d/httpd restart

Create a password for nagiosadmin user
#htpasswd -c /etc/nagios/htpasswd.users nagiosadmin

Install nagios plugins and perl module that you will need
#yum --disablerepo=\* --enablerepo=alteredbase,dag install nagios-plugins.x86_64
#yum --disablerepo=\* --enablerepo=alteredbase,dag install perl-DBI perl-DBD-ODBC,perl-Convert-BER.noarch

device not accepting address , error -71

I had issues with usb hd. I got error like below
usb 6-7: new high speed USB device using address 2
usb 6-7: device not accepting address 2, error -71

run the command below
modprobe -r ehci_hcd

Wednesday, 1 April 2009

Move server RSA fingerprint to new server

I am using ssh auto login for transfering files between servers. I move RSA fingerprint to new server for preventing these warnings : REMOTE HOST IDENTIFICATION HAS CHANGED or confirming RSA key fingerprint Are you sure you want to continue connecting (yes/no).
Copy files under /etc/ssh directory to new server.
scp youroldserver:/etc/ssh/ssh_host_* /etc/ssh
You should move your ipadress to old server. If not you will get confirmation again.Or you can duplicate related entries in known_hosts file and change old ip adresses or hostname.

Friday, 27 March 2009

Access Linux Partitions (ext2/ext3) From Windows OS

Explore2fs: http://www.chrysocome.net/explore2fs
Ext2 Installable File System For Windows: http://www.fs-driver.org/index.html
DiskInternals Linux Reader: http://www.diskinternals.com/linux-reader

Thursday, 26 March 2009

Fedoa 10 linux adding encrypted partition with cryptsetup luks

Install related package
# yum -y install cryptsetup-luks

Here my disk is /dev/hdd1. Encypt partition with luksFormat option. Do not forget your passphrase
# cryptsetup --verbose --verify-passphrase luksFormat /dev/sdd1

Create mapping for enctypted partition under /dev/mapper. Enter your passphrase here.
# cryptsetup luksOpen /dev/sdd1 /dev/mapper anynameyougive(udisk2 for me)

Now you can find your mapping in under the mapper directory
# ls /dev/mapper

Format the disk.
# /sbin/mkfs.ext3 -j -m 1 /dev/mapper/udisk2

Mount the disk
# mount /dev/mapper/udisk2 /path/to/decide

Now you can use your encrypted partition.

Wednesday, 25 March 2009

Share ntfs partition with nfs

ntfs-3g module enable to read write access to ntfs partitions. Latest distributions support this module.
For exporting to read write access you have to use umask option, which enables everyone to write ntfs partition.
mount -o umask=000 /dev/sdb1 /media/disk

And entry for nfs /et/exports
/media/disk *(fsid=0,rw,sync,no_subtree_check)

Do not forget to restart nfs server.

Thursday, 19 March 2009

Yum Ftp only repository

I need to update servers but do not want to permit server to access internet via http, I created repository below which requires only ftp access.
Only "mirror.fraunhofer.de" is permitting ftp access so I use this server. Probably you can find other distros under same server. I go for CentOS here.
you have to use this command to update and install packages
yum --disableplugin=fastestmirror --disablerepo=\* --enablerepo=alteredbase install yum-fastestmirror
yum --disableplugin=fastestmirror --disablerepo=\* --enablerepo=alteredupdates update


create file /etc/yum.repos.d/x.repo with content below
[alteredbase]
name=CentOS-$releasever - Base
baseurl=ftp://mirror.fraunhofer.de/centos.org/5.2/os/x86_64/
gpgcheck=1
gpgkey=ftp://mirror.fraunhofer.de/centos.org/RPM-GPG-KEY-CentOS-5

[alteredupdates]
name=CentOS-$releasever - Updates
baseurl=ftp://mirror.fraunhofer.de/centos.org/5.2/updates/x86_64/
gpgcheck=1
gpgkey=ftp://mirror.fraunhofer.de/centos.org/RPM-GPG-KEY-CentOS-5

[alteredaddons]
name=CentOS-$releasever - Addons
baseurl=ftp://mirror.fraunhofer.de/centos.org/5.2/addons/x86_64/
gpgcheck=1
gpgkey=ftp://mirror.fraunhofer.de/centos.org/RPM-GPG-KEY-CentOS-5

[alteredextras]
name=CentOS-$releasever - Extras
baseurl=ftp://mirror.fraunhofer.de/centos.org/5.2/extras/x86_64/
gpgcheck=1
gpgkey=ftp://mirror.fraunhofer.de/centos.org/RPM-GPG-KEY-CentOS-5

[alteredcentosplus]
name=CentOS-$releasever - Plus
baseurl=ftp://mirror.fraunhofer.de/centos.org/5.2/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=ftp://mirror.fraunhofer.de/centos.org/RPM-GPG-KEY-CentOS-5

Yum cdrom dvd repository

Mount dvd under /media/cdrom

use command
yum --enablerepo=c5-media install pango-devel-1.14.9-3.el5.centos.x86_64.rpm

Wednesday, 4 February 2009

Motion capture linux

Motion application makes snapshots of the movement which can be converted to MPEG movies in realtime (or later for low cpu usage), making it usable as an observation or security system. It can take actions like sending out email and SMS messages when detecting motion. It also has its own build-in streaming webserver.
OS: Fedora 10
Webcam: Eyetoy Namtai (Playstation 2 camera)

Installing motion
http://motion.sourceforge.net/
# tar zxvf motion-3.2.11.tar.gz
# cd motion-3.2.11

I will not use database, disabled configuration.
# ./configure --without-mysql --without-pgsql
# yum install libjpeg
# yum install libjpeg-devel
# make
# make install
# yum install libjpeg-static

Motion option file motion-dist.conf is under /usr/local/etc
You can run option file witch -c switch
# motion -c /usr/local/etc/motion-dist.conf
change setup_mode off for getting image at http://127.0.0.1:8081
and
webcam_localhost off if you want to connect from another computer.


Eyetoy camera
gspca_main and gspca_ov519 is not working fine, I was getting corrupt image errors.
Download drivers

# rmmod gspca_main gspca_ov519
# wget http://www.rastageeks.org/downloads/ov51x-jpeg/ov51x-jpeg-1.5.9.tar.gz
# tar xzvf ov51x-jpeg-1.5.9.tar.gz
# cd ov51x-jpeg-1.5.9
# modprobe ov51x_jpeg

Thursday, 15 January 2009

Storage configuration management for 3510 and 2540

OS: solaris 10 intel
Server: x4150 , x4100 M2
Storage: SAN(HITACHI,EMC), StorageTek 3510, StorageTek 2540

I need to do kind of configuration management or change management. In case of any problem I want to know what was it before. So my script collects generic information like df, ifconfig, cfgadm,vfstab,luxadm outputs,. If you have storage device 2540 then collect information sscs , if you have 3510 then collects information with sccli command. I added information related to aLom and iLom via ipmitool.
I scp info to central machine. You can find how to do it from this blog, check previous articles.


#!/usr/bin/bash
command=/opt/SUNWstkcam/bin/sscs
OUTPUT=/path/storageinfo_$(hostname)_$(date +%Y%m%d)
echo /dev/null > $OUTPUT
date >> $OUTPUT
prtdiag >> $OUTPUT
df -h >> $OUTPUT
cat /etc/vfstab >> $OUTPUT
ifconfig -a >> $OUTPUT
netstat -rn >> $OUTPUT
cfgadm -al >> $OUTPUT
luxadm display $(luxadm probe | grep "Logical Path" | awk -F: '{print $2}') >> $OUTPUT
luxadm -e port | awk '{print $1}' | while read dump_map
do
luxadm -e dump_map $dump_map >> $OUTPUT
done

# Sun StorageTek 2540 Array part
if [[ $(luxadm display $(luxadm probe | grep "Logical Path" | awk -F: '{print $2}') | grep "Product ID" | grep -v Universal | awk -F: '{print $2}' | grep LCSM100_F |wc -l) -ge 1 ]]
then
$command list array | awk '{print $2}' | while read array
do
$command list -a $array controller >> $OUTPUT
$command list -a $array date >> $OUTPUT
$command list -a $array disk >> $OUTPUT
$command list -a $array fcport >> $OUTPUT
$command list -a $array firmware >> $OUTPUT
$command list -a $array host >> $OUTPUT
$command list -a $array hostgroup >> $OUTPUT
$command list -a $array initiator >> $OUTPUT
$command list -a $array jobs >> $OUTPUT
$command list -a $array license >> $OUTPUT
$command list -a $array mapping >> $OUTPUT
$command list -a $array os-type >> $OUTPUT
$command list -a $array pool >> $OUTPUT
$command list -a $array profile >> $OUTPUT
$command list -a $array registeredarray >> $OUTPUT
$command list -a $array snapshot >> $OUTPUT
$command list -a $array tray >> $OUTPUT
$command list -a $array vdisk >> $OUTPUT
$command list -a $array volume >> $OUTPUT
$command list -a $array volume-copy >> $OUTPUT
$command list -d $array fru
done

$command list alarm >> $OUTPUT
$command list array >> $OUTPUT
$command list device >> $OUTPUT
$command list devices >> $OUTPUT
$command list event >> $OUTPUT
$command list log >> $OUTPUT
$command list mgmt-sw >> $OUTPUT
$command list notification >> $OUTPUT
$command list site >> $OUTPUT
$command list storage-system >> $OUTPUT
$command list userrole >> $OUTPUT
fi


if [[ $(luxadm display $(luxadm probe | grep "Logical Path" | awk -F: '{print $2}') | grep "Product ID" | grep -v Universal | awk -F: '{print $2}' | grep "StorEdge 3510" |wc -l) -ge 1 ]]
then
command="sccli $(sccli -l|awk '{print $1}' | head -n 1)"
$command show access-mode >> $OUTPUT
$command show auto-write-through-trigger >> $OUTPUT
$command show battery-status >> $OUTPUT
$command show bypass raid >> $OUTPUT
$command show cache-parameters >> $OUTPUT
$command show channels >> $OUTPUT
$command show clone >> $OUTPUT
$command show controller-date >> $OUTPUT
$command show controller-name >> $OUTPUT
$command show disks >> $OUTPUT
$command show disk-array >> $OUTPUT
$command show drive-parameters >> $OUTPUT
$command show enclosure-status >> $OUTPUT
$command show events >> $OUTPUT
$command show frus >> $OUTPUT
$command show host-parameters >> $OUTPUT
$command show host-wwn-names >> $OUTPUT
$command show inquiry-data >> $OUTPUT
$command show ip-address >> $OUTPUT
$command show logical-drives >> $OUTPUT
$command show logical-volumes >> $OUTPUT
$command show lun-maps >> $OUTPUT
$command show media-check >> $OUTPUT
$command show network-parameter >> $OUTPUT
$command show partitions >> $OUTPUT
$command show peripheral-device-status >> $OUTPUT
$command show port-wwns >> $OUTPUT
$command show protocol >> $OUTPUT
$command show redundancy-mode >> $OUTPUT
$command show redundant-controller-configuration >> $OUTPUT
$command show rs232-configuration >> $OUTPUT
$command show safte-devices >> $OUTPUT
$command show sata-mux >> $OUTPUT
$command show sata-router >> $OUTPUT
$command show ses-devices >> $OUTPUT
$command show shutdown-status >> $OUTPUT
$command show stripe-size-list >> $OUTPUT
$command show unique-identifier >> $OUTPUT
#actually command below includes all information above
$command show configuration >> $OUTPUT

fi


echo "###############################IPMPITOOl##################################" >> $OUTPUT
ipmitool lan print >> $OUTPUT
ipmitool chassis status >> $OUTPUT
ipmitool mc info >> $OUTPUT
ipmitool sdr >> $OUTPUT
ipmitool sensor >> $OUTPUT
ipmitool fru >> $OUTPUT
ipmitool sel >> $OUTPUT
ipmitool user list 1 >> $OUTPUT



scp $OUTPUT tbackup@machine:/path/storageinfo_$(hostname)_$(date +%Y%m%d)

Background Processes in Unix/Linux

The & is an important little character in UNIX; it means "run the command in the background"; i.e., detach it from the window it was started from, so it does not block the command line.

Should the program ever try to read from the terminal window, it will be suspended, until the user "brings it to the foreground"; i.e., brings it to the state it would have had without the & to begin with.

To bring a program to the foreground, use "fg" or "%". If you have more than one background job to choose from ("jobs" will show you), then use for example "%2" to choose the second one.
Important:

If you forget to give the & at the end of line, and the process blocks the command input to the terminal window, you can put the process in the background "after the fact", by using Ctrl-Z. The process is suspended, and you get the command prompt back. The first thing you should do then is probably to give the command "bg", that resumes the process, but now in the background.

taken from http://www.astro.ku.dk/comp-phys/tutorials/background.shtml

Thursday, 18 December 2008

Fedora 10 package you need to compile kernel or build module

You have to download packages below.
# yum install yum-utils rpmdevtools
# yum install kernel-devel-$(uname -r)

Create user in Linux via vbscript

You can combine with previous script to handle creating users for AD and linux together.
I use plink to connect and execute useradd and passwd commands.
Edit sudo file to give these permissions to a user execute two command useradd and sudo. Do not forget to encrypt vbscript.


Dim strUser, strName, strContainer
strUser = InputBox (" Create user","username","")
strName = InputBox ("Name Surname","Name Surname","")
'if you want usernames in lowercase
'strUser = Lcase(StrUser)

' Check username length
If Len(strUser) = 0 Then
wscript.echo "empty username ?"
wscript.quit
End If

call Useradd(strUser)



Function Useradd(strUser)
Set WSHShell = WScript.CreateObject("WScript.Shell")
rc=WshShell.Run("c:\windows\plink.exe AUSERHAVINGSUDO@10.200.124.135 -pw password useradd -d /home/"&

strUser &" -s /bin/csh -c " & strUser & " -m " & strUser , 1, FALSE)
if err.number <> 0 Then
wscript.echo "problem creating user for linux"
wscript.quit
End if
End Function

Create user in AD, vbscript

Create and enable user in active directory environment. Set default password, and force user to change password in first logon.


Dim objRootLDAP, objContainer, objUser, objShell
Dim strUser, strName, strContainer
strUser = InputBox (" Create user","username","")
strName = InputBox ("Name Surname","Name Surname","")
'if you want usernames in lowercase
'strUser = Lcase(StrUser)

' Check username length
If Len(strUser) = 0 Then
wscript.echo "empty username ?"
wscript.quit
End If


call ADCreateUser(strUser,strName)



Function ADCreateUser(strUser,strName)
' parameters
' strName = strUser
strNewPasswd = "NA"&strUser&"99"
strContainer = "OU=YOUROU ,"

wscript.echo "username: " & strUser & " password: " & strNewPasswd

' Bind to Active Directory, Users container.
Set objRootLDAP = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://" & strContainer & objRootLDAP.Get("defaultNamingContext"))

' create user.
Set objUser = objContainer.Create("User", "cn=" & strUser)
objUser.Put "sAMAccountName", strUser
objUser.Put "displayName", strName
objUser.SetInfo

'Password set
objUser.Put "userAccountControl", 512
objUser.Put "PwdLastSet", 0
objUser.SetPassword(strNewPasswd)
objUser.SetInfo


End Function

Wednesday, 17 December 2008

Fedora 10 Installation from hard disk without cd/dvd or usb

I have running Fedora 6 and enough disk space to hold fedora 10 dvd iso.
Main idea is using initrd.img and vmlinuz under isolinux directory of dvd iso. Put them under /boot directory, edit grub.conf and boot from that kernel.

Downloaded Fedora-10-i386-DVD.iso to /mnt/disk2part1
Disk2part1 is /dev/hdc1 or /dev/sdc1.

# cd /mnt/disk2part1
# mkdir test
# mkdir images
# mount -o loop Fedora-10-i386-DVD.iso test
# cd test/isolinux
# cp initrd.img /boot/fedora10initrd.img
# cp vmlinuz /boot/fedora10vmlinuz
# cd ../images/
# cp install.img ../../images/

Now edit /boot/grub/grub.conf and add lines below

title Install Fedora 10
root (hd0,0)
kernel /fedora10vmlinuz
initrd /fedora10initrd.img

You should know where is your /boot directory. For me(hd0,0).
I select "install fedora 10" in boot screen and hard disk installation method.

webmin ssl_error_rx_record_too_long error

Install perl-Net-SSLeay module.
# yum inatall perl-Net-SSLeay

Now you can use ssl for webmin.

Wednesday, 12 November 2008

Ftp for Windows OS error handling

I need a ftp script for uploading files but in Windows OS this is not easy to handle. Error handling is painfull.
I wrote a python script, which you can supply two argument; local directory and file name you want to upload. So you can run this ftp python from batch file or vbscript.
It has good error handling for most kind of errors, could send email to you. Please fill related parameters. You should have running smtp server for getting email.

I put two vbscript function below, which can handle calling python script and send email in case of error.
First function for calling ftp python script.
Second function for sending email in case of vbscript error.(You should put "on error resume next" in your script)


Function ftppython(ftpfile)
Set objShell = CreateObject("WScript.Shell")
objShell.Run "E:\dirofyourscript\ftp.py E:\sysadmins\log "&ftpfile, 0, False
If Err.number <> 0 Then
sendanemail()
End If
Set objShell = Nothing
end function



Function sendanemail
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Problem mnp1 alarm script"
objMessage.From = "mail@domain.com"
objMessage.To = "youremail@domain.com;anotheremail@domain.com"
objMessage.TextBody = "Problem script"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "IPAdressofyoursmtp"
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMessage.Configuration.Fields.Update
objMessage.Send
end function




Python ftp script starts here

from ftplib import FTP
import sys, os, os.path, operator, shutil, smtplib

def upload(handle,filename):
f = open(filename,"rb")
(base,ext) = os.path.splitext(filename)
picext = ".bmp .jpg .jpeg .dib .tif .tiff .gif .png"
if(operator.contains(picext,ext)):
try:
handle.storbinary("STOR " + filename,f,1)
except Exception:
sendanemailo("Successful upload,but check it")
else:
print "Successful upload."
f.close()
return

try:
handle.storbinary("STOR " + filename,f)
except Exception:
sendanemail("Successful upload, but check it.")
else:
print "Successful upload."
f.close()
return


def download(handle,filename):
f2 = open(filename,"wb")
try:
handle.retrbinary("RETR " + filename,f2.write)
except Exception:
sendanemail("Error in downloadtelneting the remote file.")
return
else:
print "Successful download!"
f2.close()
return

def sendanemail(msg):
fromaddr = "from@domain.com"
toaddrs = "tome@domain.com"
subject = "ftp problem"
headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromaddr, toaddrs, subject)
message = headers + msg



server = smtplib.SMTP('ipadressofmailserver')
server.sendmail(fromaddr, toaddrs, message)
server.quit()
sys.exit()
return


#here are some parameters
host_name = "writeipaddress"
user = "user"
pwd = "password"
oldlocaldir = "z:\\sysadmins\log"
remotedir= "/remote/dir/"

if len(sys.argv) != 3:
sendanemail("there is no argument")
sys.exit()
uploadfile= sys.argv[2]
localdir = sys.argv[1]
os.chdir(localdir)
if not os.path.exists(uploadfile):
sendanemail("There is no file to upload")
sys.exit
if not os.path.exists(oldlocaldir):
sendanemail("There is no dir to move files")
sys.exit()
if not os.path.exists(localdir):
sendanemail("There is no local dir")
sys.exit()

try: ftph = FTP(host_name)
except:
sendanemail("Host could not be resolved.")
sys.exit()
else: pass
try:
ftph.login(user,pwd)
except Exception:
sendanemail("Invalid login combination.")
sys.exit()
else:
print "Successfully connected!\n"
try: os.chdir(localdir)
except:
sendanemail("chdir problem ")
sys.exit()
try: ftph.cwd(remotedir)
except:
sendanemail("there is problem in remotedir")
sys.exit()
try: upload(ftph,uploadfile)
except:
sendanemail("upload problem")
ftph.close()
try: shutil.move (uploadfile,oldlocaldir)
except:
sendanemail("problem move file")

Tuesday, 9 September 2008

How to find LUN id? Solaris

Your disk from Format command

6. c4t60060E8004F359000000F35900000D1Ad0
/scsi_vhci/ssd@g60060e8004f359000000f35900000d1a


grep related part luxadm probe

luxadm probe | grep c4t60060E8004F359000000F35900000D1Ad0
Logical Path:/dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2


Use logical path

luxadm display /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2
Vendor: HITACHI
Product ID: OPEN-V -SUN
Revision: 5008
Serial Num: 50 0F3590D1A
Unformatted capacity: 30720.000 MBytes
Write Cache: Enabled
Read Cache: Enabled
Minimum prefetch: 0x0
Maximum prefetch: 0x0
Device Type: Disk device
Path(s):

/dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2
/devices/scsi_vhci/ssd@g60060e8004f359000000f35900000d1a:c,raw
Controller /devices/pci@8,700000/SUNW,jfca@5/fp@0,0
Device Address 50060e8004f35919,0 (LUN is here, hex value)
Host controller port WWN 2000000173016d35
Class primary
State ONLINE
Controller /devices/pci@9,600000/SUNW,jfca@2/fp@0,0
Device Address 50060e8004f35909,0
Host controller port WWN 20000001730151e3
Class primary
State ONLINE



MPxIO c#t#d# c4t60060E8004F359000000F35900000D1Ad0
Array WWN 50060e8004f35919 (device address part)
lun 0 (device address part array wwn,LUN address (hex value) )
HBA WWNs 2000000173016d35

Friday, 5 September 2008

Solaris x86 boot GRUB bootenv.rc problem

GRUB Based Booting for Solaris x86 http://docs.sun.com/app/docs/doc/817-1985/hbx86boot-68676?a=view
I had booting problem last week. After grub screen, screen was black and later reboot. First I try rebooting verbose mode editing line in grub "kernel /platform/i86pc/multiboot kernel/unix -v"
How to Modify the Solaris Boot Behavior by Editing the GRUB Menu --> http://docs.sun.com/app/docs/doc/817-1985/fwbme?a=view
Then I got:
/boot/solaris/bootenv.rc - line 23, syntax error.

first we edit bootenv.rc

setprop console 'ttyb'
to
setprop console 'screen'

I could proceed with pressing ctrl+d two times (which stops running script at that time). So I could proceed with booting.
This is a bug related to kernel. Probably kernel do not show boot process to screeen. Also some boot scripts which gets information from eeprom (related to boot-args) hanged. In that kind of situations Ctrl+d could be good solution if you belive scripts hanged during boot.

Thursday, 4 September 2008

Export data from oracle via vbscript

I need to export data from oracle so it will be possible for me to generate alert from that log file. I do this because we do not have permission to change anything in the database.
Be carefull about fields section, you must know how many columns in the table.


'Parameters
path="c:\path.txt"
strHost="servername"
strPort="1529"
strSID="oraclesid"
strUsername="user"
strPassword="password"
dquerry="select * from table"


'Filesystem Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Check if file exist
If objFSO.FileExists(path) Then
Set objFile = objFSO.OpenTextFile(path,8,True)
else
wscript.echo "there is no file I am creating"
set objFile = objFSO.createtextfile(path)
'set objFile = objFSO.OpenTextFile(path,8, True)
end If


'open connection to database
Dim strCon
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=" & strHost & ")(PORT=" & strPort & "))" & _
"(CONNECT_DATA=(SID = " & strSID & "))); uid=" & strUsername & ";pwd=" & strPassword & ";"
Dim oCon: Set oCon = WScript.CreateObject("ADODB.Connection")
Dim oRs: Set oRs = WScript.CreateObject("ADODB.Recordset")
oCon.Open strCon


Set oRs = oCon.Execute(querry)
While Not oRs.EOF
objFile.WriteLine(oRs.Fields(0).Value &"," & oRs.Fields(1).Value &"," & oRs.Fields(2).Value &"," & oRs.Fields(3).Value &"," & oRs.Fields(4).Value

&"," & oRs.Fields(5).Value &"," & oRs.Fields(6).Value &"," & oRs.Fields(7).Value &"," & oRs.Fields(8).Value &"," & oRs.Fields(9).Value &"," &

oRs.Fields(10).Value &"," & oRs.Fields(11).Value &"," & oRs.Fields(12).Value &"," & "Q3" &"," & "Q3" &"," & oRs.Fields(15).Value &"," & oRs.Fields(16).Value

)
oRs.MoveNext
Wend
oCon.Close
Set oRs = Nothing
Set oCon = Nothing

Wednesday, 3 September 2008

Flash archive backup central server

I create flash archive backup and copy to central server. If there is any error in backup process or scp process I got mail.
Also scp works passwordless and secure.

First create transfer user at central server and give necceseery permissions.
At the main server:


# useradd transfer -d /export/home/transfer
# passwd transfer
# chown transfer /centralbackup/dir


At servers which you are going to backup, create public keys.


# ssh-keygen -t rsa
# cat ~/.ssh/id_rsa.pub


copy content to the transfer user in central server /transferuserhomedirectory/.ssh/authorized_keys . Be carefull there is no line break in the id_rsa.pub file.
now you can login without password to central server test is ssh transfer@centralserver.

This is the script that you can backup weekly.


backupname=$(hostname)_$(date '+%Y%m%d')
backupdir=/site/local/backupdir
remotebackupdir=/centralbackup/dir
remoteloc=transfer@mainserver:$remotebackupdir
mailaddress="yourmailaddress@domaim.com"
#if you want to exclude directories when you are creating flash archive use -x
flarcreate -c -S -n $backupname -x /putdirthatyouwanttoexclude -x /anotherexclude $backupdir/$backupname.flar
#check if there is problem creating flash archive
if [ $? -ne 0 ] ; then
echo flarcreate problem in $(hostname) "\n" | mailx -s "$(hostname) flarcreate problem" $mailaddress
exit 1
fi
scp $backupdir/$backupname.flar $remoteloc
#check if there is problem copying to central server.
if [ $? -ne 0 ] ; then
echo backup copy problem in $(hostname) "\n" | mailx -s "$(hostname) backup copy problem" $mailaddress
exit 1
fi
#deletes backup of previous week
rm $backdir/$(hostname)_$(TZ=GMT+167 date +%Y%m%d).flar
#check if there is problem deleting file
if [ $? -ne 0 ] ; then
echo old backup delete problem in $(hostname) "\n" | mailx -s "$(hostname) old backup delete problem" $mailaddress
exit 1
fi

Tuesday, 2 September 2008

Inetadm connection_backlog

I patched Solaris 10 x86 which holding a another zone in container.
I got error booting guest zones

Sep 2 13:23:54 inetd[22765]: Unable to read debug property from config property group. scf_simple_prop_get() failed: entity not found
Sep 2 13:23:54 inetd[22765]: Property 'connection_backlog' of instance svc:/network/rpc/gss:default is missing, inconsistent or invalid
Sep 2 13:23:55 svc.startd[22540]: network/inetd:default failed repeatedly: transitioned to maintenance (see 'svcs -xv' for details)
Sep 2 13:23:55 svc.startd[22540]: failed to abandon contract 32259: Permission denied



Output of svcs -xv says gss inetd and related services are failing

svc:/network/rpc/gss:default (Generic Security Service)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: gssd(1M)
Impact: 14 dependent services are not running. (Use -v for list.)

svc:/application/print/server:default (LP print server)
State: disabled since Tue Sep 02 14:43:57 2008
Reason: Disabled by an administrator.
See: http://sun.com/msg/SMF-8000-05
See: lpsched(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/network/rpc/rstat:default (kernel statistics server)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: rpc.rstatd(1M)
See: rstatd(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/network/rpc/smserver:default (removable media management)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: rpc.smserverd(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/application/print/cleanup:default (print cleanup)
State: maintenance since Tue Sep 02 14:43:58 2008
Reason: Start method failed repeatedly, last exited with status 1.
See: http://sun.com/msg/SMF-8000-KS
See: /var/svc/log/application-print-cleanup:default.log
Impact: This service is not running.

svc:/network/inetd:default (inetd)
State: maintenance since Tue Sep 02 14:44:07 2008
Reason: Restarting too quickly.
See: http://sun.com/msg/SMF-8000-L5
See: inetd(1M)
See: /var/svc/log/network-inetd:default.log


I set the value below and restarted zone, now it is ok

inetadm -M connection_backlog=10

Thursday, 28 August 2008

Booting Solaris Intel into single user mode

Press e in when grub shows at boot time.
Edit multiboot line below and add -s to the end press enter
then b for boot

root (hd0,0,a)
kernel /platform/i86pc/multiboot -s
module /platform/i86pc/boot_archive

Or you can edit /boot/grub/menu.lst and add new entries like below copy your original entries in the file and add -s to end of multiboot line.
title Solaris 10 11/06 s10x_u3wos_10 X86
root (hd0,0,a)
kernel /platform/i86pc/multiboot -s
module /platform/i86pc/boot_archive

Thursday, 21 August 2008

Secure port forwarding without shell access

My aim was connection to ssh deamon on defined port (4321 for this example) different then default port and specific users (only for theusername for this example) without shell access and permiting port forwarding. Chroot for sshd is painfull.


Create custum sshd config file
cp /etc/ssh/sshd_config /etc/sshsshd_config_custom


Changed options in sshd_config_custom file
Port 4321
PermitRootLogin no
AllowUsers theusername


With this configuration file, only theusername could connect ssh deamon on port 4321.
Run sshd deamon
/usr/lib/ssh/sshd -f /data01/tcell/sshd_config_config


Change shell to /usr/bin/false in passwd file

vi /etc/passwd
theusername:x:404:808::/homefolder:/bin/sh
theusername:x:404:808::/homefolder:/usr/bin/false


If you do not have false shell create read only shell.
vi /usr/bin/dummyshell
add two lines below
#!/bin/bash
bash -r -c read

Make executable
chmod a+x  /usr/bin/dummyshell

From remote computer:
So user had to use -N option for ssh command
     -N

Does not execute a remote command. This is useful if you
just want to forward ports (protocol version 2 only).


For port forwarding from another system
ssh -N theusername@ipadressoftheserver -L 9999:127.0.0.1:9999 -p 4321


-p for changed ssh port in sshd_config_custom

Now user could not give any command on the server but could port forward 9999 from the server to computer.

Friday, 15 August 2008

Shell script argument check and directory check

With this part you can check arguments are supplied and give usage information.
if [ $# -ne 2 ]
then
echo 1>&2 Usage: $0 firstdatafile lastdatafile
exit 127
fi

Create if directory does not exist
DESTDIR=dirname
if ! test -d "$DESTDIR"
then mkdir -p $DESTDIR
fi

Tuesday, 12 August 2008

Relocating Oracle Data Files

Check for location
SQL> SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES WHERE TABLESPACE_NAME = 'TABLESPACE';

FILE_NAME
--------------------------------------------------------------------------------
BYTES
----------
/dbfiles/oradata03/loc/FILE_DATA01.dbf
4294967296


Take tablespace offline
SQL> ALTER TABLESPACE FILE_DATA OFFLINE NORMAL;

Tablespace altered.

Copy file to the new location.
cp /dbfiles/oradata03/loc/FILE_DATA01.dbf /dbfiles/oradata05/loc/FILE_DATA01.dbf
Check for file permission and owner.

Do it for Oracle
SQL> ALTER TABLESPACE FILE_DATA RENAME DATAFILE '/dbfiles/oradata03/loc/FILE_DATA01.dbf' to '/dbfiles/oradata05/loc/FILE_DATA01.dbf';

Tablespace altered.


Take tablespace online
SQL> ALTER TABLESPACE FILE_DATA ONLINE;

Tablespace altered.

Monday, 11 August 2008

Solaris new disks from SAN

This commands help you to force configuration of new disks.
cfgadm -o force_update -c configure c3

Then you can run devfsadm or drvconfig
and later format and newfs.


Before

# cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 CD-ROM connected configured unknown
c1 fc-private connected configured unknown
c1::500000e010c3b8e1 disk connected configured unknown
c1::500000e010c466c1 disk connected configured unknown
c1::500000e010c47e51 disk connected configured unknown
c1::500000e010c47f31 disk connected configured unknown
c1::500000e010c49711 disk connected configured unknown
c1::500000e010c49b41 disk connected configured unknown
c1::50800200001f8811 ESI connected configured unknown
c2 fc-fabric connected configured unknown
c2::50060e8000c41da3 disk connected configured unknown
c2::50060e8000c41da7 disk connected configured unknown
c2::50060e8004f35919 disk connected unconfigured unknown
c3 fc-fabric connected configured unknown
c3::50060e8000c41da2 disk connected configured unknown
c3::50060e8000c41da6 disk connected configured unknown
c3::50060e8004f35909 disk connected unconfigured unknown
pcisch0:hpc1_slot0 fibre/hp connected configured ok
pcisch0:hpc1_slot1 unknown empty unconfigured unknown
pcisch0:hpc1_slot2 unknown empty unconfigured unknown
pcisch0:hpc1_slot3 unknown empty unconfigured unknown
pcisch2:hpc2_slot4 unknown empty unconfigured unknown
pcisch2:hpc2_slot5 unknown empty unconfigured unknown
pcisch2:hpc2_slot6 unknown empty unconfigured unknown
pcisch3:hpc0_slot7 fibre/hp connected configured ok
pcisch3:hpc0_slot8 pci-pci/hp connected configured ok

You can see that c3::50060e8004f35909 c2::50060e8004f35919 not configured.

Run cfgadm
cfgadm -o force_update -c configure c2

Now you can see c2::50060e8004f35919 configured. Do this also for c3

# cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c0 scsi-bus connected configured unknown
c0::dsk/c0t0d0 CD-ROM connected configured unknown
c1 fc-private connected configured unknown
c1::500000e010c3b8e1 disk connected configured unknown
c1::500000e010c466c1 disk connected configured unknown
c1::500000e010c47e51 disk connected configured unknown
c1::500000e010c47f31 disk connected configured unknown
c1::500000e010c49711 disk connected configured unknown
c1::500000e010c49b41 disk connected configured unknown
c1::50800200001f8811 ESI connected configured unknown
c2 fc-fabric connected configured unknown
c2::50060e8000c41da3 disk connected configured unknown
c2::50060e8000c41da7 disk connected configured unknown
c2::50060e8004f35919 disk connected configured unknown
c3 fc-fabric connected configured unknown
c3::50060e8000c41da2 disk connected configured unknown
c3::50060e8000c41da6 disk connected configured unknown
c3::50060e8004f35909 disk connected unconfigured unknown
pcisch0:hpc1_slot0 fibre/hp connected configured ok
pcisch0:hpc1_slot1 unknown empty unconfigured unknown
pcisch0:hpc1_slot2 unknown empty unconfigured unknown
pcisch0:hpc1_slot3 unknown empty unconfigured unknown
pcisch2:hpc2_slot4 unknown empty unconfigured unknown
pcisch2:hpc2_slot5 unknown empty unconfigured unknown
pcisch2:hpc2_slot6 unknown empty unconfigured unknown
pcisch3:hpc0_slot7 fibre/hp connected configured ok
pcisch3:hpc0_slot8 pci-pci/hp connected configured ok


After that I can see disk in format menu. Change disk layout.
6. c4t60060E8004F359000000F35900000D1Ad0
/scsi_vhci/ssd@g60060e8004f359000000f35900000d1a

Create file system
newfs /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s0

Thursday, 7 August 2008

Making rpm package from source

If you downloaded source rpm package like *.src.rpm,
You cand make rpm package with rpmbuild command.
# rpmbuild --rebuild /var/tcell/packagename.src.rpm

Sysstat linux package - sar sa1 sa2 sadc

For SUSE I installed these packages before installing sysstat
rpm -ivh libgcj-3.3.3-43.24.i586.rpm
rpm -ivh plotutils-2.4.1-575.1.i586.rpm
rpm -ivh gettext-0.14.1-30.1.i586.rpm
rpm -ivh sysstat-5.0.1-35.1.i586.rpm
rpm -ivh gnuplot-3.7.3-256.1.i586.rpm

sysstat-8.1.2-4.1.i586.rpm

I took some time for me to find cron job location
/etc/cron.d/sysstat
#crontab for sysstat

#activity reports every 10 minutes everyday
-*/10 * * * * root /usr/lib/sa/sa1

#update reports every 6 hours
0 */6 * * * root /usr/lib/sa/sa2 -A

You can check reports via sar command. If you want to be sure that cron wor
sar -f /var/log/sa/sa07
Last two digit depends on day of month

You can find configuration file under /etc/sysstat
ls /etc/sysstat
sysstat sysstat.cron sysstat.ioconf

Thursday, 24 July 2008

unary operator expected shell script

Place quotes around your variables

if [ "$state" != "" ]
then
echo problem
fi

Monday, 14 July 2008

Subtract dates in Linux

This is working for Linux
main idea find the seconds since "00:00:00 1970-01-01 UTC"
then subtract them. This is GNU extension.

$ a=$(date -d "Tue Apr 29 14:02:19 PDT 2003" +%s)
$ b=$(date -d "Tue Apr 05 14:02:19 PDT 2003" +%s)
$ d=$(( $a - $b ))
$ echo $(( $d / 3600 / 24 ))

Friday, 11 July 2008

gcc-4.1.1 solaris 10 AMD Sun Fire X4100 M2

Old version off gcc was already installed so I used it.

bunzip2 gcc-4.1.1.tar.bz2
/usr/sfw/bin/gtar xvf gcc-4.1.1.tar
cd gcc-4.1.1

We need gnu make
ln -s /usr/sfw/bin/gmake /usr/sbin/make

Env variables
export PATH=/usr/ucb:/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin
export CC=gcc


Configure with recommended options
./configure --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared
make
make install

typeflag L not recognized

Error with tar
typeflag 'L' not recognized, converting to regular file

use gtar
/usr/sfw/bin/gtar

Thursday, 15 May 2008

Vmware Xp unmountable_boot_volume

vmware server installed in suse linux 9
When we were installing Windows Xp, we got unmountable_boot_volume error.
I converted Xp installation cd to iso image and mount iso image instead of mounting cd

Friday, 18 April 2008

Use a PAE enabled kernel

If server has 4 GB or more memory, some operating systems may not access all of the memory. 64 bit OS are out of this subject.
Some PCI, PCI-X and PCI-Express cards use memory below 4 GB which known as PCI hole or PCI Extended Configuration Space. This space could not allocated for system memory and relocated above 4 GB. Then if the operating system is not PAE enabled or not allowed to because of limitation (like Windows Standart edition) could not use this memory location and shows less then 4 GB.

For Windows edition you can add /PAE switch to the boot.ini. (not for XP and standart edition)
For Linux
I confused, because kernel-smp (2.6) versions say that it is supporting up to 16 GB.
But You have to install bigsmp kernel instead of smp for SUSE. And i686-smp or hugemem kernels for Red Hat. (kernel-hugemem is required for memory configurations higher than 16 GB).
There is kernel-pae packeges for some distributions(Fedora, CentOS).

You can find warning message "Use a PAE enabled kernel" from output of dmesg command.
BTW There is another option that you can compile your kernel.

Thursday, 17 April 2008

Zenoss Installation Fedora 7

Zenoss requires older version of python. But Fedora 7 or later comes with newer version.

Mysql installation
------
Mysql packages
mysql-devel-5.0.37-2.fc7.i386.rpm
mysql-libs-5.0.37-2.fc7.i386.rpm
mysql-5.0.37-2.fc7.i386.rpm
perl-DBI-1.53-2.fc7.i386.rpm
mysql-server-5.0.37-2.fc7.i386.rpm
perl-DBD-MySQL-3.0008-1.fc7.i386.rpm

# chkconfig mysqld on
# service mysqld start

Give password for mysql
# /usr/bin/mysqladmin -u root password pass

Some other packages you need:
make-3.81-6.fc7
swig-1.3.31-0.fc7
autoconf-2.61-8.fc7

python installation
------
You need older version of python (2.4) for zenoss installation. You can compile and install to another path

# mkdir /opt/python/python2.4.4
# ./configure --prefix=/opt/python/python2.4.4
# make
# make install
# cd /usr/local/bin
# ln -s /opt/python/python2.4.4/bin/python
# ln -s /opt/python/python2.4.4/bin/python2.4



zenoss installation
------
# useradd zenoss
# cat /etc/passwd | grep zenoss


edit profile
cd /home/zenoss
vi .bashrc
export ZENHOME=/usr/local/zenoss
export PYTHONPATH=$ZENHOME/lib/python
export PATH=$ZENHOME/bin:$PATH

# mkdir /usr/local/zenoss
# chown zenoss /usr/local/zenoss

$ tar xvf zenoss-2.1.3.tar.gz
$ cd zenoss-2.1.3
$ ./install.sh


I got this error
AttributeError: /usr/local/zenoss/bin/python: undefined symbol: netsnmp_get_version

Solve this with installing packages below
# rpm -ivh lm_sensors-2.10.3-2.fc7.i386.rpm
# rpm -ivh net-snmp-libs-5.4-13.fc7.i386.rpm
# rpm -ivh net-snmp-5.4-13.fc7.i386.rpm

Wednesday, 16 April 2008

Solaris mpxio

I listed server and storage that I used. I do not know exact model names.
Sun Fire X4150 DGC
Sun Fire X4150 HITACHI-DF600F
Sun Fire X4150 SUN-StorEdge 3510
Sun Fire X4100 M2 HITACHI-OPEN-V*5 HITACHI-OPEN-V HITACHI-OPEN-V*14
Sun Fire X4100 M2 SUN-StorEdge 3510
Sun Fire X4100 M2 EMC-SYMMETRIX-5771

Default configuration worked for all storages above but I had to enter entries below to /kernel/drv/scsi_vhci.conf for mpxio
device-type-scsi-options-list="HITACHI DF600F", "symmetric-option";
symmetric-option = 0x1000000;

Monday, 14 April 2008

Acronis True Image for Linux

Os SUSE LINUX Enterprise Server 9 (i586)
Acronis agent for linux

upload acronis.i686 to server
chmod u+x acronis.i686
./acronis.i686 -a -i TrueImageAgent

I got this error at console but there weren't file trueimage-setup.log. I used -d switch to get details.
Acronis True Image Echo Enterprise Server Setup failed to build kernel modules. Consult /var/log/trueimage-setup.log and /var/lib/dkms/snapapi26/0.7.29/build/make.log for error messages.

./acronis.i686 -d -a -i TrueImageAgent


In the log file I saw these entries.
Error! Your kernel source for kernel 2.6.5-7.244-smp cannot be found at
/lib/modules/2.6.5-7.244-smp/build or /lib/modules/2.6.5-7.244-smp/source.
DO YOU HAVE gcc INSTALLED???

Installation program build kernel modules for application. I installed this packages for this purpose.
kernel-source-2.6.5-7.244.i586.rpm
glib-devel-1.2.10-586.2.i586.rpm
gcc-3.3.3-43.41.i586.rpm
gcc-3.3.3-43.41.i586.rpm
glibc-devel-2.3.3-98.28.i686.rpm

Friday, 11 April 2008

Fedora 6 MythTv

Installed packages:
FreeType development package
lame package
lame-devel
avahi-qt3-devel
libXv-devel
libXxf86vm-devel
liblXmu-devel
mysql
mysql-server
qt-MYSQL

downloaded and extracted mythtv-0.21
cd mythtv-0.21
configure
make
make install

echo /usr/local/lib >> /etc/ld.so.conf
/sbin/ldconfig

chkconfig mysqld on
service mysqld start
mysql -u root < mc.sql

run mythtv-setup command and configure MythTv

Tuesday, 8 April 2008

grub: not found or no block device

grub-install command failed
grub: not found or no block device

So I used the grub shell
# grub
grub> root (hd0,0)
grub> setup (hd0)

Monday, 7 April 2008

Install Linux from disk

I do not have DVD drive so I installed Linux from iso file.

Copy files
mount -o loop openSUSE-10.2-GM-DVD-i386.iso opensuse
cd opensuse
cp linux /boot/inst-linux
cp initrd /boot/inst-initrd

Edit /boot/grub/grub.conf
title Install SUSE
root (hd0,0)
kernel /boot/inst-linux
initrd /boot/inst-initrd

Drives and partitions start from 0. If your have boot filesystem as a partition change the lines "kernel inst-linux" and "initrd inst-initrd"

During installation first you choose disk then you have to type the directory and complete filename of the ISO file.

Ip configuration files for Solaris

Create related configuration file. e1000g? are network interfaces you can find for your host via ifconfig -a
ls /etc/hostname.*
/etc/hostname.e1000g0
/etc/hostname.e1000g1
/etc/hostname.e1000g2


Entries in these files
cat hostname.e1000g0
hstnameloc

cat hostname.e1000g1
hstnamesec

cat hostname.e1000g2
hstnamereal


You have to put ip adress to hostname
cat /etc/hosts
10.210.50.69 hstnamereal loghost
192.168.20.6 hstnamesec
192.168.25.6 hstnameloc

Also to netmaks
cat /etc/netmasks
192.168.20.0 255.255.255.0
192.168.25.0 255.255.255.0
10.210.50.0 255.255.255.0

You can configure nodename which you see at the command prompt
cat /etc/nodename
hstnamereal



Virtual interface
cat /etc/hostname.e1000g0:1
hstnamevirtual

add /etc/hosts
10.210.50.70 hstnamevirtual

Disk monitoring via mrtg

OS Fedora 6 (I do not have dvd drive so I am still using this version)
Go through http://kbase.redhat.com/faq/FAQ_40_11143.shtm this document which his written for Red Hat.


yum install sysstat
yum instal mrtg


edit /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/mrtg/disk"


Start services
# service httpd start
# chkconfig httpd on
# mkdir -p /var/www/html/mrtg/disk/

edit vi /var/www/html/mrtg/disk/mrtg_disk.sh
#!/bin/bash
hd=hda
disk=/dev/$hd
UPtime=`/usr/bin/uptime |awk '{print $3""$4""$5}'`
KBread_sec=`iostat -x $disk|grep $hd |awk '{print $8}'`
KBwrite_sec=`iostat -x $disk|grep $hd |awk '{print $9}'`
echo $KBread_sec
echo $KBwrite_sec
echo $UPtime
hostname


# chmod u+x /var/www/html/mrtg/disk/mrtg_disk.sh


edit /var/www/html/mrtg/disk/mrtg_cfg_disk
WorkDir: /var/www/html/mrtg/disk
Target[disk]: `/var/www/html/mrtg/disk/mrtg_disk.sh`
Title[disk]: Disk HDA I/O Utilization Report
#Unscaled[disk]: dwym
MaxBytes[disk]: 10240000
PageTop[disk]:

Disk I/O Utilization Report


kmg[disk]: KB,MB,GB
LegendI[disk]: Disk I/O KBread/sec
LegendO[disk]: Disk I/O KBwrite/sec
Legend1[disk]: Disk I/O KBread/sec
Legend2[disk]: Disk I/O KBwrite/sec
YLegend[disk]: Megabytes
ShortLegend[disk]: &
Options[disk]: growright,gauge,nopercent



edit crontab
*/3 * * * * /usr/bin/mrtg /var/www/html/mrtg/disk/mrtg_cfg_disk

Thursday, 3 April 2008

Sun System Handbook

http://sunsolve.sun.com/handbook_private
You can find support matrix, info docs etc.
You need user to access this site

Hp, Windows Server 2003 support matrix

HP Windows Server Operating System Support Matrix
http://h71028.www7.hp.com/enterprise/cache/461942-0-0-0-121.html

Microsoft Windows Server 2003 matrix
http://www.microsoft.com/technet/windowsserver/evaluate/features/compare.mspx

Switches to enable more memory for Windows
boot.ini
/3GB /PAE
http://www.microsoft.com/whdc/system/platform/server/pae/default.mspx
http://www.microsoft.com/whdc/system/platform/server/PAE/pae_os.mspx
http://www.microsoft.com/whdc/system/platform/server/PAE/PAEmem.mspx

Thursday, 27 March 2008

Argument list too long

If there are many files and your ls, rm or mv commands not working you can use one of these

find /path/to -name 'yourfiles*' | xargs rm
find /path/to -name 'yourfiles*' | xargs -i mv {} anildel/
find /path/to -name 'yourfiles*' -exec rm '{}' \;
find /path/to -name 'yourfiles*' -exec rm '{}' +

Wednesday, 12 March 2008

Sendmail Troubleshooting

First of all I recommend enabling logging. Edit /etc/syslog.conf and be careful about using tab between entries.
mail.debug /var/log/mail.log

Restart syslog daemon
/etc/init.d/syslog restart

Check /var/log/mail.log.
You can find brief information about sendmail Email flow
http://sial.org/howto/sendmail/

Also some troubleshooting docs from HP
http://docs.hp.com/en/B2355-90685/ch04s11.html
http://docs.hp.com/en/5991-6611/ch02s10.html

Shell script Get the time difference

Get difference

date1=`date +%s`
commands
..
..
.
date2=`date +%s`
date -d "00:00:00 $(( ${date2} - ${date1} )) seconds" +"%H:%m:%S"

Wednesday, 5 March 2008

Sed and awk, find pattern and get next lines

Search pattern and print next two lines. You can add more getline and print here for awk and n;p for sed. Also you can do it via +2p

awk '/pattern/{getline;print;getline;getline;print}' file
sed -n '/pattern/{n;p;n;p;}' file
sed -n '/pattern/,+2p' file

Get between two pattern

awk '/pattern1/,/pattern2/' file
sed -n '/pattern1/,/pattern2/p' file

This is small script do same another way.

pattern=yourpattern
bgn=$(grep -n $pattern scsconfig.log awk -F: {'print $1'})
ed=`expr $bgn + 3`
cat scsconfig.log sed -n ''$bgn','$ed'p'

Friday, 29 February 2008

Tools for Troubleshooting Windows Server

http://www.microsoft.com/downloads/details.aspx?FamilyID=115905a2-2507-41db-9195-2e73c8a196a2&DisplayLang=en
Here is the list of tools which explained in the document.

Dependency Walker
Application and Service Tools
-Eventtriggers
-Event Viewer
-Gpresult
-Openfiles
-Performance Logs and Alerts
-Program Compatibility Wizard
-The Resultant Set of Policy
-Runas
-Sc
-Taskkill
-Tasklist
-Task Manager

Operating System and Driver Tools
-Boot Logging
-Device Manager
-Driver Verifier Manager
-Error Reporting Service
-File Signature Verification
-Kernel Debuggers
-Memory Pool Monitor


Online Crash Analysis
Recovery Console
Shutdown Event Tracker
System Configuration Utility (Msconfig.exe)
Systeminfo (systeminfo.exe)
System Information (msinfo32)
Wmic
Windows Update

Disk Tools
-Chkdsk
-Disk Cleanup

Networking Tools
-Arp
-Ipconfig
-Net
-Netdiag
-Netstat
-Network Monitor
-Nslookup
-Pathping
-Portqry
-Telnet Client

Remote Management Tools
-Computer Management
-Emergency Management Services
-Remote Desktop
-Telnet Server

Thursday, 21 February 2008

Ext3 journaling

Get your journalling mode
cat /proc/mounts | egrep "ext3"

Journal
(slow, but least risky) Both metadata and file contents are written to the journal before being committed to the main file system. This improves reliability at a performance penalty because all data has to be written twice. Without this setting in /etc/fstab, a file being edited in-place during a power outage or kernel panic risks being corrupted, depending on how the application is writing to the file.

Ordered
(medium speed, medium risk) Ordered is as with writeback, but forces file contents to be written before its associated metadata is marked as committed in the journal. This is the default on many Linux distributions.

Writeback
(fastest, most risky; equivalent to ext2 in some sense) Here metadata is journaled but file contents are not. This is faster, but introduces the hazard of out-of-order writes where, for example, files being appended to during a crash may gain a tail of garbage on the next mount.

Set or clear the indicated default mount options in the filesystem
tune2fs -O has_journal -o journal_data /dev/hdXY
tune2fs -O has_journal -o journal_data_ordered /dev/hdXY
tune2fs -O has_journal -o journal_data_writeback/dev/hdXY

Also you can define when you are mounting
mount -o data=journal /dev/hdXY /mountpoint
mount -o data=ordered /dev/hdXY /mountpoint
mount -o data=writeback /dev/hdXY /mountpoint

Or in fstab file
LABEL=test /mountpoint ext3 data=writeback 0 0

Friday, 8 February 2008

Export Local Group Policy settings to other Pc

If you want to move local policy settings to other Windows OS, move files under %systemroot%\system32\grouppolicy\ to other system.
Also if you delete files under this directory, you system will not have group policy. Do not forget to log off log on.
If you are managing workgroup. You can use this method for distributing policy.

Thursday, 24 January 2008

Data Execution Prevention problems

After converting physical machine to VMware virtual machine, I had problems opening display properties. Data execution prevention prevented some features.
Changing settings under system properties --> advanced--> data execution prevention and allowing application did not help.
So I edited boot.ini and disabled DEP via adding /noexecute=AlwaysOff .
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=AlwaysOff

A detailed description of the Data Execution Prevention (DEP) feature in Windows XP Service Pack 2, Windows XP Tablet PC Edition 2005, and Windows Server 2003
http://support.microsoft.com/kb/875352

Tuesday, 22 January 2008

Fedora 6 make music via Rosegarden and CT 670

Rosegarden is free software digital audio workstation. It has MIDI and audio playback.
So I connected my Casio CT 670 keyboard, and played midi files via Rosegarden.
Keyboard has 4 channel so I also use software synth (qynth) for having more channels. But If you want to have good sound via software synth you have to have good sound card (asio drive prefered).

Install Rosegarden
yum install qjackctl fluidsyth fluid-soundfont qsynth rosegarden4

run
qjackctl -> this is for connecting qynth your midi device and rosegarden
qsynth --> software synth, you can find soundfonts from internet
rosegarden

Tuesday, 15 January 2008

Boot problem Solaris i386

I got below from http://blogs.sun.com/tdh/entry/grub_error_17_cannot_mount and I used this for fixing problem.

"error 17, cannot mount selected partition"

1. Boot into Solaris Safeboot mode. You can get access at the Grub menu, usually the 2nd option. Note: I had to use the DVD install media to do this.
2. Mount the found Solaris partition on /a Safeboot will usually find the slice on the disk with Solaris and ask if you want it to mount on /a. Select Yes.
3. Move /a/dev, /a/devices, and /a/etc/path_to_inst to another name (I just append .orig) and then create new directories, (mkdir) /a/dev and /a/devices, and touch /a/etc/path_to_inst. I did not do this step.
4. Run "devfsadm -r /a" to rebuild the device tree.
5. Edit /a/boot/solaris/bootenv.rc and modify the line with "setprop bootpath '/pci@0,0....' to match the path you'll find mounted for /a (i.e. run a 'df -k' command, and you should see /a mounted from /dev/dsk/c1d0s0 or something, then run 'ls -l /dev/dsk/c1d0s0' or whatever your device listed was, and you should see the actual link point to ../../devices/pci@0,0/...) The path to bootpath you want should be the hard disk which is mounted as /a and you just need to find the expanded /devices/pci@0,0/... path and put that in the bootenv.rc file on the Solaris root filesystem on the hard disk (sans the /devices/ prefix of course). This is a key step.
6. Now run "bootadm update-archive -v -R /a" to rebuild the boot-archive on /a.
7. Make sure to edit /etc/vfstab
8. run a 'touch /a/reconfigure'
9. Run "cd /; sync; sync; sync; umount /a" And I skipped this one.
10. and finally reboot.

Saturday, 12 January 2008

dd for windows

Find exe and usage info
http://www.chrysocome.net/dd
I use it for copying image file to usb disk.

Configuration and Troubleshooting of 3510

Look documentation in http://sunsolve.sun.com

Verifying STMS (mpxio) Health
Troubleshooting Fibre Channel Devices from the OS
How to verify HBA Connectivity
Troubleshooting Sun StorEdge[TM] 33x0/351x Configurations
Troubleshooting Sun StorEdge[TM] 33x0/351x Hardware
Troubleshooting Sun StorEdge[TM] 351x Cabling

"Can't Connect to Sun StorEdge[TM] array via Ethernet."

sccli Library database update error

Disable mpxio

/kernel/drv/fp.conf
change line to yes.
mpxio-disable="yes";
reboot server

Configuration steps Sun Storage 3510

Os Solaris 10 i386
Server Sun Fire X4100 M2
Storage SUN StorEdge 3510


sccli> show disks
h Id Size Speed LD Status IDs Rev
----------------------------------------------------------------------------
2(3) 6 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 14T0VB9R
WWNN 2000001862817790
2(3) 7 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 14T0VE2D
WWNN 2000001862817673
2(3) 8 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 10T0PZNQ
WWNN 2000001862811CF3
2(3) 9 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 14T0PQYD
WWNN 2000001862817416
2(3) 10 279.40GB 200MB NONE FRMT SEAGATE ST330055FSUN300G 0691
S/N 10T0NHYW
WWNN 2000001862811D30
2(3) 11 279.40GB 200MB GLOBAL STAND-BY SEAGATE ST330055FSUN300G 0691
S/N 14T0QYAG
WWNN 2000001862817F59

I used disk 6 to 10 create logical drive RAID5 configuration.


sccli> create logical-drive RAID5 2.6-10
sccli: created logical drive 72BE98D8

now status

sccli> show disks
Ch Id Size Speed LD Status IDs Rev
----------------------------------------------------------------------------
2(3) 6 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 14T0VB9R
WWNN 2000001862817790
2(3) 7 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 14T0VE2D
WWNN 2000001862817673
2(3) 8 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 10T0PZNQ
WWNN 2000001862811CF3
2(3) 9 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 14T0PQYD
WWNN 2000001862817416
2(3) 10 279.40GB 200MB ld0 ONLINE SEAGATE ST330055FSUN300G 0691
S/N 10T0NHYW
WWNN 2000001862811D30
2(3) 11 279.40GB 200MB GLOBAL STAND-BY SEAGATE ST330055FSUN300G 0691
S/N 14T0QYAG
WWNN 2000001862817F59

Check logical drive now

sccli> show ld
LD LD-ID Size Assigned Type Disks Spare Failed Status
------------------------------------------------------------------------
ld0 72BE98D8 1.09TB Primary RAID5 5 1 0 Good I
Write-Policy Default StripeSize 128KB


Create logical volume

sccli> create lv ld0 primary
sccli: created logical volume 391D4ADF
sccli> show lv
LV LV-ID Size Assigned Write-Policy LDs
-----------------------------------------------------------------
lv0 391D4ADF 1.09TB Primary Default 1 ld0

Create map

sccli> show channels
Ch Type Media Speed Width PID / SID
--------------------------------------------
0 Host FC(L) 2G Serial 40 / N/A
1 Host FC(L) N/A Serial N/A / 42
2 DRV+RCC FC(L) 2G Serial 14 / 15
3 DRV+RCC FC(L) 2G Serial 14 / 15
4 Host FC(L) 2G Serial 44 / N/A
5 Host FC(L) N/A Serial N/A / 46
6 Host LAN N/A Serial N/A / N/A

3510 use channel 0 and pid 40 and channel 4 pid 44 here.


sccli> map lv0 0.40.0
sccli: mapping lv0-00 to 0.40.0
sccli> show map
Ch Tgt LUN ld/lv ID-Partition Assigned Filter Map
---------------------------------------------------------------------
0 40 0 lv0 391D4ADF-00 Primary

I recommend disabling mpxio if you are facing problems.


sccli> map lv0 4.44.0
sccli: mapping lv0-00 to 4.44.0

sccli> show map
Ch Tgt LUN ld/lv ID-Partition Assigned Filter Map
---------------------------------------------------------------------
0 40 0 lv0 391D4ADF-00 Primary
4 44 0 lv0 391D4ADF-00 Primary

Be sure devices are connected now. If you have problem in this step and for the rest of them, I highly recommend check configuration of 3510 .

#luxadm -e port
/devices/pci@0,0/pci10de,5d@e/pci1077,143@0/fp@0,0:devctl CONNECTED
/devices/pci@0,0/pci10de,5d@e/pci1077,143@0,1/fp@0,0:devctl NOT CONNECTED
/devices/pci@0,0/pci10de,5d@d/pci1077,143@0/fp@0,0:devctl CONNECTED
/devices/pci@0,0/pci10de,5d@d/pci1077,143@0,1/fp@0,0:devctl NOT CONNECTED


And see that disk devices are ok.

#luxadm -e dump_map /devices/pci@0,0/pci10de,5d@e/pci1077,143@0/fp@0,0:devctl
Pos Port_ID Hard_Addr Port WWN Node WWN Type
0 a7 0 216000c0ff8b5125 206000c0ff0b5125 0x0 (Disk device)
1 1 0 2100001b3202e7c4 2000001b3202e7c4 0x1f (Unknown Type,Host Bus Adapter)

and

#luxadm -e dump_map /devices/pci@0,0/pci10de,5d@d/pci1077,143@0/fp@0,0:devctl
Pos Port_ID Hard_Addr Port WWN Node WWN Type
0 a5 0 226000c0ffab5125 206000c0ff0b5125 0x0 (Disk device)
1 1 0 2100001b3202dc8f 2000001b3202dc8f 0x1f (Unknown Type,Host Bus Adapter)


Now check that they are connected and configured, if not configure them

#cfgadm -al
Ap_Id Type Receptacle Occupant Condition
c3 scsi-bus connected configured unknown
c3::dsk/c3t2d0 disk connected configured unknown
c4 fc-private connected configured unknown
c4::226000c0ffab5125 disk connected configured unusable
c5 fc-private connected configured unknown
c5::216000c0ff8b5125 disk connected configured unusable
c6 fc connected unconfigured unknown
c7 fc connected unconfigured unknown

and run devfsadm command to build device tree. and see them with format command.