home *** CD-ROM | disk | FTP | other *** search
- /////////////////////////////////////////////////////////////////////////
- // This task can be launched periodically or as a result of being spawned
- // by some other network management product.
- /////////////////////////////////////////////////////////////////////////
-
-
- // First, let's open a file to log anything we find into.
-
- OPEN_WRITE SYS:SYSTEM\ALERT.LOG
-
-
- // Check if the current Conns In Use are within 10 of the Max Conns
-
- IF %CONNS_IN_USE%>=%CONNS_MAX%-=10
- WRITE %DAY_OF_WEEK%, %MONTH_NAME% %DAY% at %HOUR%:%MINUTE%%AM_PM%
- WRITE Conns = %CONNS_IN_USE%
- WRITE Clearing the NOT_LOGGED_IN connections to free slots!
- WRITE
-
-
- // If SUPERVISOR is logged in send a 25th line message
-
- IF LOGGED_IN SUPERVISOR
- SEND "Conns reaching Max - Clearing NOT_LOGGED_IN conns!" TO SUPERVISOR
- ENDIF
-
-
- // Call NLICLEAR.TSK which clears all NOT-LOGGED-IN connections
-
- CALL NLICLEAR.TSK
-
- ENDIF
-
-
- // Check if the CPU Utilization is above an acceptable level.
- // If so, various actions can be taken, including unloading NLMs.
-
- IF %CPU_UTIL%>075
-
- // First, we will call another .TSK to takes snapshots of processor util.
-
- CALL PROCUTIL.TSK
-
-
- WRITE %DAY_OF_WEEK%, %MONTH_NAME% %DAY% at %HOUR%:%MINUTE%%AM_PM%
- WRITE CPU Utilization = %CONNS_IN_USE%
- WRITE Unloading non-critical NLMs to see if that helps!
- WRITE
-
-
- // If SUPERVISOR is logged in send a 25th line message
-
- IF LOGGED_IN SUPERVISOR
- SEND "CPU Util @ %CPU_UTIL%5 - Unloading some NLMs!" TO SUPERVISOR
- ENDIF
-
-
- // At this point, you could unload some non-critical NLMs.
-
- IF LOADED DUMMY.NLM
- // UNLOAD DUMMY
- ENDIF
-
- ENDIF
-
-
- // Check if the allocated Packet Receive Buffers are within 10 of Max
-
- IF %RECV_BUFFS_IN_USE%+=10>=%RECV_BUFFS_MAX%
- WRITE %DAY_OF_WEEK%, %MONTH_NAME% %DAY% at %HOUR%:%MINUTE%%AM_PM%
- WRITE Recv Buffs = %RECV_BUFFS_IN_USE%, Max Recv Buffs = %RECV_BUFFS_MAX%
- WRITE Increasing the Maximum Packet Receive Buffers SET parameter by 10
- WRITE
-
-
- // If SUPERVISOR is logged in send a 25th line message
-
- IF LOGGED_IN SUPERVISOR
- SEND "Low on Recv Buffs, increased Max by 10" TO SUPERVISOR
- ENDIF
-
-
- // The following uses the standard console SET command with the
- // substitution of the current Max level increased by 10.
-
- SET MAXIMUM PACKET RECEIVE BUFFERS = %RECV_BUFFS_MAX%+=10
-
- // The following uses a standard console command to reset the
- // routing information used by the server. On occasion, routing
- // packets can be the cause of receive buffer congestion.
-
- RESET ROUTER
-
- ENDIF
-
-
- // Check SYS: volume to see if we need to off-load files to free space
-
- CD SYS:\
-
- IF %VOL_FREE%<=005
- WRITE %DAY_OF_WEEK%, %MONTH_NAME% %DAY% at %HOUR%:%MINUTE%%AM_PM%
- WRITE Volume: %VOL_NAME% at %VOL_USED%% of capacity
- WRITE Off-loading non-critical files to BACKUP: volume
- WRITE
-
-
- // Send every attached user the following message
-
- BROADCAST "SYS: is low on space - Be sure to back up your work"
-
-
- // Check if BACKUP: is mounted - If not, MOUNT BACKUP:
-
- IF NOT MOUNTED BACKUP:
- MOUNT BACKUP:
- ENDIF
-
-
- // Open the argument file containing the source and dest name
- // of each file which can be moved in an emergency.
- // Example: SYS:\DATABASE\DATAFILE.BAK BACKUP:\DATABASE\DATAFILE.BAK
-
- IF EXIST SYS:SYSTEM\MOVEFILE.DAT
- OPEN_READ SYS:SYSTEM\NON_CRIT.DAT
-
- WHILE
-
- // If there is a read error, such as an End-Of-File, break
- // out of this WHILE/LOOP
-
- READ %0
- IF ERRORLEVEL THEN BREAK
-
-
- // The following line takes advantage of a unique aspect in
- // EXIST - that it only searches for the first specification.
- // Therefore, even though two files are part of the %0 variable
- // record read from MOVEFILE.DAT, only the first file name is
- // checked for existence.
-
- // If the first file exists then the COPY command is executed
-
- IF EXIST %0 THEN COPY %0
-
-
- // If the COPY succeeds then DELETE the first file specification
- // Again, the logic depends upon a unique aspect of the DELETE
- // command in that it will only DELETE the first file name.
- IF NOT ERRORLEVEL THEN DELETE %0
-
- LOOP
- ENDIF
- ENDIF
-
-
- // CLOSE any open files before exiting (not required, just proper cleanup).
-
- CLOSE
-