Custom Load Parameters
From UniCluster
Implementing Custom Load Parameters
To feed the Grid Engine execd daemon with additional load information, you must supply a load sensor. The load sensor can be a script or a binary executable. In either case, the load sensor’s handling of the standard input and standard output streams, and its control flow must comply with the following rules:
- The load sensor must be written as an infinite loop that waits at a certain point for input from STDIN.
- If the string quit is read from STDIN, the load sensor must exit.
- As soon as an end-of-line is read from STDIN, a retrieval cycle for loading data should start.
The load sensor performs whatever operation is necessary to compute the desired load figures, and at the end of the cycle, writes the result to STDOUT.
The format for the load sensor rules are:
1. A load value report starts with a line that contains nothing but the word begin.
2. Individual load values are separated by newlines.
3. Each load value consists of three parts separated by colons (:) and contains no blanks.
4. The first part of a load value is either the name of the host for which load is reported, or the special name global.
5. The second part of the load sensor is the symbolic name of the load value, as defined in the complex. (See the complex man page for details.) If a load value is reported for which no entry in the complex exists, the reported load value is not used.
6. The third part of the load sensor is the measured load value.
7. A load value report ends with a line that contains the word end.
Sample Load Sensor Script
#!/bin/sh
myhost=‘uname -n‘
while [ 1 ]; do
# wait for input
read input
result=$?
if [ $result != 0 ]; then
exit 1
fi
if [ $input = quit ]; then
exit 0
fi
#send users logged in
logins=‘who | cut -f1 -d" " | sort | uniq | wc -l | sed "s/^ *//"‘
echo begin
echo "$myhost:logins:$logins"
echo end
done
# we never get here
exit 0
Save this script to the file load.sh, and assign an executable permission to the file with chmod:
[admin@host]# chmod +x load.sh
To install the procedure, configure the load sensor path as the "load_sensor" parameter for the cluster configuration, global configuration, or the host-specific configuration.
Back to Administrative How Tos.
