The following are the exit values for the register subcommand:
0 Successful registration
1 An invalid, or non-existent reaper name
An invalid group name, resource or monitoring type
2 One or more attributes are invalid
3 A similar resource object has already been registered (e.g.
identical attributes)
4 User must have super-user permission
5 Encountered an error which prevented de-initialization
unregister -reapername <name> -groupname <name>
unregister -reapername <name> -groupname <name> -rid <RID>
unregister -reapername <name> -rid <RID>
The unregister subcommand removes and frees a resource object from
monitoring. All the data associated with the resource object within
VxAMF is destroyed.
-reaper_name The name of the reaper this resource object will be
registered under. The reaper must have been previously
initialized using the init subcommand.
-group_name An optional argument indicating the group in which
its resource objects will be un-registered. The group
name must exist within the reaper (e.g. must have
resources previously registered with that group).
-rid An optional parameter indicating the specific RID to
be un-registered. The RID msut exist as part of the
resoources registered under the reaper.
If only the group_name is given, then all resource objects in the
group is un-registeered.
If both the group_name and the RID is given, then only that resource
object corresponding to that RID is un-registered. The RID must have
been previously registered with the group name.
If only the RID is given, then only the resource object corresponding
to that RID will be unregistered, regardless of the group association.
However, the RID must registered under this reaper.
Note: After getting notification, the user must explicitly remove those
resource objects using the un-registration subcommand.
The following are the exit values for the unregister subcommand:
0 Successful un-registration
1 An invalid, or non-existent reaper, group, or RID
2 User must have super-user permission
3 Encountered an error which prevented unregistration
getnotification -reapername <name> [ -groupname <name> ]
[ -count <number> ] [ -flags <notification_flag> ]
The getnotification subcommand allows user to wait for and receive
notifications for events related to state changes for monitored
resources. The user is blocked until an event of interest occurs
(but a non-blocking flag option is available).
If the group name is given, then the getnotification only waits for
those events that are associated with that particular group. Other
events that occur are queued until an appropriate getnotification is
invoked.
-reaper_name The name of the reaper whose resource objects are to
be waited on for state changes. The reaper must have
been previously initialized using the init subcommand.
-group_name An optional argument indicating a particular group in
which the resource objects are associated with. The
group name must exist within the reaper (e.g. must have
resources previously registered with that group). If not
given, all the resources registered under the reaper will
be considered.
-count A integer value indicating the maximum number of events
that can be return. If not given, the default is 1.
-flag Passes notification value options to VxAMF. Currently,
The following flag value is supported:
noblock For non-blocking getnotifications. If there are
no events of interest, the notification call
returns immediately and no output is printed on
the standard out. This flag option can be used
to peek into VxAMF for events.
Upon successful return, up to the maximum number of events are printed
to the standard output, one line per event, and in the following
colon seperated format:
<RID>:group_name:restype:resstate
For example, event with RID 100, group Ora1, process resource, and
online monitoring:
100:Ora1:process:online
Another example for a event with RID 200, no group association,
mount resource type, and offline monitoring:
200::mount:offline
Future releases may add additional event details.
The following are the exit values for the getnotification subcommand:
0 Successful notification
1 An invalid argument (reaper, group, count or flags parameter)
2 Getnotification was canceled due to deinitialization
3 User must have super-user permission
4 Encountered an error which prevented de-initialization
EXAMPLE USAGE
The following is a simple shell script example:
#!/usr/bin/sh
name=$0
reaper=$1
pid=$2
#
# Initialize the reaper
#
vxamfcmd init -reaper_name $reaper -reaper_pid=$pid
if [ $? -ne 0 ]
then
echo "$name: initialization failed for reaper $reaper with error $?"
exit -1
fi
#
# Register pids for monitoring
#
cnt=0
monitor_pids=ps -e | grep OraTest | grep -v grep | awk { print $1 }
for i in $monitor_pids
do
rid$cnt=vxamfcmd register -reaper_name $reaper -group_name OraTest
-restype process -resstate online -resattr pid=$i
if [ $? -ne 0 ]
then
echo "$name: registration failed for pid $i with error $?"
exit -1
fi
cnt=expr $cnt + 1
done
#
# Wait for notifications.
#
events=vxamfcmd -getnotification -group_name OraTest
if [ $? -ne 0 ]
then
echo "$name: getnotification failed with error $?"
exit -1
fi
#
# Go through the events and unregister each resource object
#
rids=echo $events | cut -d: -f1
for i in $rids
do
echo "$name: event with RID $i has occurred"
vxamfcmd -unregister -group_name OraTest -rid $i
if [ $? -ne 0 ]
then
echo "$name: un-registration failed for RID $i with error $?"
exit -1
fi
done
SEE ALSO
vxamf_init(3VXAMF), vxamf_deinit(3VXAMF), vxamf_register(3VXAMF)
vxamf_unregister(3VXAMF), vxamf_getnotification(3VXAMF)
VCS 7.4.1 | vxamfcmd(1M) |