Sunday, May 25, 2014

How to Create Startup /shutdown script in HP UX


Startup and shut down script has 3 parts

1.Original script in /sbin/init.d

2.Configuratiopn file for the script in /etc/rc.config.d
  (configuration variables in /etc/rc.config.d to change the behavior of scripts in   
  /sbin/init.d.)

3.Symlink file for the scripts under /sbin/rc*.d/


How to enable startup/shutdown scripts

Step1 : First place the script under the directory /sbin/init.d/

Step2 : Then create a sym link to the script file

Start a service : ln -s /sbin/init.d/ur_script  /sbin/rc3.d/S900urscript.rc

stop a service : ln -s /sbin/init.d/ur_script  /sbin/rc3.d/K900Ur_script.rc

3. Place the configuration file under /etc/rc.config.d with required variables (optional)
   
  
For Examble : CRON service

/sbin/init.d/cron -->  execution script
/etc/rc.config.d/cron -->  configuration file
/sbin/rc2.d/S730cron -->  start sequence symbolic link
/sbin/rc1.d/K270cron -->  kill sequence symbolic link

Saturday, May 24, 2014

Adding new disk to HPVM : How to ??


Scenario :

The SAN team allocated a new lun to the  HOST (Physical server) where the VM machine is running. And now u need to add that lun to HOST node and then add that disk to Gust node.



And here am going to create a new RAW lvol on VM Host and that Raw lvol used as disk on VM Guest. 

Note:- inq command not working on some HP-UX servers

If you have access to powerlink.emc.com (EMC's repository) you can go download the latest and greatest version of INQ yourself. If you dont have access, you can ask one of your Storage Admins to download it for you. I had similar issue and got it resolved. There are a lot of different versions of INQ for each flavor of UNIX out there - not to forget the 32bit and 64 bit versions.

No need for inq, we can use ioscan -fnC disk  or ioscan -fnC lun will show lun's

A. On HOST Node ( Where the VM machine is running )

Once SAN team allocated the disk to HOST node follow the below steps

#ioscan -fnC disk

#ioscan -eC disk

#inq -sym_wwn |grep -i "lun no"

# ls -ltr /dev/rdisk*   --------> the last one will be our guy.

#pvcreate /dev/disk/rdisk??

#vgcreate /dev/vg_name?? /dev/disk/disk??

#lvcreate -L "disk size in MB" -n /dev/vg_name??/lv_?? /dev/vg_name??

(Create a RAW Lvol only , no need to create a FS, since we are going to allocate this RAW lvol as disk to HPVM)

B. Adding disk to Guest :


# /opt/hpvm/bin/hpvmstatus -P VM_Machine_Name
  // To check the existing disk details for the VM machine


Now we need to add this newly created LVOL to GUEST node as new disk.


#hpvmmodify -P vir_machine -a disk:scsi:lv:/dev/vg_name??/LV_name??
 // New lvol which we created

Once added the disk check and confirm 

#/opt/hpvm/bin/hpvmstatus -P VM_Machine_Name  //check the storage interface details in o/p


For example we will get like below ,

Device  Adaptor    Bus Dev Ftn Tgt Lun Storage   Device
======= ========== === === === === === ========= =========================
disk    scsi         0   1   0   0   0 lv        /dev/vg_vir_machine_00/rlv_os_00
disk    scsi         0   1   0   1   0 lv        /dev/vg_vir_machine_01/rlv_app_01
disk    scsi         0   1   0   2   0 lv        /dev/vg_vir_machine_02/rlv_app_02
disk    scsi         0   1   0   3   0 lv        /dev/vg_vir_machine_03/rlv_app_03
disk    scsi         0   1   0   4   0 lv        /dev/vg_vir_machine_04/rlv_app_04
disk    scsi         0   1   0   5   0 lv        /dev/vg_vir_machine_05/rlv_app_05
disk    scsi         0   1   0   6   0 lv        /dev/vg_vir_machine_06/rlv_app_06
disk    scsi         0   1   0   7   0 lv        /dev/vg_vir_machine_07/rlv_app_07 ---->>Consider this is new LVOL (disk)



C.Now login to the Guest node ( Virtual machine)


#ioscan  -fnC disk

#ioscan -eC disk

#pvcreate /dev/disk/diskname??  //New disk name 

Now you can add this to any VG and then you can create a new lvol or extend the exisiting FS.


QA : How to Find new disk in Guest node:


On HOST - 

#hpvmstatus -P vmmachine


[ disk    scsi         0   1   0   7   0 lv        /dev/vg_vir_machine_07/rlv_app_07 ---->>Consider this is new LVOL (disk)  ]

Note down the lvol path - 0   1   0   7   0 

ON Guest:

#ioscan -fnC disk

The new disk path will be @ 0/1/7/0 - Check and confirm the same in hpvmstatus -P vmmachine o/p 

and then do # ls -lrt /dev/disk or /dev/dsk/ you will get the new disk path directory in recent date.

Installed date using swlist command:How to get ??


test# swlist -l fileset -a revision -a title -a state -a install_date |more
# Initializing...
# Contacting target "tfttest"...
#
# Target:  tfttest:/
#

# ACC-LINK                              C.06.16        HP aCC_link tool 201308210540.08
  ACC-LINK.ACC-LINK                     C.06.16        HP aCC_link tool 201308210540.08 configured
# AONLINEJFS                            B.05.01.03     OnlineJFS 5.0.1 Integration Product 201308210540.08
  AONLINEJFS.AONLINEJFSPKG              B.05.01.03     OnlineJFS 5.0.1 Integration Fileset 201308210540.08 configured
# ATOK                                  B.11.31        ATOK (Japanese Input Method Server) 201308210540.08
  ATOK.ATOK-COM                         B.11.31        ATOK Runtime   201308210540.08 configured
  ATOK.ATOK-RUN                         B.11.31        ATOK Runt

Who Rebooted the server?



Who Rebooted the server?

Please check these following files before judge who that rebooted your server:

1. /var/adm/crash 
2. /etc/shutdownlog
3. /var/tombstones/ts99
4. /var/opt/resmon/log/event.log


If there is nothing indication that come from the above files, then it is probably because of a power failure occured for a short time.

#vi .sh_hystory then Esc-Shift-G to go the end of line

Convert to trusted system : How to ?


To convert the system into  trusted system the command is :

# /usr/lbin/tsconvert 

After converting it will create a directory /tcb/files/auth/*/*

Note: before converting into trusted system you have to modify /etc/nsswitch.conf file. In that file "passwd  compact " has to be changed into "passwd files"

To unconvert the trusted system with the following command:

    # /usr/lbin/tsconvert –r

How to patch a HP-UX box which is mirrored?




1)you should take reboot of the server.

2) You should run swverify to see all other patch status.

3)now you have to break the mirror  do lvsplit

why? because if anything goes wrong the mirror is also gets affected.

4) run fsck on lvolb and mount it

5) now install the patch, after that check the log files if it is ok or not.

6) boot from the mirror oncec back we have to merge it.

7) use lvmerge to get the mirror back.

that's it done

Configuring a two node serviceguard Cluster (part 2)




In the first part of this tutorial I showed the basic serviceguard cluster configuration. Now I am going to show how to configure package inside the cluster. A package is an application and all the application’s resources required to execute properly.
Resources for packages may include:
– Disk Resources ( Volume Group(s), Disk Group(s) )
– Network Resources ( IP Address(es) )
Packaging Files include:
– Package Configuration File ( pkg.conf )
– Package Control Script ( pkg.cntl )
As I said earlier I will configure Oracle Database server as a package of service guard. The database instance will run on the first node only. In the event of a failure it will run on the second node.
At first we need to create file system on the shared storage. Oracle will use these shared file system for storing data files as well as binary. To create file system we need to create physical volume, volume group and logical volume. Here is the commands:
Physical Volume (PV) Creation:
# pvcreate -f /dev/rdsk/c4t0d1
Physical volume "/dev/rdsk/c4t0d1" has been successfully created.

# pvcreate -f /dev/rdsk/c4t0d2
Physical volume "/dev/rdsk/c4t0d2" has been successfully created.
VG Creation:
Check the device number of the existing VGs.
# ls -l /dev/*/group
crw-r-----   1 root       sys         64 0x000000 Oct  4 11:27 /dev/vg00/group
crw-r--r--   1 root       sys         64 0x010000 Oct  4 15:16 /dev/vglock/group
Create group file for new volume groups:
# mkdir /dev/vgappl
# mknod /dev/vgappl/group c 64 0x020000

# mkdir /dev/vgoradata
# mknod /dev/vgoradata/group c 64 0x030000
Create the required volume groups:
# vgcreate -s 32 vgappl /dev/dsk/c4t0d1

Increased the number of physical extents per physical volume to 6399.
Volume group "/dev/vgappl" has been successfully created.
Volume Group configuration for /dev/vgappl has been saved in /etc/lvmconf/vgappl.conf

# vgcreate -s 32 vgoradata /dev/dsk/c4t0d2
Increased the number of physical extents per physical volume to 6399.
Volume group "/dev/vgoradata" has been successfully created.
Volume Group configuration for /dev/vgoradata has been saved in /etc/lvmconf/vgoradata.conf
Create the logical volumes (LV):
# lvcreate -L 204000 -n lvappl /dev/vgappl
Logical volume "/dev/vgappl/lvappl" has been successfully created with
character device "/dev/vgappl/rlvappl".
Logical volume "/dev/vgappl/lvappl" has been successfully extended.
Volume Group configuration for /dev/vgappl has been saved in /etc/lvmconf/vgappl.conf

# lvcreate -L 204000 -n lvoradata /dev/vgoradata
Logical volume "/dev/vgoradata/lvoradata" has been successfully created with
character device "/dev/vgoradata/rlvoradata".
Logical volume "/dev/vgoradata/lvoradata" has been successfully extended.
Volume Group configuration for /dev/vgoradata has been saved in /etc/lvmconf/vgoradata.conf
Create file system / mount point:
# newfs -F vxfs -o largefiles /dev/vgappl/rlvappl
version 5 layout
208896000 sectors, 208896000 blocks of size 1024, log size 16384 blocks
unlimited inodes, largefiles supported
208896000 data blocks, 208826960 free data blocks
6375 allocation units of 32768 blocks, 32768 data blocks

# newfs -F vxfs -o largefiles /dev/vgoradata/rlvoradata
version 5 layout
208896000 sectors, 208896000 blocks of size 1024, log size 16384 blocks
unlimited inodes, largefiles supported
208896000 data blocks, 208826960 free data blocks
6375 allocation units of 32768 blocks, 32768 data blocks
Mount the file systems:
mount /dev/vgappl/lvappl /appl
mount /dev/vgoradata/lvoradata /oradata
Up to this stage, two file systems /appl and /oradata are created. Now we will install oracle database on these mount points. /appl will contain the oracle binary and /oradata will be used for storing the data files. I will not show the oracle installation. Just keep one thing in mind: The mount points /appl and /oradata are shared mount points. So, for anything that resides on these two mount points, you don’t need to copy it to the second node. But for any other files (i.e /etc/oratab, /var/opt/oracle/oratab etc) you need to manually send the files to the second node at the same location. Another important thing is, user id and group id of oracle user and oinstall group must same across all cluster node. Actually its applicable for any user, not only oracle.
After installing oracle, log on as oracle user, set the environment variables (ORACLE_HOME, ORACLE_SID etc) and start the database and listener to check that the installation is good. If everything is fine, then stop the database and listener.
Now you will,
1. unmount the file system on 1st node
2. deactivate the VGs and export the VGs from 1st node to a map file
3. send the map file to 2nd node
4. import the VGs on 2nd node from the map file
5. activate the VG and mount the file systems on 2nd node.
6. start the database and listener
7. If everything is OK then stop database, unmount file systems and deactivate VG on 2nd node.
Here is the commands:
On first node:
# umount /appl
# umount /oradata
# vgchange -a n vgappl
Volume group "vgappl" has been successfully changed.

# vgchange -a n vgoradata
Volume group "vgoradata" has been successfully changed.

# vgexport -p -v -s -m /etc/lvmconf/vgappl.map vgappl
Beginning the export process on Volume Group "vgappl".
/dev/dsk/c4t0d1

# vgexport -p -v -s -m /etc/lvmconf/vgoradata.map vgoradata
Beginning the export process on Volume Group "vgoradata".
/dev/dsk/c4t0d2

# rcp /etc/lvmconf/vgappl.map node02:/etc/lvmconf/

# rcp /etc/lvmconf/vgoradata.map node02:/etc/lvmconf/
On 2nd node:
# mkdir /dev/vgappl
# mkdir /dev/vgoradata

# mknod /dev/vgappl/group c 64 0x020000
# mknod /dev/vgoradata/group c 64 0x030000

# ls -l  /dev/*/group
crw-r-----   1 root       sys         64 0x000000 Oct  4 13:00 /dev/vg00/group
crw-r--r--   1 root       sys         64 0x020000 Oct  5 10:05 /dev/vgappl/group
crw-r--r--   1 root       sys         64 0x010000 Oct  4 15:22 /dev/vglock/group
crw-r--r--   1 root       sys         64 0x030000 Oct  5 10:05 /dev/vgoradata/group

# vgimport -v -s -m /etc/lvmconf/vgappl.map vgappl
Beginning the import process on Volume Group "vgappl".
Logical volume "/dev/vgappl/lvappl" has been successfully created
with lv number 1.
Volume group "/dev/vgappl" has been successfully created.

# vgimport -v -s -m /etc/lvmconf/vgoradata.map vgoradata
Beginning the import process on Volume Group "vgoradata".
Logical volume "/dev/vgoradata/lvoradata" has been successfully created
with lv number 1.
Volume group "/dev/vgoradata" has been successfully created.

# mkdir /appl
# mkdir /oradata
# mount /dev/vgappl/lvappl /appl
# mount /dev/vgoradata/lvoradata /oradata
Now start the database, listener and check. After successful checking shutdown db, unmount and deactivate the VG on the 2nd node.
The next step is package configuration. We will do it from 1st node.
Configuring package on servicegurad is a 3 step procedure:
1. Build the Package Configuration File
2. Build the Package Run/Halt Script
3. Compile and Distribute the Binary File
Step 1: Build the Package Configuration File
The first step in building the package configuration file is to run the cmmakepkg command to create the package configuration template:
# mkdir /etc/cmcluster/orapkg
# cd /etc/cmcluster/orapkg
# cmmakepkg -v –p orapkg.conf
Begin generating package template...  Done.
Package template is created.
This file must be edited before it can be used.
The next step is to edit / customize the file with the vi editor:
After editing the file will look something like below:
# cat /etc/cmcluster/orapkg/orapkg.conf
PACKAGE_NAME                    orapkg
PACKAGE_TYPE                    FAILOVER
FAILOVER_POLICY                 CONFIGURED_NODE
FAILBACK_POLICY                 MANUAL

NODE_NAME                       node01
NODE_NAME                       node02

AUTO_RUN                        YES
LOCAL_LAN_FAILOVER_ALLOWED      YES
NODE_FAIL_FAST_ENABLED          NO

RUN_SCRIPT              /etc/cmcluster/orapkg/orapkg.ctrl
RUN_SCRIPT_TIMEOUT              NO_TIMEOUT
HALT_SCRIPT             /etc/cmcluster/orapkg/orapkg.ctrl
HALT_SCRIPT_TIMEOUT             NO_TIMEOUT

SERVICE_NAME                   orapkg_db1
SERVICE_FAIL_FAST_ENABLED      NO
SERVICE_HALT_TIMEOUT           300

SUBNET 10.10.96.0
Here the value of RUN_SCRIPT and HALT_SCRIPT option is /etc/cmcluster/orapkg/orapkg.ctrl. Actually this is the script that will start and stop the application. In our case it will start/stop the database and listener. We will generate and modify this script on next step.
Step 2: Build the Package Run/Halt Script
The procedure for building the package control script is to create a template with the command:
# cd /etc/cmcluster/orapkg
# cmmakepkg -v -s orapkg.ctrl
Begin generating package control script...  Done.
Package control script is created.
This file must be edited before it can be used.
Before going to the next step, copy all files from /opt/cmcluster/toolkit/oracle/ to /etc/cmcluster/orapkg/ directory. The mentioned directory contains HP supplied sample start-up/monitoring script for oracle. HP also supplies sample script for other application including apache, samba, NFS, tomcat etc.
#cp /opt/cmcluster/toolkit/oracle/* .
The next step is to edit/customize the script with the vi editor. This file is self explanatory. You need to specify the VG, LV, mount point and mount options for all package file systems (/appl and /oradata in this case). You also need to specify package IP address (ip address on which application will connect), SERVICE_NAME (a name for your service: any relevant name will suffice) and SERVICE_CMD (The full pathname of the command used to start the service process). After editing, the modified portion of the file will look like the following. Leave the rest of the file as it was.
VG[0]=vgappl
VG[1]=vgoradata

LV[0]=/dev/vgappl/lvappl; FS[0]=/appl; FS_MOUNT_OPT[0]="-o rw"
LV[1]=/dev/vgoradata/lvoradata; FS[1]=/oradata; FS_MOUNT_OPT[1]="-o rw"

IP[0]=192.168.100.50

function customer_defined_run_cmds
{
/etc/cmcluster/orapkg/toolkit.sh start
        test_return 51
}

function customer_defined_halt_cmds
{
/etc/cmcluster/orapkg/toolkit.sh shutdown
        test_return 52
}
Now edit the /etc/cmcluster/orapkg/haoracle.conf file and set ORACLE_HOME and SID_NAME. This file will look like following:
ORACLE_HOME=/appl/oracle/product/10.2.0
ORACLE_ADMIN=oracle
SID_NAME=orcl
LISTENER=yes
LISTENER_NAME=LISTENER
LISTENER_PASS=
USE_SPFILE=yes
set -A MONITOR_PROCESSES
MONITOR_PROCESSES[0]=ora_pmon_${SID_NAME}
MONITOR_PROCESSES[1]=ora_dbw0_${SID_NAME}
MONITOR_PROCESSES[2]=ora_ckpt_${SID_NAME}
MONITOR_PROCESSES[3]=ora_smon_${SID_NAME}
MONITOR_PROCESSES[4]=ora_lgwr_${SID_NAME}
MONITOR_PROCESSES[5]=ora_reco_${SID_NAME}
MAINTENANCE_FLAG=yes
MONITOR_INTERVAL=30
TIME_OUT=30
You have completed package configuration. Before going to next step edit the cluster configuration file /etc/cmcluster/crmcluster.ascii and add the following lines:
VOLUME_GROUP            /dev/vgappl
VOLUME_GROUP            /dev/vgoradata
Transfer the /etc/cmcluster/orapkg to the 2nd node.
Step 3. Compile and Distribute the Binary File
Here is the last configuration step: creating and distributing the package binary file. Execute the following commands one after another:
# cd /etc/cmcluster
# cmcheckconf -v -P orapkg/orapkg.conf -C crmcluster.ascii
Checking cluster file: crmcluster.ascii
Note : a NODE_TIMEOUT value of 2000000 was found in line 127. For a
significant portion of installations, a higher setting is more appropriate.
Refer to the comments in the cluster configuration ascii file or Serviceguard
manual for more information on this parameter.
Checking nodes ... Done
Checking existing configuration ... Done
Volume group /dev/vgappl is configured differently on node node01 than on node node02
Volume group /dev/vgappl is configured differently on node node02 than on node node01
Volume group /dev/vgoradata is configured differently on node node01 than on node node02
Volume group /dev/vgoradata is configured differently on node node02 than on node node01
Volume group /dev/vglock is configured differently on node node01 than on node node02
Volume group /dev/vglock is configured differently on node node02 than on node node01
Parsing package file: orapkg/orapkg.conf.
Checking for inconsistencies
Modifying configuration on node node01
Modifying configuration on node node02
cmcheckconf: Verification completed with no errors found.
Use the cmapplyconf command to apply the configuration.
The above command will check correctness and consistency of configuration file. If it completes successfully then run the following command:
# cd /etc/cmcluster
# cmapplyconf -v -P orapkg/orapkg.conf -C crmcluster.ascii
Checking cluster file: crmcluster.ascii
Note : a NODE_TIMEOUT value of 2000000 was found in line 127. For a
significant portion of installations, a higher setting is more appropriate.
Refer to the comments in the cluster configuration ascii file or Serviceguard
manual for more information on this parameter.
Checking nodes ... Done
Checking existing configuration ... Done
Volume group /dev/vgappl is configured differently on node node01 than on node node02
Volume group /dev/vgappl is configured differently on node node02 than on node node01
Volume group /dev/vgoradata is configured differently on node node01 than on node node02
Volume group /dev/vgoradata is configured differently on node node02 than on node node01
Volume group /dev/vglock is configured differently on node node01 than on node node02
Volume group /dev/vglock is configured differently on node node02 than on node node01
Parsing package file: orapkg/orapkg.conf.
Checking for inconsistencies
Modifying configuration on node node01
Modifying configuration on node node02

Modify the cluster configuration ([y]/n)? y
Marking/unmarking volume groups for use in the cluster
Completed the cluster creation
Package is compiled successfully. You have the start the cluster using cmruncl command and then you can use cmrunpkg <package_name>command to start the package.
Here is some useful service guard cluster commands:
Cluster Management Commands
cmruncl
cmhaltcl
cmviewcl
Package Management Commands
cmrunpkg
cmhaltpkg
cmmodpkg
Node Management Commands
cmrunnode
cmhaltnode
This is the end of the two part tutorial. This tutorial may seem too abridged, but I am always available to explain/elaborate any part of it. Just leave a comment, I will answer as soon as possible.

Configuring a two node serviceguard Cluster (part 1)


Configuring a two node serviceguard Cluster (part 1)


Here I will describe the configuration procedure of a basic two node HP Serviceguard Cluster on HP-Unix. I will use Oracle RDBMS as the cluster package. I will just show the configuration steps. I am not going to discuss any theoretical concept like why someone will use a cluster or what actually a single point of failure is etc etc. There is a handful of discussion on these topics on internet. During the configuration I felt the lack of a well documented step by step configuration guide. I will try to make this one.

Hardware Configuration:

I will use two HP 9000 series RP3440 service with 2 CPU and 4 Gig physical memory.
Each server have 4 network interface card. We will use three of them.
For shared storage I will use HP MSA 1000 storage.
Software Configuration:

Operating system is: HP Unix 11.23 MCOE (Mission Critical Operating Environment).

The HP-UX 11i Mission Operating Environment provides all the capabilities of the base HP-UX 11i and Enterprise Operating Environments plus certain critical add-on products for additional multiple system availability and performance management. The benefit is you don’t need to install servicegurad and other related file sets manually. It will be installed during the OS installation.

For heartbeat I will use a point to point Ethernet connection.

Here is the steps:

1. Configure the hardware first. Connect all required network cables. For this example, connect two NICs on each server to the public Ethernet network, connect the heartbeat cable through a point to point cable. Assign the LUNs from the storage. The amount of required shared storage will depend on the application requirement. For this example 5/6 LUNs of 50GB will be more than enough.

2. Install the operating system. Ensure that the shared LUNs are visible from both node. The output of ioscan -fnC command will look something like this:

# ioscan -fnC disk
Class     I  H/W Path       Driver     S/W State   H/W Type     Description
============================================================================
disk      0  0/0/2/0.0.0.0  sdisk      CLAIMED     DEVICE       TEAC    DV-28E-N
                           /dev/dsk/c0t0d0   /dev/rdsk/c0t0d0
disk      1  0/1/1/0.0.0    sdisk      CLAIMED     DEVICE       HP 146 GST3146707LC
                           /dev/dsk/c2t0d0   /dev/rdsk/c2t0d0
disk     16  0/1/1/0.1.0    sdisk      CLAIMED     DEVICE       HP 146 GST3146707LC
                           /dev/dsk/c2t1d0   /dev/rdsk/c2t1d0
disk      2  0/2/1/0/4/0.1.0.0.0.0.1    sdisk      CLAIMED     DEVICE  HP MSA VOLUME
                           /dev/dsk/c4t0d1   /dev/rdsk/c4t0d1
disk      4  0/2/1/0/4/0.1.0.0.0.0.2    sdisk      CLAIMED     DEVICE  HP MSA VOLUME
                           /dev/dsk/c4t0d2   /dev/rdsk/c4t0d2
disk      6  0/2/1/0/4/0.1.0.0.0.0.3    sdisk      CLAIMED     DEVICE  HP MSA VOLUME
                           /dev/dsk/c4t0d3   /dev/rdsk/c4t0d3
disk      8  0/2/1/0/4/0.1.0.0.0.0.4    sdisk      CLAIMED     DEVICE  HP MSA VOLUME
                           /dev/dsk/c4t0d4   /dev/rdsk/c4t0d4
disk     10  0/2/1/0/4/0.1.0.0.0.0.5    sdisk      CLAIMED     DEVICE  HP MSA VOLUME
                           /dev/dsk/c4t0d5   /dev/rdsk/c4t0d5
3. Assign the IP addresses on both nodes and make sure you are able to ping each other using both public interface IP and heartbeat IP. The /etc/rc.config.d/netconf file will look something like this:

#cat /etc/rc.config.d/netconf
HOSTNAME="node01"
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1
INTERFACE_NAME[0]="lan0"
IP_ADDRESS[0]="10.10.96.162"
SUBNET_MASK[0]="255.255.255.0"
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0
INTERFACE_MODULES[0]=""

INTERFACE_NAME[1]="lan1"
IP_ADDRESS[1]="1.1.1.34"
SUBNET_MASK[1]="255.255.255.0"
BROADCAST_ADDRESS[1]=""
INTERFACE_STATE[1]=""
DHCP_ENABLE[1]=0
INTERFACE_MODULES[0]=""

ROUTE_DESTINATION[0]=default
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="10.10.96.1"
ROUTE_COUNT[0]=""

GATED=0
GATED_ARGS=""
RDPD=0
RARP=0

DEFAULT_INTERFACE_MODULES=""
4. Add the information of all IP addresses (public and heartbeat) on /etc/hosts file. Make sure that /etc/hosts file on both nodes are same. Following is a sample file:

# cat /etc/hosts
10.10.96.162   node01
10.10.96.164   node02
10.10.96.163   crm_db        #service IP / package IP
1.1.1.34         node01hb
1.1.1.24         node02hb
127.0.0.1       localhost       loopback
5. Create a VG for using as a lock-VG. It will work as the quorum device.  Here is the procedure:

Create the physical volume (PV) first:

# pvcreate -f /dev/rdsk/c4t0d5
Physical volume "/dev/rdsk/c4t0d5" has been successfully created.
Note that, you must mention the raw device file (/dev/rdsk/..) for creating the PV and you have to use the block device file (/dev/dsk/..) for creating VG.

Create the group file for the volume group:

# mkdir /dev/vglock
# mknod /dev/vglock/group c 64 0x010000
The minor number (0×010000) of the group file must be unique for all VG. To check the minor number of any existing group file use ‘ls -l /dev/*/group’.

Now create the volume group named vglock. This VG will be used as lock VG:

# vgcreate -s 32 vglock /dev/dsk/c4t0d5
Increased the number of physical extents per physical volume to 6399.
Volume group "/dev/vglock" has been successfully created.
Volume Group configuration for /dev/vglock has been saved in /etc/lvmconf/vglock.conf
Deactivate the VG on node01, export the VG information to a map file and transfer the file to the 2nd node (node02 here) using the following comands:

# vgchange -a n vglock
Volume group "vglock" has been successfully changed.

# vgexport -p -v -s -m /etc/lvmconf/vglock.map vglock
Beginning the export process on Volume Group "vglock".
/dev/dsk/c4t0d5

# rcp /etc/lvmconf/vglock.map node02:/etc/lvmconf/
If you don’t deactivate before exporting the VG, then you will get a warning which you can ignore.

Use the following commands to create the required group file on 2nd node and import the lock VG using the map file that was transferred from the first node. Minor number of a VG must be same on all the cluster nodes.

# mkdir /dev/vglock

# mknod /dev/vglock/group c 64 0x010000

# vgimport -s -v -m /etc/lvmconf/vglock.map vglock
Beginning the import process on Volume Group "vglock".
Volume group "/dev/vglock" has been successfully created.
6. Now you are ready to create the cluster. Execute the following command to create an ascii cluster configuration file.

# cd /etc/cmcluster
# cmquerycl -v -n node01 -n node02 -C crmcluster.ascii
Looking for other clusters ... Done
Gathering storage information
Found 23 devices on node node01
Found 23 devices on node node02
Analysis of 46 devices should take approximately 5 seconds
0%----10%----20%----30%----40%----50%----60%----70%----80%----90%----100%
Found 2 volume groups on node node01
Found 2 volume groups on node node02
Analysis of 4 volume groups should take approximately 1 seconds
0%----10%----20%----30%----40%----50%----60%----70%----80%----90%----100%
Note: Disks were discovered which are not in use by either LVM or VxVM.
      Use pvcreate(1M) to initialize a disk for LVM or,
      use vxdiskadm(1M) to initialize a disk for VxVM.
Volume group /dev/vglock is configured differently on node node01 than on node node02
Volume group /dev/vglock is configured differently on node node02 than on node node01
Gathering network information
Beginning network probing
Completed network probing

Node Names:   node01
              node02

Bridged networks (local node information only - full probing was not performed):

1       lan0           (node01)

2       lan1           (node01)

5       lan0           (node02)

6       lan1           (node02)

IP subnets:

IPv4:

10.10.96.0         lan0      (node01)
                   lan0      (node02)

1.1.1.0             lan1      (node01)
                    lan1      (node02)

IPv6:

Possible Heartbeat IPs:

10.10.96.0                        10.10.96.162        (node01)
                                  10.10.96.164        (node02)

1.1.1.0                            1.1.1.34            (node01)
                                   1.1.1.24            (node02)

Possible Cluster Lock Devices:

/dev/dsk/c4t0d5    /dev/vglock          66 seconds

LVM volume groups:

/dev/vg00               node01

/dev/vglock             node01
                        node02

/dev/vg00               node02

LVM physical volumes:

/dev/vg00
/dev/dsk/c2t1d0    0/1/1/0.1.0                   node01

/dev/vglock
/dev/dsk/c5t0d7    0/2/1/0/4/0.1.0.255.0.0.7     node01

/dev/dsk/c4t0d7    0/2/1/0/4/0.1.0.0.0.0.7       node02
/dev/dsk/c5t0d7    0/2/1/0/4/0.1.0.255.0.0.7     node02

/dev/vg00
/dev/dsk/c2t1d0    0/1/1/0.1.0                   node02

LVM logical volumes:

Volume groups on node01:
/dev/vg00/lvol1                           FS MOUNTED   /stand
/dev/vg00/lvol2
/dev/vg00/lvol3                           FS MOUNTED   /
/dev/vg00/lvol4                           FS MOUNTED   /home
/dev/vg00/lvol5                           FS MOUNTED   /tmp
/dev/vg00/lvol6                           FS MOUNTED   /opt
/dev/vg00/lvol7                           FS MOUNTED   /usr
/dev/vg00/lvol8                           FS MOUNTED   /var

Volume groups on node02:
/dev/vg00/lvol1                           FS MOUNTED   /stand
/dev/vg00/lvol2
/dev/vg00/lvol3                           FS MOUNTED   /
/dev/vg00/lvol4                           FS MOUNTED   /home
/dev/vg00/lvol5                           FS MOUNTED   /tmp
/dev/vg00/lvol6                           FS MOUNTED   /opt
/dev/vg00/lvol7                           FS MOUNTED   /usr
/dev/vg00/lvol8                           FS MOUNTED   /var

Writing cluster data to crmcluster.ascii.
The above command will build the /etc/cmcluster/crmcluster.ascii file. This file defines the nodes, the disks, the LAN cards, and any other resources that are to be part of the cluster. You can edit this file and change various cluster parameter like HEARTBEAT_INTERVAL, NODE_TIMEOUT etc. Here is the content of the file:

# cat crmcluster.ascii

CLUSTER_NAME            crmcluster

FIRST_CLUSTER_LOCK_VG           /dev/vglock

NODE_NAME               node01
  NETWORK_INTERFACE     lan0
    HEARTBEAT_IP        10.10.96.162
  NETWORK_INTERFACE     lan1
    HEARTBEAT_IP        1.1.1.34
  FIRST_CLUSTER_LOCK_PV /dev/dsk/c5t0d7

NODE_NAME               node02
  NETWORK_INTERFACE     lan0
    HEARTBEAT_IP        10.10.96.164
  NETWORK_INTERFACE     lan1
    HEARTBEAT_IP        1.1.1.24
  FIRST_CLUSTER_LOCK_PV /dev/dsk/c4t0d7

HEARTBEAT_INTERVAL           1000000
NODE_TIMEOUT                 2000000
AUTO_START_TIMEOUT           600000000
NETWORK_POLLING_INTERVAL     2000000
NETWORK_FAILURE_DETECTION    INOUT
MAX_CONFIGURED_PACKAGES      150
VOLUME_GROUP                 /dev/vglock
Once the cluster configuration file is edited, you need to use the cmcheckconf command to check the file for errors:

# cd /etc/cmcluster
# cmcheckconf -v -C crmscluster.ascii
Checking cluster file: crmcluster.ascii
Note : a NODE_TIMEOUT value of 2000000 was found in line 127. For a
significant portion of installations, a higher setting is more appropriate.
Refer to the comments in the cluster configuration ascii file or Serviceguard
manual for more information on this parameter.
Checking nodes ... Done
Checking existing configuration ... Done
Gathering storage information
Found 2 devices on node node01
Found 3 devices on node node02
Analysis of 5 devices should take approximately 1 seconds
0%----10%----20%----30%----40%----50%----60%----70%----80%----90%----100%
Found 2 volume groups on node node01
Found 2 volume groups on node node02
Analysis of 4 volume groups should take approximately 1 seconds
0%----10%----20%----30%----40%----50%----60%----70%----80%----90%----100%
Volume group /dev/vglock is configured differently on node node01 than on node node02
Volume group /dev/vglock is configured differently on node node02 than on node node01
Gathering network information
Beginning network probing (this may take a while)
Completed network probing
Checking for inconsistencies
Adding node node01 to cluster crmcluster
Adding node node02 to cluster crmcluster
cmcheckconf: Verification completed with no errors found.
Use the cmapplyconf command to apply the configuration.
After the file has been verified as containing no errors, the cmapplyconf command is used to create and distribute the cluster binary file:

# cmapplyconf -v -C crmcluster.ascii
Checking cluster file: crmcluster.ascii
Note : a NODE_TIMEOUT value of 2000000 was found in line 127. For a
significant portion of installations, a higher setting is more appropriate.
Refer to the comments in the cluster configuration ascii file or Serviceguard
manual for more information on this parameter.
Checking nodes ... Done
Checking existing configuration ... Done
Node node01 is refusing Serviceguard communication.
Please make sure that the proper security access is configured on node
node01 through either file-based access (pre-A.11.16 version) or role-based
access (version A.11.16 or higher) and/or that the host name lookup
on node node01 resolves the IP address correctly.
cmapplyconf: Failed to gather configuration information
As you see from the above output, the command is failed to run successfully. Check the output carefully. It says, there are some problems in name resolution. I was stuck at this point for a significant amount of time. Then I found that there is no /etc/nsswitch.conf file. However, there were nsswitch.files, nsswitch.dns and nsswitch.nis on /etc directory. So I just renamed the file /etc/nsswitch.files to /etc/nsswitch.conf. You can use any of the following commands:

# cp /etc/nsswitch.files /etc/nsswitch.conf
or

# mv /etc/nsswitch.files /etc/nsswitch.conf
Then run the command cmapplyconf again and press y when it will ask for confirmation:

# cd /etc/cmcluster
# cmapplyconf -v -C crmcluster.ascii
Checking cluster file: crmcluster.ascii
Note : a NODE_TIMEOUT value of 2000000 was found in line 127. For a
significant portion of installations, a higher setting is more appropriate.
Refer to the comments in the cluster configuration ascii file or Serviceguard
manual for more information on this parameter.
Checking nodes ... Done
Checking existing configuration ... Done
Volume group /dev/vglock is configured differently on node node01 than on node node02
Volume group /dev/vglock is configured differently on node node02 than on node node01
Checking for inconsistencies
Modifying configuration on node node01
Modifying configuration on node node02
Modifying node wdkrac1 in cluster crmcluster
Modifying node wdkrac2 in cluster crmcluster

Modify the cluster configuration ([y]/n)? y
Marking/unmarking volume groups for use in the cluster
Completed the cluster creation
Now you will be able to start the cluster using the cmruncl command:

# cmruncl -v
cmruncl: Validating network configuration...
cmruncl: Network validation complete
Waiting for cluster to form ..... done
Cluster successfully formed.
Check the syslog files on all nodes in the cluster to verify that no warnings occurred during startup.
To check the cluster status you can use the cmviewcl command:

# cmviewcl

CLUSTER        STATUS
crmcluster    up

  NODE           STATUS       STATE
  node01        up           running
  node02        up           running
Now the cluster is configured. But there is no package configured yet. We will do the package configuration in my next post.

Note: Cluster planning, installation and administration requires extensive knowledge about cluster technology. This tutorial is only applicable for those who already know the basic concept and just want to learn the basic configuration steps. This may also help the people who already worked with other high availability product like IBM HACMP, Sun Cluster, Veritas cluster etc.

How to automate backup in Unix?

Backup Using TAR
Backing up your files using tar is very simple you just type a little command.
Command = tar -cvpzf   /BackupDirectory/backupfilename.tar.gz /ImportantData/directory/path
Let’s suppose i have directory called /imp-data on root  and i want to make backup of this directory including sub directories on  different location like in /mybackupfolder.
In above example my command will be.
tar -cvpzf /mybackupfolder/backup.tar.gz    /imp-data


Command Explaination:
tar = tape archive
c =  Create
v =  Verbose mode
p = Preserving Files and Directory Permissions.
z = This will tell tar that compress the files further to reduce the size of tar file.
f =  It is allows to tar get file name.
Let’s add tar command in bash script to make this whole backup process automatic.
Here i will show you my self-created simple bash script that i am using for backing up my important data and then we will use cron job to run our whole process in background automatically.
Here is my Super Simple Backup Script :)
Create file using vi editor and paste below script.
vi /backup.sh
#!/bin/bash
#Purpose = Backup of Important Data
#Created on 17-1-2012
#Author = Hafiz Haider
#Version 1.0
#START

TIME=`date +"%b-%d-%y"`             # This Command will add date in Backup File Name.
FILENAME="backup-$TIME.tar.gz"      # Here i define Backup file name format.
SRCDIR="/imp-data"                  # Location of Important Data Directory (Source of backup).
DESDIR="/mybackupfolder"            # Destination of backup file.
tar -cpzf $DESDIR/$FILENAME $SRCDIR

#END
This Script will make backup of /imp-data directory and save it into a single compressed file on /mybackupfolder Directory.
Linux Backup :


Now i will show you how to schedule our backup process. In Linux we use cron jobs in order to schedule task.
For setting up cron jobs we use crontab -e command in shell, this command basically says we are going to edit our cron jobs file. If you run first time crontab -e command then it will ask you to default text editor, you just select your favorite editor after that it will never ask you again.
crontab -e
Format of Crontab. It has 6 Parts:
Minutes    Hours     Day of Month    Month     Day of Week     Command
0 to 59       0 to 23      1 to 31               1 to 12        0 to 6                Shell Command
Let’s Suppose i want to run this backup process on every Mon and Sat  at 1:pm.
In Above Condition my Crontab file should be like this.
crontab -e
#   Minutes    Hours      Day of Month       Month    Day of Week    Command

      01        13               *             *        1,6          /bin/bash /backup.sh
That’s All…

Saturday, May 17, 2014

IQ 4:- what is the resourse pool status if error in VCS?

IQ 4:- how to mount zfs FS?By default after created zfs its get mountedmanually ,zfs mount -O tank/home/lalt

example:

# zfs mount -a
By default, ZFS does not allow mounting on top of a nonempty directory. To force a mount on top of a nonempty directory, you must use the -Ooption. For example:

# zfs mount tank/home/lalt
cannot mount '/export/home/lalt': directory is not empty
use legacy mountpoint to allow this behavior, or use the -O flag
# zfs mount -O tank/home/lalt
Legacy mount points must be managed through legacy tools. An attempt to use ZFS tools results in an error. For example:

# zfs mount pool/home/billm
cannot mount 'pool/home/billm': legacy mountpoint
use mount(1M) to mount this filesystem
# mount -F zfs tank/home/billm

Mounting ZFS File Systems

ZFS automatically mounts file systems when file systems are created or when the system boots. Use of the zfs mount command is necessary only when you need to change mount options, or explicitly mount or unmount file systems.
The zfs mount command with no arguments shows all currently mounted file systems that are managed by ZFS. Legacy managed mount points are not displayed. For example:

# zfs mount
tank                            /tank
tank/home                       /tank/home
tank/home/bonwick               /tank/home/bonwick
tank/ws                         /tank/ws
You can use the -a option to mount all ZFS managed file systems. Legacy managed file systems are not mounted. For example:

# zfs mount -a
By default, ZFS does not allow mounting on top of a nonempty directory. To force a mount on top of a nonempty directory, you must use the -Ooption. For example:

# zfs mount tank/home/lalt
cannot mount '/export/home/lalt': directory is not empty
use legacy mountpoint to allow this behavior, or use the -O flag
# zfs mount -O tank/home/lalt
Legacy mount points must be managed through legacy tools. An attempt to use ZFS tools results in an error. For example:

# zfs mount pool/home/billm
cannot mount 'pool/home/billm': legacy mountpoint
use mount(1M) to mount this filesystem
# mount -F zfs tank/home/billm
When a file system is mounted, it uses a set of mount options based on the property values associated with the dataset. The correlation between properties and mount options is as follows:
Table 6–4 ZFS Mount-Related Properties and Mount Options
Property Mount Option 
atimeatime/noatime
devicesdevices/nodevices
execexec/noexec
nbmandnbmand/nonbmand
readonlyro/rw
setuidsetuid/nosetuid
xattrxattr/noaxttr

IQ 3:- how to modify the service in Solaris ? ----> svccfg ex:-# svccfg -s dns/client setprop config/nameserver = 10.0.0.1


Configuring SMF Services

The following tasks show how to configure SMF services. In particular, how to modify service properties and other configuration information for a service or a service instance.

How to Modify an SMF Service Property

This procedure shows how to modify the property that identifies the user that can start a service.
  1. Become an administrator or assume a role that includes the Service Management rights profile.
  2. Change the value that is assigned to the start/user property.
    First, give the FMRI to identify the appropriate service. Next, assign the UID that will start the service.
    # svccfg -s FMRI
    svc:/service: setprop start/user = astring: newlogin
  3. Refresh the service.
    # svcadm refresh FMRI

How to Modify a Service That Is Configured by a File

The following procedure shows how to change the configuration of a service that is not managed by the inetd service.
  1. Become an administrator or assume a role that includes the Service Management rights profile.
  2. Make changes to the configuration files, as needed.
    Many of the services have one or more configuration files that are used to define the startup or other configuration information. These files can be changed while the service is running. The contents of the files is only checked when the service is started.
  3. Restart the service.
    # svcadm restart FMRI
Example 7-12 Adding a New NTP Server
To add a new NTP server to support your NTP clients, add a new entry for the server to the /etc/inet/ntp.conf file. Next, restart the NTP service. This example shows you what thentp.conf file could look like, as well as how to restart the service.

# cat /etc/inet/ntp.conf
   .
   .
server ntpserver1.example.com
server ntpserver2.example.com
# svcadm restart svc:/network/ntp:default

he SMF Command Line

There are several commands administrators can use from the command line to administer services and make configuration changes to the system. Table 1 provides a quick summary of the different command line options that are available.
Table 1. Summary of SMF Commands
CommandDescription
svcadmManage the state of service instances
svcsProvide information about services, including their status
svcpropGet information about service configuration properties
svccfgImport, export, and modify service configuration
Before we go into detail about how to modify changes in the SMF repository, let's quickly look at the command svcprop and how we can use it to list property groups and properties of a given service or service instance. Listing 7 shows it being used with thesvc:/network/dns/client:default instance.
# svcprop dns/client:default
general/complete astring
general/enabled boolean true
general/action_authorization astring solaris.smf.manage.name-service.dns.client
general/entity_stability astring Unstable
general/single_instance boolean true
general/value_authorization astring solaris.smf.manage.name-service.dns.client
config/value_authorization astring solaris.smf.value.name-service.dns.client
config/nameserver net_address 192.168.0.1
sysconfig/group astring naming_services
milestoneconfig_network_dns_client/entities fmri svc:/milestone/config
milestoneconfig_network_dns_client/external boolean true
milestoneconfig_network_dns_client/grouping astring optional_all
milestoneconfig_network_dns_client/restart_on astring none
milestoneconfig_network_dns_client/type astring service
location_dns-client/entities fmri svc:/network/location:default
...
restarter/state_timestamp time 1339662573.051463000
restarter_actions/auxiliary_tty boolean false
restarter_actions/auxiliary_fmri astring svc:/network/location:default
general_ovr/enabled boolean true
Listing 7. Listing Property Groups and Properties
In Listing 7, we are using svcprop without any other options, and we get a composed view by default—one that includes properties from both the parent service and the service instance. If we just wanted to look at the instance properties, we can use the -C option, as shown in Listing 8.
# svcprop -C dns/client:default
general/complete astring
general/enabled boolean true
restarter/logfile astring /var/svc/log/network-dns-client:default.log
restarter/start_pid count 572
restarter/start_method_timestamp time 1339662573.041262000
restarter/start_method_waitstatus integer 0
restarter/transient_contract count
restarter/auxiliary_state astring dependencies_satisfied
restarter/next_state astring none
restarter/state astring online
restarter/state_timestamp time 1339662573.051463000
restarter_actions/auxiliary_tty boolean false
restarter_actions/auxiliary_fmri astring svc:/network/location:default
general_ovr/enabled boolean true
Listing 8. Listing Only Instance Properties
If we wanted to focus on a particular property, we can use the -p option to specify the property group and property. In this case, we're going to find the config/nameserver property on the service rather than on the service instance. This property is used as a replacement to the legacy /etc/resolv.conf file in previous versions of Oracle Solaris, though the value is mirrored to that file for compatibility with applications that might be parsing it.
# svcprop -p config/nameserver dns/client
192.168.0.1
Now that we've seen how to query properties, let's take a look at another command, svccfg, that we can use to set properties. svccfgprovides a number of different ways to set properties: directly on the command line, through an interactive text-based interface, or through a text editor. Let's keep with our svc:/network/dns/client example and see how easy it is to set the name server configuration.
# svccfg -s dns/client setprop config/nameserver = 10.0.0.1
# svccfg -s dns/client listprop config/nameserver
config/nameserver net_address 10.0.0.1
Changes made to an existing service in the respository typically do not take effect until the service instance has been refreshed.
# svcprop -p config/nameserver dns/client
192.168.0.1
# svcadm refresh dns/client:default
# svcprop -p config/nameserver dns/client
10.0.0.1
Equally, we could have used the interactive interface to make these changes. Let's change the value of config/nameserver back to what it was originally, 192.168.0.1, as shown in Listing 9.
# svccfg
svc:> select dns/client
svc:/network/dns/client> listprop config/nameserver
config/nameserver net_address 10.0.0.1
svc:/network/dns/client> describe config/nameserver
config/nameserver net_address 10.0.0.1
    The value used to construct the "nameserver" directive in resolv.conf(4)
svc:/network/dns/client> setprop config/nameserver = 192.168.0.1
svc:/network/dns/client> listprop config/nameserver
config/nameserver net_address 192.168.0.1
svc:/network/dns/client> select default
svc:/network/dns/client:default> refresh
svc:/network/dns/client:default> exit
Listing 9. Using the Interactive Interface
svccfg supports a number of other useful commands, such as listpg to list property groups on a given service, editprop to open up a text editor to more easily allow configuration of multiple properties at the same time, and extract to allow administrators to easily capture service customizations as an XML file that can be applied on other systems. We will cover more of these in another article.

Monitoring the State of Services

One of the new features added to SMF in Oracle Solaris 11 is the ability to monitor the state of services and get notified if they change, either through e-mail or SNMP traps. Notifications can be quickly set to check if any SMF services go into maintenance mode or if a particular service goes online, for example. As a quick example, let's set an e-mail notification to be sent anytime an SMF service goes into maintenance mode, as shown in Listing 10.
# svccfg setnotify -g maintenance mailto:admin@mycompany.com
# svccfg listnotify -g
    Event: to-maintenance (source: svc:/system/svc/global:default)
        Notification Type: smtp
            Active: true
            to: admin@mycompany.com

    Event: from-maintenance (source: svc:/system/svc/global:default)
        Notification Type: smtp
            Active: true
            to: admin@mycompany.com
Listing 10. Example of Setting a Notification
By default, SMF will use an existing simple e-mail template to fill in the values of any SMF service that has gone into or out of themaintenance state; however, this can be modified easily by setting a parameter, msg_template, in the mailto: address, as follows:
# svccfg setnotify -g maintenance "'mailto:admin@mycompany.com?msg_template=/usr/local/share/new-smf-email-template'"
We can also monitor individual services. In this case, let's monitor the svc:/network/http:apache22 Apache Web server default instance for any changes away from its current online state:
# svcs http:apache22
STATE          STIME    FMRI
online         Jun_14   svc:/network/http:apache22
# svccfg -s http:apache22 setnotify from-online mailto:admin@mycompany.com
# svccfg -s http:apache22 listnotify
    Event: from-online (source: svc:/network/http:apache22)
        Notification Type: smtp
            Active: true
            to: admin@mycompany.com

Troubleshooting

Now that we have covered some of the basics of administration with SMF, let's quickly take a look at some of the things we can do to troubleshoot what might be wrong with a service. To quickly get an idea of what services are not running due to errors, we can use the -xv options to svcs, as shown in Listing 11.
# svcs -xv
svc:/system/identity:node (system identity (nodename))
 State: disabled since June 22, 2012 08:11:14 PM NZST
Reason: Disabled by an administrator.
   See: http://sun.com/msg/SMF-8000-05
   See: man -M /usr/share/man -s 4 nodename
   See: /var/svc/log/system-identity:node.log
Impact: 5 dependent services are not running:
        svc:/network/rpc/bind:default
        svc:/network/rpc/gss:default
        svc:/system/filesystem/autofs:default
        svc:/network/rpc/smserver:default
        svc:/network/nfs/mapid:default