Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Using f$getdvi

 
Steven_101
Advisor

Using f$getdvi

Working on script to daily look at device errors and send an email. Trying to figure how to do NIC's and PG devices.


Using TARGET_DISK = F$DEVICE("*","DISK") for idetifying disk drives, but system services $getdvi doesn't give a clue for nic's of pg devices
9 REPLIES 9
Jim_McKinney
Honored Contributor

Re: Using f$getdvi

Try "SCOM" and "BUS"... from DCDEF you might see

#define DC$_DISK 1 /* DISK */
#define DC$_TAPE 2 /* TAPES */
#define DC$_SCOM 32 /* SYNCHRONOUS COMMUNICATIONS DEVICES */
#define DC$_CARD 65 /* CARD READER */
#define DC$_TERM 66 /* TERMINAL */
#define DC$_LP 67 /* LINE PRINTER */
#define DC$_WORKSTATION 70 /* WORKSTATIONS */
#define DC$_REALTIME 96 /* REAL-TIME */
#define DC$_DECVOICE 97 /* DECVOICE products */
#define DC$_AUDIO 98 /* General audio */
#define DC$_VIDEO 99 /* General video */
#define DC$_BUS 128 /* BUSES, E.G, CI */
#define DC$_MAILBOX 160 /* MAILBOX */
#define DC$_REMCSL_STORAGE 170 /* REMOTE CONSOLE STORAGE */
#define DC$_MISC 200 /* MISCELLANEOUS DEVICES */
Jess Goodman
Esteemed Contributor

Re: Using f$getdvi

Use the following two loops:

$ DC$_SCOM = 32 !Synchronous Communications device class
$NIC_LOOP:
$ DEVICE = F$DEVICE("_%%%0:",DC$_SCOM)
$ IF (DEVICE .NES. "")
$ THEN
$ IF (DEVICE .EQS. "_RMA0:") THEN GOTO NIC_LOOP
$ ERRORS = F$GETDVI(DEVICE,"ERRCNT")
$ WRITE SYS$OUTPUT ERRORS," errors on ",DEVICE
$ GOTO NIC_LOOP
$ ENDIF
$!
$PG_LOOP:
$ DEVICE = F$DEVICE("_PG%0:")
$ IF (DEVICE .NES. "")
$ THEN
$ ERRORS = F$GETDVI(DEVICE,"ERRCNT")
$ WRITE SYS$OUTPUT ERRORS," errors on ",DEVICE
$ GOTO PG_LOOP
$ ENDIF
I have one, but it's personal.
Hoff
Honored Contributor

Re: Using f$getdvi

The DC device class and DT device type codes are massively limited in their capabilities, but they'll work for this case.

The skeleton of an idea for a brute force approach...

$ set noon
$ pipe show error > x.x
$loop:
$ wait 12:00:00
$ pipe show error > x.x
$ differences/output=nla0: x.x
$ if $status .nes. "%X006C8009"
$ then
$ mail x.x hoffman/subj="Error mail"
$ else
$ purge x.x
$ endif
$ goto loop

Another approach might look to use ANALYZE /ERROR /ELV TRANSLATE with a /SINCE=YESTERDAY selection criteria for DEVICE_ERRORS or CONTROL_ENTRIES or such. (The use of /ELV assumes a sufficiently recent version of OpenVMS.)

If you have a support contract for the hardware, some of the service tools have predictive capabilities.
John Gillings
Honored Contributor

Re: Using f$getdvi

Another approach would be to reset the error counts daily and mail the output of SHOW ERROR if it reports any errors. (since any reported errors must have occurred since the last reset).

For example

$ SHOW ERROR
$ IF $STATUS.EQS."%X10000001" THEN PIPE SHOW ERROR | MAIL/SUBJECT="Device errors" sys$pipe YOURSELF >nl: 2>nl:


Now you need to clear the error counts.

Here's a quick and nasty procedure that works by parsing the SHOW ERROR display:

$ IF p1.EQS.""
$ THEN
$ PIPE SHOW ERROR | @'F$PARSE(";",F$ENVIRONMENT("PROCEDURE"))' SYS$PIPE
$ EXIT
$ ENDIF
$ OldPriv=F$SETPRV("PHY_IO,CMKRNL,DIAGNOSE")
$ OPEN/READ in 'p1'
$ SET NOON
$ ON CONTROL_Y THEN GOTO EndLoop
$ Loop: READ/END=EndLoop in line
$ dev=F$ELEMENT(0,":",line)
$ IF dev.NES.line THEN SET DEVICE/RESET=ERROR_COUNT 'dev'
$ GOTO Loop
$ EndLoop: CLOSE in
$ SET PROCESS/PRIVILEGE=('OldPriv')


A crucible of informative mistakes
RBrown_1
Trusted Contributor

Re: Using f$getdvi

Even easier than resetting the counts daily is to SHOW ERROR to a file and then compare to yesterday's file:

$ SHOW ERROR/OUTPUT=SHOWERROR.TXT
$ DIFFERENCES/OUTPUT SHOWERROR.TXT
$ IF $SEVERITY .EQ. 3 -
THEN MAIL /SUBJECT="Device errors" -
SHOWERROR.DIF SYSTEM

Set a version limit on SHOWERROR.TXT and SHOWERROR.DIF, and it cleans up itself.

Unfortunately, on a reboot you get a mail that shows the counts all went back to 0.