Defines a sensor or a microsensor to the resource monitoring and control (RMC) subsystem.
To define a sensor:
mksensor [ –n host1[,host2…] | –N { node_file | "–" } ] [ –i seconds ] [ –c n ] [ –e 0 | 1 | 2 ] [ –u user-ID ] [–h] [ –v | –V ] sensor_name ["]sensor_command["]
To define a microsensor:
mksensor -m [ –n host1[,host2…] | –N { node_file | "–" } ] [ –i seconds ] [–h] [ –v | –V ] microsensor_name microsensor_module [ ["]microsensor_arguments["] ]
The mksensor command defines a sensor resource to the resource monitoring and control (RMC) subsystem. A sensor is an RMC resource with attributes that you can monitor. You can use the event-response resource manager (ERRM) commands to set up monitoring of the sensor attributes. The response actions defined will run when a monitored sensor event occurs. This enables administrators to extend RMC monitoring capabilities without having to write a resource manager.
For sensors, the sensor_command parameter specifies the command or script that the sensor resource manager will run to set (and then later, update) the sensor attribute values. After the sensor attributes have been monitored, the sensor resource manager sets the attribute values. Then, at defined intervals, the sensor resource manager updates these values.
For microsensors, the microsensor_module parameter specifies the path name to the loadable module that the microsensor resource manager will call to set (and then later, update) the microsensor attribute values. After the microsensor attributes have been monitored, the microsensor resource manager sets the attribute values. Then, at defined intervals, the microsensor resource manager updates these values. Use the -m flag to create a microsensor.
Alternatively, you can use chsensor or refsensor to update the sensor or microsensor attribute values. The lssensor command displays values for sensor or microsensor attributes that you can set using a sensor command or a microsensor module, if the attributes are monitored. If the attributes are not monitored, lssensor does not display their values. To remove a sensor or a microsensor, use the rmsensor command.
The mksensor command runs on any node. To define a sensor or a microsensor on one or more nodes in a management domain or a peer domain, use the -n flag. Instead of specifying multiple node names using the -n flag, you can use the -N node_file flag to indicate that the node names are in a file. Use -N "–" to read the node names from standard input.
If Cluster Systems Management (CSM) is installed on your system, you can use CSM defined node groups as node name values to refer to more than one node. For information about working with CSM node groups and using the CSM nodegrp command, see the CSM: Administration Guide and the CSM: Command and Technical Reference.
A sensor command sets attribute values by sending the values to standard output in a format that the sensor resource manager can parse. The format is attr=value. For example, if the sensor command sets the Int32 attribute to 57, it writes Int32=57 to standard output. To set more than one attribute value, the sensor command can write multiple attr=value pairs to standard output. The attr=value pairs can be on one or more lines. If the sensor command output is not in attr=value form, it is assumed to be a string and the value is placed in the String attribute.
The sensor command runs using the user ID that creates the sensor resource. Once a sensor resource is monitored, the sensor command is run at intervals specified by the -i flag, which is expressed in seconds. The default interval is 60 seconds. Specify a value of 0 to indicate that the sensor command is not to run at intervals. In this case, the refsensor command is typically used to update the sensor values.
Use the -e flag to control how the exit values from sensor_command are interpreted. Depending on this setting, when the exit value of the sensor_command is considered to be an error, the sensor attributes are not set and information is written to the audit log.
A microsensor consists of the following attributes, which can be set using a microsensor load module:
The microsensor resource manager will make calls to the microsensor load module to set the values of the microsensor attributes. See the Administering RSCT for information about how to use microsensors.
Use -N "–" in a management domain or a peer domain to read the node names from standard input.
The sensor command is run at the specified interval only when the sensor resource is monitored. The microsensor module is run at the specified interval only when the microsensor resource is monitored. If the interval is set to 0, the sensor command or microsensor module will not run automatically.
aUsing this flag is independent of using the refsensor command to refresh a sensor.
The sensor command will run at the interval that is defined for sensor_name. The sensor command will not run when monitoring begins or when the lssensor command is run.
Specfiying this value is not recommended, unless you expect the sensor command to run quickly. If the sensor command does not run quickly, it could block other requests to the sensor resource manager. These requests will not be processed until the sensor command finishes running.
If the microsensor argument contains any blank characters or any special characters that can be interepreted by the shell, it must be enclosed in double quotation marks. When the microsensor argument is enclosed in double quotation marks, you must include a backslash escape character (\) before an "inner" double quotation mark. You must also include a \ before a dollar sign ($).
If sensor_command contains any blank characters, or any special characters that can be interpreted by the shell, it must be enclosed in double quotation marks.
When sensor_command is enclosed in double quotation marks, you must include a backslash escape character (\) before an "inner" double quotation mark. You must also include a \ before a dollar sign ($). See Example 2 for more information.
To create sensors using this command, you need write permission for the IBM.Sensor resource class.
To create microsensors using this command, you need write permission for the IBM.MicroSensor resource class.
Permissions are specified in the access control list (ACL) file on the contacted system. See the Administering RSCT for details on the ACL file and how to modify it.
You should not call any of the sensor resource manager commands (chsensor, lssensor, mksensor, refsensor, or rmsensor) as part of the sensor_command parameter, as this could cause a deadlock.
This command is part of the rsct fileset for AIX® and rsct-3.1.0.0-0.platform.rpm package for Linux, Solaris, and Windows, where platform is i386, ppc, ppc64, s390, or x86_64.
mksensor -i 30 Sensor1 "/usr/bin/updateSensor1"
The
contents of /usr/bin/updateSensor1 may be
like: #!/usr/bin/perl
my $int32 = some_fn_that_generates_i32_value;
my $string = some_fn_that_generates_string_value;
print "Int32=$int32 String=$string";
exit 0;
A sample condition could be: mkcondition -r IBM.Sensor -s "Name==Sensor1" -e "Int32 > 100" Sensor1Int32
Using
the response "E-mail root anytime", a start monitoring command may
be: startcondresp Sensor1Int32 "E-mail root anytime"
df -m /var | sed '1d' | sed 's/%//g' | /bin/awk '{ print "Int32="$4}',
enter:mksensor Sensor1 "df -m /var | sed '1d' | sed 's/%//g' | /bin/awk \
'{ print \"Int32=\"\$4}'"
When sensor_command is
enclosed in double quotation marks, you must include a backslash escape
character (\) before an "inner" double quotation
mark. You must also include a \ before
a dollar sign ($). So in this example, the
sensor command substring "Int32="$4 becomes \"Int32=\"\$4 when
it is part of mksensor command.mksensor -N /u/joe/common_nodes Sensor3 "/usr/bin/checkhealth"
where /u/joe/common_nodes contains:
# common node file
#
node1.myhost.com main node
node2.myhost.com backup node
mksensor -m IBM.msensorq /usr/lib/msensors/msensorq \
"db=abc confirm=yes retry=yes mirror=no"