I need some help in writing a custom telnet TCP probe to grab some data
from an Electrical power current monitor serial data device.
I am trying to pick off four different current readings from
a multi-line command output but the Channels all have identical line formats.

The status command output looks like this, the CLI prompt is the "UEC>" string.

UEC>S

Model M4
(C) Universal Electric Corp
01.00

Channel 1 Enabled
Current 88 Amps
Alarm 181 Amps
Full Scale 225 Amps

Channel 2 Enabled
Current 34 Amps
Alarm 182 Amps
Full Scale 225 Amps

Channel 3 Enabled
Current 87 Amps
Alarm 183 Amps
Full Scale 225 Amps

Channel 4 Enabled
Current 56 Amps
Alarm 184 Amps
Full Scale 225 Amps

UEC>

--------------------------------------
Is there a way to have MTCH span multiple lines or can LINE ON mode
step through the output lines in order?
This does not seem to work because the MTCH grep is probably only single line based.

MTCH "Channel 1 Enabled\r\nCurrent (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH1C" "${1}"



This script ends up just getting the first reading four times.

CONN #60 "TELNET"
WAIT #30 @IDLE (idle timeout in secs)
DISC @DISCONNECT

LINE OFF
EXPT "DS62 login:"i
SEND "${User}\r\n"
EXPT "Password:"i
SEND "${Password}\r\n"
EXPT "Enter Request :"i
SEND "1\r\n"
SEND "H\r\n"
EXPT "UEC>"i
SEND "S\r\n"
EXPT "Universal Electric Corp"i else goto @NO_MATCH
MTCH "(#+.#+)"ir else goto @NO_NUM_MATCH
STOR "Version" "${1}"
MTCH "Current (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH1C" "${1}"
MTCH "Alarm (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH1A" "${1}"
MTCH "Full Scale (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH1FS" "${1}"

MTCH "Current (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH2C" "${1}"
MTCH "Alarm (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH2A" "${1}"

MTCH "Current (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH3C" "${1}"
MTCH "Alarm (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH3A" "${1}"

MTCH "Current (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH4C" "${1}"
MTCH "Alarm (#+).Amps"ir else goto @NO_NUM_MATCH
STOR "SL1CH4A" "${1}"

SEND ";;;;;"
EXPT "Enter Request :"i
SEND "T\r\n"
LINE ON

-----------------------------------------------

Thanks John.




----------------------------------------------
 John Ratcliffe UCSD JSOE OEC

 [EMAIL PROTECTED]
----------------------------------------------


____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]

Reply via email to