Serviceguard - how to change package IP on line/ off line

domingo, 29 de julho de 2012

Change package IP address off line

Halt the package
# cmhaltpkg -v <package>

Update control files
/etc/cmcluster/package/package.conf

Propagate the changes manually or use cmapplyconf
(legacy or modular)

Start package
# cmrunpck <package>

Check that the IP was added.
# cmviewcl -v

Change package IP address on line

You can change the IP address while a package is up but there's some risky... but can be done.
The recommended is do it off line to avoid any problems.

Use the command cmmodnet to remove the IP addres and after to add.

Using netstat -in check that the ip address is correct.

Check the cluster status:
# cmviewcl -v

Update the package script, propagate the change to other nodes.

For more infos about cmmodnet check man pages.

Serviceguard - Change node ip address

**In this situation we are changing just the ip, the subnet stil is the same**

Backup configuration files:

/etc/hosts
/etc/rc.config.d/netconf
/etc/cmcluster/

Move the package(s) to another node
# cmhaltpkg -v <package>
# cmrunpkg -v -n NODE <package>

Remove node from all packages

Run cmapplyconf (or send the configuration files for others nodes manualy)

Stop the node
# cmhaltnode -v <node>

Remove node from cluster configuration

Apply new cluster configuration

Change IP on node
/etc/rc.config.d/netconf
/etc/hosts
Restart the net deamon for  apply the new network configuration
# /sbin/init.d/net stop
# /sbin/inti.d/net start


Add node to cluster
The bellow link is another post showing how to include a new node in the cluster running.
http://hp-ux-br.blogspot.com.br/2012/05/adding-new-node-in-running-cluster.html

Apply cluster configuration

Start the node again
# cmrunnode -v <node>

Add node to all relevant packages

Apply package configuration

Move package(s) back to node
# cmrunpkg -v -n NODE <package>
# cmhaltpkg -v <package>

Check cluster status
# cmviewcl -v

Configuring LAN on MP

quinta-feira, 26 de julho de 2012

This tutorial explain how to change the LAN configuration on MP. You can also leave the DHCP enable if you want use the bootp from your server (or other).

1. Connect to the serial port.
2. At the MP Main Menu, enter CM and press Enter to select command mode.
3. At the command mode prompt, enter LC and press Enter. The screen displays the default LAN configuration values. Write down the default values, or log the information to a file. You may need the information for future troubleshooting.
4. Use the LC command to disable DHCP.
a. From the LC command menu, type D and press Enter.
b. Follow the instructions on the screen to change the DHCP status from Enabled to Disabled.
c. Enter XD -R to reset the iLO MP.
5. Use the LC command to enter information for the IP address, host, subnet mask, gateway parameters, and so on.
6. Enter XD -R to reset the iLO MP.
7. After the iLO MP resets, log in to the iLO MP again and enter CM at the MP:> prompt.
8. Enter LC to confirm that DHCP is disabled and display a list of updated LAN configuration
settings.

Glance Adviser Script - Averaged over # of CPU's

sábado, 21 de julho de 2012

The following script will return the average CPU utilization (averaged over number of CPU's) for system, user and total utilization.  It could easily be modified to be a feed into MRTG for graphing purposes.

Script
#
# Sample glance script showing average CPU utilization across all CPU's
#

headersprinted = 0
total_total = 0
total_sys = 0
total_user = 0
count = 0

# For each CPU
cpu loop {
    # print headers if this is the first row
    if headersprinted == 0 then {
      print "   Sys CPU   User CPU  Total CPU"
      headersprinted = 1
    }
    total_total=total_total+GBL_CPU_TOTAL_UTIL
    total_sys=total_sys+GBL_CPU_SYS_MODE_UTIL
    total_user=total_user+GBL_CPU_USER_MODE_UTIL
    count = count + 1
  }
print total_sys/count, " ", total_user/count, " ", total_total/count


Output
# glance -j 5 -adviser_only -syntax cpu.cfg -iterations 3
Welcome to GlancePlus

   Sys CPU   User CPU  Total CPU
         8         30         38
   Sys CPU   User CPU  Total CPU
         5         31         35
   Sys CPU   User CPU  Total CPU
         4         24         28

Glance Adviser Script - Detailed Process Gathering

You must be carefull with this example as it will generate a lot of data very quickly, depending on the interval.  I.e. listing all processes every second is a lot of lines in a short period of time.
It would be pretty easy to modify this script to simply count the processes if you wanted to report back to MRTG the number of processes.

Script
process loop {
    if ((proc_cpu_total_util > 0) or ( proc_stop_reason != "SLEEP" ))
 then {
    print gbl_statdate, "|", gbl_stattime, "|", proc_cpu_last_used, "|",
 proc_mem_virt, "|", proc_mem_res, "|",
 proc_cpu_total_util, "|",
 proc_stop_reason, "|", proc_disk_logl_io_rate, "|",
 proc_proc_id, "|", proc_parent_proc_id, "|",
 proc_user_name, "|", proc_proc_name, "|",
        proc_cache_wait_time, "|", proc_cdfs_wait_time, "|",
        proc_disk_subsystem_wait_time, "|", proc_disk_wait_time, "|",
        proc_graphics_wait_time, "|", proc_inode_wait_time, "|",
        proc_ipc_subsystem_wait_time, "|", proc_ipc_wait_time, "|",
 proc_jobctl_wait_time, "|", proc_lan_wait_time, "|",
 proc_mem_wait_time, "|", proc_msg_wait_time, "|",
 proc_nfs_wait_time, "|", proc_other_io_wait_time, "|",
 proc_other_wait_time, "|", proc_pipe_wait_time, "|",
 proc_pri_wait_time, "|", proc_rpc_wait_time, "|",
 proc_sem_wait_time, "|", proc_socket_wait_time, "|",
 proc_stream_wait_time, "|", proc_sys_wait_time, "|",
 proc_term_io_wait_time
    }
}

Glance Adviser script - Lan statistics

This example will produce packet level statistics (in, out, collisions, errors...) for every lan interface in the server.

Script

# initialize variables:
netif_to_examine = ""   # lan0 would only report on lan0, etc.
headers_printed = headers_printed

netif loop {
 
# print information for the selected interface or if null THEN all:
  IF (BYNETIF_NAME == netif_to_examine) or
     (netif_to_examine == "") THEN
  {

    # print headers the first time through the loop:
    IF headers_printed == 0 THEN
    {

      print "Date     Time    Interface  InPkts OutPkts  OutQ  Colls  Errs"
      print "   "

      headers_printed = 1
    }
    # print one line per interface reported:
    print GBL_STATDATE, " ", GBL_STATTIME, " ", BYNETIF_NAME|8,
      BYNETIF_IN_PACKET, BYNETIF_OUT_PACKET,
      BYNETIF_QUEUE, BYNETIF_COLLISION, BYNETIF_ERROR
    # (note that some interface types do not report collisions or errors)
  }
}
print "  "


Execute your lan script (lan.cfg) now:
# glance -j 5 -adviser_only -syntax lan.cfg -iterations 3

Welcome to GlancePlus

Date     Time    Interface  InPkts OutPkts  OutQ  Colls  Errs
   
04/28/04 15:01:00 lan0          3      2     0      0      0
04/28/04 15:01:00 lan3         35     39     0      0      0
04/28/04 15:01:00 lan6         31     32     0      0      0
04/28/04 15:01:00 lan7         50     31     0      0      0
04/28/04 15:01:00 lan8          0      0     0      0      0
04/28/04 15:01:00 lan4          0      0     0      0      0
04/28/04 15:01:00 lan9          0      0     0      0      0
04/28/04 15:01:00 lan10         0      0     0      0      0
04/28/04 15:01:00 lan11         0      0     0      0      0
04/28/04 15:01:00 lan5          3      2     0      0      0
04/28/04 15:01:00 lo0          26     26     0     na      0
  
04/28/04 15:01:05 lan0         13      7     0      0      0
04/28/04 15:01:05 lan3        173    230     0      0      0
04/28/04 15:01:05 lan6        121    129     0      0      0
04/28/04 15:01:05 lan7        197    142     0      0      0
04/28/04 15:01:05 lan8          1      1     0      0      0
04/28/04 15:01:05 lan4          1      1     0      0      0
04/28/04 15:01:05 lan9          1      1     0      0      0
04/28/04 15:01:05 lan10         1      1     0      0      0
04/28/04 15:01:05 lan11         1      1     0      0      0
04/28/04 15:01:05 lan5         13      7     0      0      0
04/28/04 15:01:05 lo0           3      3     0     na      0
  
04/28/04 15:01:10 lan0         12      7     0      0      0
04/28/04 15:01:10 lan3        151    221     0      0      0
04/28/04 15:01:10 lan6         97    105     0      0      0
04/28/04 15:01:10 lan7        165    126     0      0      0
04/28/04 15:01:10 lan8          1      1     0      0      0
04/28/04 15:01:10 lan4          1      1     0      0      0
04/28/04 15:01:10 lan9          1      1     0      0      0
04/28/04 15:01:10 lan10         1      1     0      0      0
04/28/04 15:01:10 lan11         1      1     0      0      0
04/28/04 15:01:10 lan5         12      7     0      0      0
04/28/04 15:01:10 lo0           0      0     0     na      0

You can redirect the output for a file.

Check/Set boot order

quinta-feira, 19 de julho de 2012

Check the boot order:
# setboot

Change primary boot device:
# setboot -p <HW ADDRESS>

Change alternate boot:
# setboot -a <HW ADDRESS>

For more options check setboot man pages.

ldapux doesn't start - "Already running"

terça-feira, 17 de julho de 2012

Message shown:

Already running

Ldapux has a lock file to prevent exec two ldap at same time, if the ldap was not correctly stoped the lock file will continue there avoiding the ldapux to start. In this case is necessary just remove the bellow file:

/etc/opt/ldapux/ldapclientd.pid

DSF - Including a path

sexta-feira, 13 de julho de 2012

The bellow example show how you can use the mksf command to manually create device files with default names, your own device file name, and custom device file corresponding to certain device options.

First of all check the disks and get the  HW address:
# ioscan -fnNC disk
(Example output bellow)
disk 344 64000/0xfa00/0x8c esdisk CLAIMED DEVICE DGC CX500WDR5
/dev/disk/disk344 /dev/rdisk/disk344

Insert the unique hardware path (-H option) and the path name as you need:
# mksf -C disk -H 64000/0xfa00/0x8c -r /dev/erptrn/asm/db50

Run the ioscan again to check the path for your disk:
# ioscan -m dsf

DHCP/ Bootp server on HP-UX?

You have the option to use the bootpd as a DHCP server, as well as a BOOTP server. You must to add the client entries in /etc/dhcptab and uncomment the bootps line in /etc/inetd.conf (don't forget to restart the inetd, inetd -c). See bootpd(1M) for details.
If you can't see the process running in top don't worry, the deamon must respawn when a client request an IP.

Configuring CIFS server (SAMBA)

sábado, 7 de julho de 2012

The first step is install the CIFS according your HP-UX version. Download the last version from HP site.
Follow the current version:

HP-UX Version
Current feature release
Preceding feature release
11.11
A.02.04.05
A.02.03.06
11.23
A.03.01.05
A.02.04.05
11.31
A.03.01.05
A.02.04.05

1. Edit the configuration files.
# cd /etc/opt/samba
# vi smb.conf


There's much option to configure your CIFS server, bellow is the minumun necessary to configure.
# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = HPUX_SERVER
# server string is the equivalent of the Description field on Windows domain
server string = Samba Server
netbios name = CIFS

# Log file used
log file = /var/opt/samba/log.%m
# Log level?

log level = 1
# Security method
security = user


Bellow is an example to share some directory, in this case we are sharing the "home" dir.
[homes]
comment = Home Directories
path = /home/%U
browseable = yes
writable = yes

2. Check if the smb.conf is ok:
# /opt/samba/bin/testparms
 3. Creating users and machines to connect on domain
If the user exist on box you need just to creat it on samba now.

Creating a user:
# /opt/samba/bin/smbpasswd -a egon
New SMB password:
Retype new SMB password:
Added user egon.


Creating a machine:
# /opt/samba/bin/smbpasswd -am $egonMachine

4. Start / stop samba server
# /opt/samba/bin/startsmb
# /opt/samba/bin/stopsmb


5. Configuring Automatic Start at System Boot
When the HP CIFS Server is first installed, it will not automatically start when the system boots.
You can enable the HP CIFS Server and related daemons to do so by editing the
/etc/rc.config.d/samba file.
RUN_SAMBA=0
RUN_WINBIND=0
To configure HP CIFS Server to start automatically, set RUN_SAMBA to a non-zero value. To configure Winbind to start automatically, set RUN_WINBIND to a non-zero value.

Configuring Anonymous FTP Server by Command line

1.Add user ftp to /etc/passwd, usually:

ftp:*:500:1:anonymous FTP:/home/ftp:/usr/bin/false
The password field should be *, the group membership should be guest, or, as in this example, other, and the login shell should be /usr/bin/false.
In this example, user ftp’s user ID is 500, and the anonymous FTP directory is /home/ftp.

2.Create the ftp home directory:
a.Create the ftp home directory that you referred to in the /etc/passwd file, usually:

# mkdir /home/ftp

b.Create the subdirectories usr/bin and /usr/lib under the ftp home directory, usually:

# cd /home/ftp
# mkdir -p usr/bin
3.Copy the ls command from /sbin to /home/ftp/usr/bin, and set the permissions on the command to execute only (mode 0111):

# cp /sbin/ls /home/ftp/usr/bin
# chmod u=x,g=x,o=x /home/ftp/usr/bin/ls
4.Set the owner of the /home/ftp/usr/bin and /home/ftp/usr directories to root, and set the permissions to read-execute (not writable) (mode 0555):

# chown root /home/ftp/usr/bin
# chmod u=rx,g=rx,o=rx /home/ftp/usr/bin # chown root /home/ftp/usr
# chmod u=rx,g=rx,o=rx /home/ftp/usr
5.Create the subdirectory etc under the ftp directory:

# cd /home/ftp
# mkdir etc
6.Copy /etc/passwd and /etc/group to /home/ftp/etc.
These files are required by the ls command, to display the owners of files and directories under /home/ftp.

# cp /etc/passwd /home/ftp/etc
# cp /etc/group /home/ftp/etc

7.In all entries in /home/ftp/etc/passwd, replace the password field with an asterisk (*), and delete the shell field, for example:

ftp:*:500:1:anonymous ftp:/home/ftp: tom:*:8996:20::/home/tom:
8.In all entries in /home/ftp/etc/group, replace the password field with an asterisk (*):

users:*:20:acb guest:*:21:ftp1

9.Change the owner of the files in /home/ftp/etc to root, and set the permissions to read only (mode 0444):

# chown root /home/ftp/etc
# chmod u=r,g=r,o=r /home/ftp/etc
10.Create a directory pub (for public) under /home/ftp, and change its owner to user ftp and its permissions to writable by all (mode 0777).
Anonymous FTP users can put files in this directory to make them available to other anonymous FTP users.

# mkdir /home/ftp/pub
# chown ftp /home/ftp/pub
# chmod u=rwx,g=rwx,o=rwx /home/ftp/pub
You can create other directories to provide separate categories, such as /home/ftp/draft and /home/ftp/final.

11.Create a directory dist (for distribution) under /home/ftp. Change its owner to root and its permissions to writable only by root (mode 0755).
Anonymous FTP users can read but not alter these directories.

# mkdir /home/ftp/dist
# chown root /home/ftp/dist
# chmod u=rwx,g=rx,o=rx /home/ftp/dist
12.Change the owner of user ftp’s home directory to root and the permissions to not writable (mode 0555):

# chown root /home/ftp
# chmod u=rx,g=rx,o=rx /home/ftp

This document is part from "HP Part Number '5992-4607'" documment.

Add a network printer queue

terça-feira, 3 de julho de 2012

You can use the hppi "gui" to add a network printer or.. the adqueue command.

First of all check the model script available:
# /opt/hpnp/bin/addqueue -l

Create the queue using the appropriate model script:
# /opt/hpnp/bin/addqueue -h {printer IP} -q{printer name} -b off -i {printer model}

Do you need another HP model script?
http://www.hp.com/pond/modelscripts/index2.html

Check queue status:
lpstat {printer name}

Test the queue:
banner TEST | lp -d{printer name}

**Remembering..
1.. to do that is necessary the "jetdirect patch" installed on box.
2.. to create a local printer you have to use the lpadmin command (not the addqueue or hppi).
3.. for default the addqueue command isn't in root path.

[11.31] Mapping disks (persistent > legacy)


Using this option os ioscan command you can see all paths for your disks (persistent and legacy DSF)

This tip is useful for someone who aren't "familiar" with HP-UX 11v3.
# ioscan -m dsf
Persistent DSF           Legacy DSF(s)
========================================
/dev/rdisk/disk1         /dev/rdsk/c0t0d0
/dev/rdisk/disk1_p1      /dev/rdsk/c0t0d0s1
/dev/rdisk/disk1_p2      /dev/rdsk/c0t0d0s2
/dev/rdisk/disk1_p3      /dev/rdsk/c0t0d0s3

Creat Boot Device using EFI cli Commands

1- List the current boot options using:
fs0:\> bcfg boot dump
The boot option list is:
01. VenHw(D65A6B8C-71E5-4DF0-A909-F0D2992B5AA9) "EFI Shell [Built-in]"
02. Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)/HD(Part1,Sig478114DA-6FF6-11E0-8000-D6217B60E588)/\EFI\HPUX\hpux.efi "boot"
03. Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)/HD(Part1,Sig478114DA-6FF6-11E0-8000-D6217B60E588)/\EFI\HPUX\hpux.efi "boot2"

2-Delete the boot options(if necessary):
fs0:\> bcfg boot rm 03
bcfg: boot option 3 removed
fs0:\> bcfg boot rm 02
bcfg: boot option 2 removed
fs0:\>

3-Add new boot disk:
\> map
Device mapping table
fs0 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)/HD(Part1,Sig478114DA-6FF6-11E0-8000-D6217B60E588)
blk0 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun1,Lun0)
blk1 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun2,Lun0)
blk2 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun3,Lun0)
blk3 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun4,Lun0)
blk4 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)
blk5 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)/HD(Part1,Sig478114DA-6FF6-11E0-8000-D6217B60E588)
blk6 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)/HD(Part2,Sig478114EE-6FF6-11E0-8000-D6217B60E588)
blk7 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)/HD(Part3,Sig47811502-6FF6-11E0-8000-D6217B60E588)
blk8 : Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun9,Lun0)
\> fs0:
fs0:\> cd \EFI\HPUX
fs0:\EFI\HPUX> ls
Directory of: fs0:\EFI\HPUX
04/26/11 01:29p 4,096 .
04/26/11 01:29p 4,096 ..
04/26/11 01:29p 698,356 hpux.efi
04/26/11 01:29p 31,232 nbp.efi
04/26/11 01:29p 12 AUTO
3 File(s) 729,600 bytes
fs0:\EFI\HPUX> bcfg boot add 1 hpux.efi "BOOT DEVICE"
Target = A
bcfg: Add boot option as 1
fs0:\EFI\HPUX> bcfg boot dump
The boot option list is:
01. VenHw(D65A6B8C-71E5-4DF0-A909-F0D2992B5AA9) "EFI Shell [Built-in]"
02. Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)/HD(Part1,Sig478114DA-6FF6-11E0-8000-D6217B60E588)/\EFI\HPUX\hpux.efi "BOOT DISK"
fs0:\EFI\HPUX> bcfg boot mv 2 1
bcfg: boot option 2 moved to 1
fs0:\EFI\HPUX> bcfg boot dump
The boot option list is:
01. Acpi(PNP0A03,0)/Pci(0|0)/Scsi(Pun6,Lun0)/HD(Part1,Sig478114DA-6FF6-11E0-8000-D6217B60E588)/\EFI\HPUX\hpux.efi "BOOT DISK"
02. VenHw(D65A6B8C-71E5-4DF0-A909-F0D2992B5AA9) "EFI Shell [Built-in]"
EFI Boot Manager ver 1.10 [14.62] [Build: Mon Apr 26 10:55:36 2010]
Please select a boot option
BOOT DISK
EFI Shell [Built-in]
Boot option maintenance menu
Use ^ and v to change option(s). Use Enter to select an option