Wednesday, 29 August 2007

Monitor your adsl bandwith usage

I use fedora 6, mrtg and snmp tools to monitor adsl router bandwith for all interfaces (wlan,atm,lan)

install packages:
You can install yum install packagename. Or download package and rpm -ivh package name.

configure mrtg:
for snmp v1:
cfgmaker --output=/etc/mrtg/mrtg.cfg --global \
"workdir: /var/www/mrtg" -ifref=ip \
--global 'options[_]: growright,bits' public@
for snmp v2:

cfgmaker --output=/etc/mrtg/ \
-ifref=ip --global "workdir: /var/www/mrtg" \
--snmp-options=:::::2 public@

for public@ use your snmp community and your adsl router ip address.
check your /etc/mrtg/mrtg.cfg and comment out interfaces you want to monitor.

run this command three times to collect data. You will get error for the first two times.
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

make your html page:
indexmaker --output=/var/www/mrtg/index.html \

put configuration to crontab:
0-59/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

httpd configuration:
edit configuration /etc/httpd/conf.d/mrtg.conf and comment deny restrictions if you want to access your http service remotely.
then start service
service httpd start

enable this service
chkconfig httpd on

access your mrtg page http://yourmachineipadressorhostname/mrtg/

Monday, 27 August 2007

ssh auto login

You want to auto login Host B from Host A
Host A Look in your ~/.ssh directory. There should be two files, id_rsa and If not, create them using ssh-keygen -t rsa.
Host B Append local to the Host B ~/.ssh/authorized_keys.
The file mode of ~/.ssh/authorized_keys must be 644. You can assure this with chmod 644 ~/.ssh/authorized_keys
You might have to change your /etc/sshd_config and add the following lines:
RSAAuthentication yes
PubkeyAuthentication yes

Hp Openview active passive state

I coded this script because hp openview does not have script to track status of active and passive system together and reflect status of service(I mean two server is working for one aim) in service graph screen.
Put this script both active and passive system. It is going to help tracking status of servers and if active system goes down the script running on passive system change status to critical in service graph screen. If passive system goes down the script on the active system is going to change status to ok in service graph screen why because active system is working, so you are serving you service.
You have to create this file C:\Documents and Settings\Administrator\Desktop\ACTIVE on the active server.

Dim machine
Set fs=CreateObject("Scripting.FileSystemObject")
machine = "server1" 'write other server

'If you can ping server
If reachable(machine) Then
'wscript.echo machine & " reachable"
'Check if you send alarm before, clear alarm because you can ping
If fs.FileExists ("c:\alarm.lck")then
'WScript.Echo ("alarm send, clear the alarm")
strstate= "normal"
hpov (strstate)
Set objFSO = CreateObject("Scripting.FileSystemObject")
'WScript.Echo ("Nothing to do")
End If
'You cant ping server
'wscript.echo machine & " not reachable"
'Check if this server is active
If fs.FileExists("C:\Documents and Settings\Administrator\Desktop\ACTIVE") Then
'WScript.Echo ("This is active system")
If fs.FileExists ("c:\alarm.lck")then
'WScript.Echo ("You send alarm before, clearing the alarm,if you can reach the HP Openview")
strstate= "normal"
hpov (strstate)
Set objFSO = CreateObject("Scripting.FileSystemObject")
End If
'WScript.Echo ("This is passive system")
'This server is passive
'Check if you send alarm to hpov
If fs.FileExists ("c:\alarm.lck")then
'WScript.Echo ("something")
'You didnt send alarm Hpov before so send alarm now because you cant ping active server
'WScript.Echo ("Send alarm")
strstate = "critical"
hpov (strstate)
Set objFSO = CreateObject("Scripting.FileSystemObject")
End If
End If
End If

Function hpov(state)
'WScript.Echo state
Set objShell = CreateObject("WScript.Shell")
strMessage="""Node down : server1"""
'Ask you hp openview administrator about command and arguments.
strCommand = "C:\usr\OV\bin\Opc\opcmsg severity=" & state & " a=IMA o=Node_Down msg_text=" &strMessage& " msg_grp=TCELL node=server2 service_id=ima_server2_scr"
'WScript.Echo strcommand
intRC = objShell.Run (strCommand,1 ,TRUE)
End Function

function reachable(HostName)
dim wshShell, fso, tfolder, tname, TempFile, results, retString, ts
Const ForReading = 1, TemporaryFolder = 2
reachable = False
set wshShell=wscript.createobject("")
set fso = CreateObject("Scripting.FileSystemObject")
Set tfolder = fso.GetSpecialFolder(TemporaryFolder)
tname = fso.GetTempName
TempFile = tfolder & tname
'-w 100000 is 5 mins worth of timeout to cope with establishing a dialup "cmd /c ping -n 3 -w 1000 " & HostName & ">" & TempFile,0,true
set results = fso.GetFile(TempFile)
set ts = results.OpenAsTextStream(ForReading)
do while ts.AtEndOfStream <> True
retString = ts.ReadLine
if instr(retString, "Reply")>0 then
reachable = true
exit do
end If
end Function

Hp Openview Microsoft Windows file check template

Hp Openview does not have all the scripts for Windows, so I coded this vbscript to help us checking if the file exist and changes related monitoring status. This script has to be run from hp openview services. You have to call script with file name and monitoring name from HP Openview.

strArgument1 = Wscript.Arguments(0) 'file name
strArgument2 = Wscript.Arguments(1) 'monitor name
Set objFs=CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
StrOpcmon = "c:\usr\OV\bin\OpC\opcmon"

If objFs.FileExists (strArgument1)then
strCommand = StrOpcmon & " " & strArgument2 & "=1"
intRC = objShell.Run (strCommand,1 ,TRUE)
strCommand = StrOpcmon & " " & strArgument2 & "=0"
intRC = objShell.Run (strCommand,1 ,TRUE)
End If

Thursday, 23 August 2007

Sync directories Fedora , Red Hat Linux encrypted

I use this script to sync my scripts to other servers. -e ssh option make communication encrypted.

rsync.conf includes folders like this source, dest directories.

rsynchosts.conf put hostnames (a host for every line)


cat $HOSTFILE | grep -v "#" | while read HOSTFILE
REMOTEHOST=`echo $HOSTFILE |awk -F";" '{ print $1 }'`

cat $CONFFILE | grep -v "#" | while read CONF
LOCALDIR=`echo $CONF |awk -F";" '{ print $1 }'`
REMOTEDIR=`echo $CONF |awk -F";" '{ print $2 }'`


Forwarding root mails to your inbox

Forward all root mails to your email address

edit /etc/resolv.conf
put you dns servers which knows your email server.
domain domainname
nameserver x.x.x.x
nameserver x.x.x.x
be sure you can resolve domain.

and create .forward and add your email address into this file.
As you see you do not need to configure sendmail...
Check status from maillog tail -f /var/log/maillog

Password recovery Red Hat, Fedora Linux

Follow the procedure at "bootloader is corrupted Fedora Linux-recue it"
do not do grub-install
after chroot edit /etc/shadow
You password is empty now.
Probably passwd command also will help you to change your password.

Go to a runlevel at boot time with grub

You want to go certain run level in Fedora or Red Hat Linux with GRUB.

on boot at GRUB splash screen
press any key
select boot option that you want boot from
press a to append
press space and write here which run level you want to go (1,2,3,emergency,s)
kernel /vmlinuz-2.6.9-5.ELsmp ro root=LABEL=/ hda=ide-scsi rhgb quiet 1
press enter and booting...

BTW brief information
1 : this is going to process rc.sysinit and rc1.d scripts
s, S, or single : this is going to process only rc.sysinit
emergency : this is going to run sulogin only

System crontab files in Fedora, Red Hat Linux

Fedora and Red Hat cron files somewhat different than other Unix.
If you want to look for all cron job do not forget to look


And crontab -e as you know...

Most used rpm commands

Automatic installation, you are tired of installing packages one by one and finding requirements use this:
rpm –ivh --aid xsane*

Ok this is most useful (after install option :)) command that checks if package files changed
rpm -V packagename

If you want to be sure that you are installing signed packages
gpg --import gpg_key (find gpg_key from Red Hat)
rpm --import gpg_key
rpm --checksig package_file_name (This command checks signature)

rpm -qa (gives all packages installed)
rpm -q packagename -i (gives package information)
rpm -q packagename -l (list files in the package)
rpm -q packagename --requires (show which package required to install this package)
rpm -q packagename -scripts (gives you installation script)
rpm -q packagename -changelog (gives you changelog information about package)

rpm2cpio (Use this for extracting rpm packages)

Controlling services under Red Hat , Fedora Linux

Graphical tools
system-config-services (or redhat-config-services ) requires X interface

Command line tools
service (service smb stop)

List all services and change status
chkconfig --list (gives all services and status)
chkconfig smb off/on (stop starting services after restart)

Set ip adress in Fedora Red Hat

If you are not familiar with commands and configuration files use this command
This tool works in terminal, telnet or ssh.

Ok you want to create virtual ip adress or virtual ethernet interface
netconfig -d eth0:0

Pretty simple

Hardware information Fedora Red Hat

use these commands to get hardware information
For detailed information use verbose option (lspci -v )

Also you can get information from /proc
cat /proc/bus/pci/*
cat /proc/isapnp
cat /proc/scsi/*

USB and IEEE 1394 Buses
/sbin/hotplug, (/etc/hotplug)

Information in /proc/bus subdirectories
/sbin/lsusb and /sbin/usbmodules utilities

/sbin/cardmgr, (/etc/pcmcia/)

Information in /proc/bus/pccard
/sbin/cardctl utility

Wednesday, 22 August 2007

John the Ripper identify weak passwords

You can check your users if they are using weak passwords,

get you /etc/shadow file

make word list if you predict common word or find here

following command gives you user names and you can use this file as a dictionary(this is going to help who used username and password same).
cat /etc/passwd | awk -F : '{print $1}' > word.lst

merge dictionary files.

use John the Ripper,
john --wordlist=word.lst shadow

Script for dumping information from Mssql tables

(select from top to end of script , copy and paste to your editor)

Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=SQLOLEDB;server=servername;database=msdb;uid=sa;password=password"

Set objRecordSet = CreateObject("ADODB.Recordset")
objRecordSet.Open "SELECT * FROM sysjobs", objConnection, adOpenStatic, adLockOptimistic

'excel output
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True

'chane field name for which column you dump
Do Until objRecordSet.EOF

objExcel.Cells(x, 1).Value = objRecordSet.Fields("name").Value

'XML output
'objRecordSet.Save "output.xml" , adPersistXML
'Number of record
'Wscript.Echo objRecordSet.RecordCount
'Wscript.Echo objRecordSet.Fields("name").Value

'Close connection

Script to get board information of your computer

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard")

For Each objItem in colItems
For Each strOption in objItem.ConfigOptions
Wscript.Echo "Configuration Option: " & strOption
Wscript.Echo "Depth: " & objItem.Depth
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Height: " & objItem.Height
Wscript.Echo "Hosting Board: " & objItem.HostingBoard
Wscript.Echo "Hot Swappable: " & objItem.HotSwappable
Wscript.Echo "Manufacturer: " & objItem.Manufacturer
Wscript.Echo "Model: " & objItem.Model
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Other Identifying Information: " & _
Wscript.Echo "Part Number: " & objItem.PartNumber
Wscript.Echo "Powered-On: " & objItem.PoweredOn
Wscript.Echo "Product: " & objItem.Product
Wscript.Echo "Removable: " & objItem.Removable
Wscript.Echo "Replaceable: " & objItem.Replaceable
Wscript.Echo "Requirements Description: " & objItem.RequirementsDescription
Wscript.Echo "Requires Daughterboard: " & objItem.RequiresDaughterBoard
Wscript.Echo "Serial Number: " & objItem.SerialNumber
Wscript.Echo "SKU: " & objItem.SKU
Wscript.Echo "Slot Layout: " & objItem.SlotLayout
Wscript.Echo "Special Requirements: " & objItem.SpecialRequirements
Wscript.Echo "Tag: " & objItem.Tag
Wscript.Echo "Version: " & objItem.Version
Wscript.Echo "Weight: " & objItem.Weight
Wscript.Echo "Width: " & objItem.Width

Vbscript get model of your server

SystemName = "localhost"

set tmpObj = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & SystemName & "\root\cimv2").InstancesOf ("Win32_ComputerSystem")
for each tmpItem in tmpObj
MakeModel = trim(tmpItem.Manufacturer) & " " & trim(tmpItem.Model)
Set tmpObj = Nothing: Set tmpItem = Nothing

msgbox MakeModel

Vbscript listing memory config

Sometimes our bosses ask about configuration of memories or you need to detailed information about memory configuration, may be you will add extra memory and you want to learn bank status without restarting server.

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory")

For Each objItem in colItems
Wscript.Echo "Bank Label: " & objItem.BankLabel
Wscript.Echo "Capacity: " & objItem.Capacity / 1048576
Wscript.Echo "Data Width: " & objItem.DataWidth
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Device Locator: " & objItem.DeviceLocator
Wscript.Echo "Form Factor: " & objItem.FormFactor
Wscript.Echo "Hot Swappable: " & objItem.HotSwappable
Wscript.Echo "Manufacturer: " & objItem.Manufacturer
Wscript.Echo "Memory Type: " & objItem.MemoryType
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Part Number: " & objItem.PartNumber
Wscript.Echo "Position In Row: " & objItem.PositionInRow
Wscript.Echo "Speed: " & objItem.Speed
Wscript.Echo "Tag: " & objItem.Tag
Wscript.Echo "Type Detail: " & objItem.TypeDetail
Wscript.Echo "-------------------------"

Linux ethtool

Ethtool and mii-tool are tools to set network interface options. I had problems setting speed 1000 with mii-tool so I prefer ethtool.

ethtool -s eth0 speed 100 duplex full autoneg off

If you want to set this every reboot put above command /etc/rc.local or
add following option to this file /etc/sysconfig/network-scripts/ifcfg-eth0
ETHTOOL_OPTS="speed 100 duplex full autoneg off"

Linux LVM basics

Prepare disk
dd if=/dev/zero of=/dev/sdb bs=1k count=1
pvcreate /dev/sdb

Setup a volume group
vgcreate my_volume_group /dev/sdb

Change status of volume group
vgchange -a y my_volume_group
vgchange -a n my_volume_group (deactivate)

Extend or reduce volume group
vgextend my_volume_group /dev/hdc1
vgreduce my_volume_group /dev/hda1 (removing)

Create logical volume group
lvcreate -L1500 -ntestlv my_volume_group
lvcreate -- logical volume "/dev/my_volume_group/testlv" successfully created

Create the file system
mke2fs /dev/my_volume_group/testlv

Mount the file system
mount /dev/my_volume_group/testlv /disk2

Resizing of a logical volume
e2fsadm /dev/my_volume_group/testlv -L+100

Detailed information:

Putty for symbian

Here you can find putty for symbian os based phones.

Vbscript list users in domain or find disabled users

You can list users computers etc with this script in domain. If you want to list only disabled users read following script.

Set A=GetObject("LDAP://DC=domain,DC=co,DC=uk")
EnumerateUsers A
Sub EnumerateUsers(oCont)
Dim x
For Each x In oCont
Select Case LCase(x.Class)
Case "user"
Wscript.Echo "User: "& x.Get ("name") & ";" & x.displayName & ";" & x.givenname &";"& & ";" & x.userAccountControl & ";" & x.userprincipalName & ";" & x.createTimeStamp & ";" & x.sAMAccountName & ";" & x.distinguishedName
'If you want to get disable users comment out three following lines and comment previos line
'If x.userAccountControl=66050 Then
' wscript.echo "User:" & x.Get ("name")
'End If
Case "computer"
'Wscript.Echo "Computer: "& x.Get ("name") & ";" & x.operatingSystem & ";" & x.operatingSystemVersion & ";" & x.operatingSystemServicePack & ";" & x.distinguishedName
Case "volume"
'Wscript.Echo "Volume: "& x.Get ("name") & ";" & x.uNCName & ";" & x.distinguishedName
Case "group"
'Wscript.Echo "Group: "& x.Get ("name") & ";" & x.distinguishedName
Case "site"
'WScript.Echo x.distinguishedName
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfigurationNC = objRootDSE.Get("configurationNamingContext")
strSitesContainer = "LDAP://CN=Servers,CN=" & & ",cn=Sites," & strConfigurationNC
Set objSitesContainer = GetObject(strSitesContainer)
objSitesContainer.Filter = Array("server")
For Each objSite In objSitesContainer
'WScript.Echo objSite.Name
'Wscript.Echo "Site: "& & ";" & objSite.Name & ";" & x.description & ";" & x.distinguishedName
Case "organizationalunit" , "container"
EnumerateUsers x
'Wscript.Echo "OU |Container: "& x.Get ("name") & ";" & x.ou & ";" & x.distinguishedName
Case Else
'Wscript.Echo x.Class&": " & x.distinguishedName
End Select
End Sub

Process explorer

If task manager in windows is not enough for you use this tool.
You can use this tool to suspend some process, if they are spy ware or etc. before cleaning.

Process Explorer shows you information about which handles and DLLs processes have opened or loaded.
The unique capabilities of Process Explorer make it useful for tracking down DLL-version problems or handle leaks, and provide insight into the way Windows and applications work.

kSar sar grapher

ksar is a java application that graph sar output. You can connect you servers via ssh and see graphical output of sar commands.

Find detailed information

Tuesday, 21 August 2007

Change terminal services or rdp listening port

Change the following registry key. Restart system.

l Server\WinStations\RDP-Tcp

ghost or copy a partition to another drive- create identical system

I used this procedure copy my Fedora Linux OS.
Boot server in rescue mode

Boot the server from CDROM with rescue mode. At the boot prompt:
linux rescue

Choose mount filesystem when it is asked.

Create folder under root
mkdir /destination

Mount your destination partition under
mount /dev/hdb1 /destination

Copy all of them, because all files are not used by any process you will not have any problem
cp -ar /mnt/sysimage /destination

or copy all disk
dd if=/dev/hda of=/dev/hdb

If you are copying your boot partition you have to install grub for booting system
move hdb to hda (You have to switch master slave jumpers for both of disks)
Boot with rescue mode, mount filesystem (if you have problem, you know partitin location mount /dev/sda1 /mnt/sysimage)
chroot /mnt/sysimage

Now you have copy of the system...

bootloader is corrupted Fedora Linux -- Rescue it

Boot the server from CDROM with rescue mode. At the boot prompt:
linux rescue

Choose mount filesystem when it is asked.

Your file syste will be mounted under /mnt/sysimage, chroot there
chroot /mnt/sysimage

Install group boot loader.
grub-install /dev/sda

Reboot your server.

Alias in shell help lazy administrators

If you are tired to enter same command, make it short for you

if u using bash write to .bash_profile , for ksh write to .profile
alias cdt='cd /usr/local/man/'

cdt will change your directory to target after next login.

Calculate DB size with sqlplus in Oracle

select sum(bytes)/1024/1024 "Meg" from dba_data_files;

Oracle deleting old backup from rman

RMAN>connect catalog username/password@RMANSID;
connected to recovery catalog database

delete expired backup;

Oracle Flash Recovery Area configuration

Changing directory
alter system set db_recovery_file_dest = '/data01';

Changing size
alter system set DB_RECOVERY_FILE_DEST_SIZE= 5G;

Moving oracle to archive mode

shutdown immediate
startup nomount

alter database mount;
alter database archivelog;
alter database open;

Verifying archive mode
archive log list;
select log_mode from v$database;

Rpm package installation history

If you need when the packages installed in Red Hat or Fedora

rpm -qa --queryformat '%{NAME} || %{INSTALLTIME:date}\n'

gnome-bluetooth || Mon 06 Aug 2007 05:05:55 PM EEST
gnome-screensaver || Mon 06 Aug 2007 05:06:24 PM EEST
evolution-webcal || Mon 06 Aug 2007 05:07:06 PM EEST
gnome-system-monitor || Mon 06 Aug 2007 05:07:51 PM EEST
smartmontools || Mon 06 Aug 2007 05:08:15 PM EEST
perl-Test-Harness || Mon 06 Aug 2007 05:08:18 PM EEST
system-config-network || Mon 06 Aug 2007 05:08:22 PM EEST

Legato networker restore a server to another server

If you want to restore HostA files to HostB

Put HostB to HostA access list in Legato Administration.
Run this command for starting restore:
On HostB, nwrecover -s backupserver -c hostA

Monday, 20 August 2007

mysql backup

Command which I am using for back up
mysqldump --single-transaction --all-databases -u username --password=password> backup_sunday_1_PM.sql

Quick nfs share on Solaris

sharing /cdrom
share -F -o ro nfs /cdrom

show if you it's shared.
showmount -e

mount hostA:/cdrom /cdrom

Cfengine installation Fedora 7 Linux

I have Fedora 7 with development package selected, so this selection provide all package that I need for compiling.

Download package (I used cfengine-2.2.1)

tar zxf cfengine-2.2.1.tar.gz
cd cfengine-2.2.1
make install

That's all.

Sunday, 19 August 2007

Installation of SecondLife in Fedora

Download Linux package from

Unzip the package
bunzip2 SecondLife_i686*.tar.bz2

Extract the tar
tar xvf SecondLife_i686*.tar

Run it
double click secondlife on graphical environment.

If you get windows creation error:
For nvidia, Download graphic card driver from Nvidia
There is two binary packages try them, one of them will suit your graphic card gpu

Double click to start installation.
After installation you can double click secondlife and enjoy the game.

Mount ntfs Fedora Linux

Install these packages with yum install packagename


find your ntfs partition
fdisk -l | grep NTFS

output like:
/dev/hdb1 * 1 3824 30716248+ 7 HPFS/NTFS

and mount it
mount /dev/hdb1 /mnt/disk4part1

Thursday, 16 August 2007

SAN driver on Red Hat

There are some trick for installing qla drivers in Red Hat servers:
One of them is using up to date gcc
The other is you need up to date cciss driver, because if you compile qla drivers with old cciss driver, servers try to boot from storage through hba.

BTW there is another important situation, your device number could change in the future, if you mount with device names it could cause problems after mounting.
So I strictly recommend to label your disks

e2label /dev/sda1 DATA01
fstab --> LABEL= DATA01 data01 ext3 defaults 1 2

OS : Red Hat Linux Advanced Server release 2.1AS (Pensacola)
kernel : 2.4.9-e.35smp
Hardware : HP DL380
HBA : qla2300
Storage : HITACHI DF600F or EMC SYMMETRIX 5771

Installed cciss driver cause trouble, so backup them
cd /lib/modules/2.4.9-e.35smp/kernel/drivers/addon/cciss/
cp cciss.o cciss.o.old
cd /lib/modules/2.4.9-e.35/kernel/drivers/addon/cciss
cp cciss.o cciss.o.old

Install new version
rpm -ivh cpq_cciss-2.4.54-14.rhel21.i686.rpm
reboot server, see if it is booting

Use up to date gcc
mv /usr/bin/gcc /usr/bin/gcc.296
ln -s /usr/bin/gcc3 /usr/bin/gcc

Install HBA driver
rpm -ivh hp_qla2x00src-7.05.00p8-19.linux.rpm

Install fibeutils you are going to use this
rpm -ivh fibreutils-2.0-4b.linux.i386.rpm
Reboot server

Check your adapter is working

Wednesday, 15 August 2007

Free YouTube to iPod Converter

Osiris painless installation for Fedora 7

Install Fedora 7, select development package at package selection screen so you wont need to install extra packages one by one.
If you don't need unselect office and productivity

Download Osiris source package from
I downloaded this version osiris-4.2.3.tar.gz

gunzip osiris-4.2.3.tar.gz
tar xvf osiris-4.2.3.tar
cd osiris-4.2.3
./configure --with-root-dir=/var/osiris --with-osiris-user=osiris --enable-fancy-cli=yes
make all
If you havent got any error...
cd src/install

Tuesday, 14 August 2007

Sum of your partition

This script gives you sum of all of your partition
(Select from top to bottom and copy,paste to any editor to get all)


# We need to allow for different versions of 'df' on differt Unix OS's
#echo $ostype
if [ $ostype = "Linux" -o $ostype = "SunOS" ]; then
dfbinary="/bin/df -kl"

elif [ $ostype = "IRIX64" ]; then ## Newer SGI's. Irix 6.5 at least
dfbinary="/bin/df -Pkl"
else ## use the GNU version of df

##disksum=`$dfbinary | grep dev | awk '{t += $2; u += $3} \
disksum=`$dfbinary | awk '/dev/ {t += $2; u += $3} \
END { printf("%d MB, %d MB used",t/1024,u/1024) }'`

HP Raid control in Linux

Think that you are using HP DL series (DL380) hardware and running linux, you want to check raid status then you need:
  • Install hpacucli from HP.
  • Run this script
SLOTLIST=$(hpacucli ctrl all show | \
grep Slot | sed -e 's/^.*Slot //g' -e 's/ .*$//g')

for i in $SLOTLIST
hpacucli ctrl slot=$i show status | grep -v "^$"
hpacucli ctrl slot=$i ld all show status | grep -v "^$"
hpacucli ctrl slot=$i pd all show status | grep -v "^$"

  • Output:

Smart Array 6i in Slot 0
Controller Status: OK
Cache Status: OK

logicaldrive 1 (203 GB, 5): Ok
physicaldrive 2:0 (port 2:id 0, 72.8 GB): OK
physicaldrive 2:1 (port 2:id 1, 72.8 GB): OK
physicaldrive 2:2 (port 2:id 2, 72.8 GB): OK
physicaldrive 2:3 (port 2:id 3, 72.8 GB): OK

Osiris [info] outgoing: error message.

I was getting this annoying error from Red Hat 7 servers.

[info] outgoing: error message.

So I moved to service into quite mode with editing /etc/init.d/osirisd
adding -q option.
line: daemon $osirisd -q -r $osirisd_root $OPTIONS

Monday, 13 August 2007

Mailing list ARChives

You can find mailing list archive at
It helped me when I could not reach osiris mailing group.

Oracle Schema changes

I use this script to track schema changes for a schema on Oracle server.
(Select from top to bottom and copy,paste to any editor to get all)

mv $WORKDIR/schema_$DWH.log $WORKDIR/schema_$DWH.log.1
sqlplus $user/$password < $WORKDIR/schema_$DWH.log.draft
set pages 10000
set hea off
set lines 500
set feedback off
column TABLE_NAME format a30
column COLUMN_NAME format a25
column DATA_TYPE format a8
column DATA_LENGTH format 9999
column DATA_PRECISION format 999
column DATA_SCALE format 999
column NULLABLE format a1
column COLUMN_ID format 999
cat $WORKDIR/schema_$DWH.log.draft |grep -v '^$'| egrep -v "|Copyright|Connected to|OLAP and Data Mining|SQL\>" > $WORKDIR/schema_$DWH.log
#diff $WORKDIR/schema_$DWH.log $WORKDIR/schema_$DWH.log.1
cmp $WORKDIR/schema_$DWH.log $WORKDIR/schema_$DWH.log.1 >> $OUTPUT

Fujitsu Siemens servers - Server View Agents -

We try to get events from hardware for Fujitsu Siemens servers running Windows OS.
Here is the way how can we collect events for pdu,disk etc.
You have to install GAM for disk messages.

Logging Server View Events to Windows Event Log
Open ServerViewAgents --> Agent Configuration-->Trap Forwarding
Select all for Report to system event log
Choose apply
Then restart serverview agents tool and Click restart.

GAM Installation
Find installation file from lsilogic web site.
Run installation file

There is trick when you want to change settings
If there isnt a user named gamroot in the domain, create user and give a password.
It will be used when you need to change settings. Or you can create user locally.


I implemented Osiris version 4.2.3 in the company. I compile it on Fedora 7 and running on Vmware ESX.

web site

You can find comparison of host integrity tools here

Osiris is a Host Integrity Monitoring System that periodically monitors one or more hosts for change. It maintains detailed logs of changes to the file system, user and group lists, resident kernel modules, and more. Osiris can be configured to email these logs to the administrator. Hosts are periodically scanned and, if desired, the records can be maintained for forensic purposes. Osiris keeps an administrator apprised of possible attacks and/or nasty little trojans. The purpose here is to isolate changes that indicate a break-in or a compromised system. Osiris makes use of OpenSSL for encryption and authentication in all components.

Filtering is a bit complicated.
.* is like * in unix.

Also you can configure filtering in configuration of hosts:

exclude file (^/opt/oracle/product/RDBMS10g/dbs/spfiledwh.ora$)
exclude file (^/opt/oracle/product/RDBMS10g/dbs/lkDWH$)
exclude file (^/opt/oracle/product/RDBMS10g/dbs/orapwdwh$)
exclude file ("product/RDBMS10g/dbs/snapcf_dwh.f")
exclude file ("product/RDBMS10g/dbs/snapcf_dwh.f")
exclude file (^/opt/oracle/product/RDBMS10g/dbs/hc_dwh.dat$)
Recursive 1
NoEntry product/RDBMS10g/rdbms/log
NoEntry product/RDBMS10g/admin/dwh/bdump
NoEntry product/RDBMS10g/rdbms/audit
NoEntry product/RDBMS10g/network/log
NoEntry product/RDBMS10g/oc4j/j2ee/OC4J_DBConsole_*_dwh/log
NoEntry product/RDBMS10g/css/log
NoEntry product/RDBMS10g/admin/dwh/udump
NoEntry product/RDBMS10g/css/init
NoEntry product/RDBMS10g/oc4j/j2ee

Enabling remote logging for Syslog

If you want to enable remote logging in Red Hat edit /etc/sysconfig/syslog file.
change the line like below

BTW editing this file /etc/init.d/syslog does not help.

Ipod torrent

Good sites for ipod content. Use them with your own risk.

Avi to mp4 with subtitle

Very strange that there is only one program could convert avi and subtitle files to Ipod compatible mp4 file.

xvid4psp runs on windows.


I use this product for a long time. It helped me to manage my Linux machine when I didn't know not much about Linux.
Also I used it with Solaris machines at the work at 2003. I distribute some sendmail rights to people.
Now I am using webmin for accessing my computer from work.

Ssh on port 80

I use this command to open another ssh daemon listening on port 80. It helps to pass away proxy servers.

/usr/sbin/sshd -p 80

Saturday, 11 August 2007

Check process

I use this simple python script to check bittorrent process and if it is not running it starts to vnc.

import os
def check_proc( *args ):
process = os.popen("ps -ef | grep bitt").read().splitlines()
if len(process) > 2:
print "process running"
print "process not running"
os.system('su - user -c "export DISPLAY=;bittorrent&"')"


Xen in Fedora 6 part 2

Here is my configuration for fedora7 virtual machine. With vnc options you can reach your virtual machine consoles from another computer with vnc.

name = "fedora7"
uuid = "99cf59acb58214579335b8e1f9a3239a"
maxmem = 256
memory = 256
vcpus = 1
bootloader = "/usr/bin/pygrub"
kernel = "/var/lib/xen/vmlinuz.QAI1O_"
ramdisk = "/var/lib/xen/initrd._9EXMc"
extra = "ro root=LABEL=/ rhgb quiet"
on_reboot = "restart"
on_crash = "restart"
sdl = 0
vnc = 5910
vnclisten= ''
disk = [ "tap:aio:/mnt/disk3part3/xen/vm/fedora7.img,xvda,w" ]
vif = [ "mac=00:16:3e:01:5d:9c,bridge=xenbr1,script=vif-bridge" ]

Friday, 10 August 2007

Xen in Fedora 6 part 1

I followed this procedure.
I used nfs for install location, dont forget to give real ip adress of your nfs (never write

Simply building nfs server :
mount -o loop F-7-i386-DVD.iso /mnt/disk3part3/xen/fedora
Put below to /etc/exports
start nfs service
service nfs start

encrypted partition in linux

Put hese into rc.local file for loading crypto modules.
modprobe cryptoloop
modprobe aes

if you need many loop device add below to modprobe.conf file.
options loop max_loop=32

Prepare encrypted file about 40Gb
dd if=/dev/zero of=/mnt/disk3part4/xfile01 bs=100M count=400
losetup -e aes /dev/loop1 /mnt/disk3part4/xfile01
mkfs -t ext2 /dev/loop1

Mounting encrypted file
losetup -e aes /dev/loop11 /mnt/disk3part4/xfile01
mount -o loop /dev/loop11 /home/username/torrent01


Configuration of VNC in Fedora 6
run vncconfig

edit /etc/sysconfig/vncservers
VNCSERVERARGS[2]="-geometry 1024x768"

add /home/username/.vnc/xstartup

start vnc server sevice
service vncserver start