send_gauge

Function description

The send_gauge function should be used to send a 32-bit integer gauge value to the master agent.

Function parameters

$1 - The OID to send before the data.

$2 - The integer value to send.

Example use

Listing 1
  1. # Function to send device attribute
  2. #
  3. #   @in_param   $1 - The STRING to search for
  4. #   @in_param   $2 - R to send RAW value, L to send LIFETIME value
  5. #   @in_param   $3 - The OID to send before this data
  6. #   @in_param   $4 - The index value
  7. #
  8. function send_device_attr
  9. {
  10.     local DEVFNAME VALUES
  11.    
  12.     # Make the device info filename
  13.     get_device_file_basepath ${4} DEVFNAME
  14.     DEVFNAME="${DEVFNAME}_attr"
  15.    
  16.     # Find the entry in above file
  17.     VALUES=($(grep "${1}" < ${DEVFNAME}))
  18.     case ${2} in
  19.         "R")
  20.         send_gauge ${3} ${VALUES[9]}
  21.         ;;
  22.        
  23.         "L")
  24.         send_gauge ${3} $((${VALUES[3]##0} - ${VALUES[5]##0}))
  25.         ;;
  26.        
  27.         *)
  28.         send_gauge ${3} -1     
  29.         ;; 
  30.     esac
  31. }
Example code demonstrating use of the send_gauge function