home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / timevent / taskmstr / syscheck.tsk < prev    next >
Encoding:
Text File  |  1995-05-07  |  4.3 KB  |  161 lines

  1. /////////////////////////////////////////////////////////////////////////
  2. // This task can be launched periodically or as a result of being spawned
  3. // by some other network management product.
  4. /////////////////////////////////////////////////////////////////////////
  5.  
  6.  
  7. // First, let's open a file to log anything we find into.
  8.  
  9. OPEN_WRITE SYS:SYSTEM\ALERT.LOG
  10.  
  11.  
  12. // Check if the current Conns In Use are within 10 of the Max Conns
  13.  
  14. IF %CONNS_IN_USE%>=%CONNS_MAX%-=10
  15.   WRITE %DAY_OF_WEEK%, %MONTH_NAME% %DAY% at %HOUR%:%MINUTE%%AM_PM%
  16.   WRITE Conns = %CONNS_IN_USE%
  17.   WRITE Clearing the NOT_LOGGED_IN connections to free slots!
  18.   WRITE
  19.  
  20.  
  21.   // If SUPERVISOR is logged in send a 25th line message
  22.  
  23.   IF LOGGED_IN SUPERVISOR
  24.     SEND "Conns reaching Max - Clearing NOT_LOGGED_IN conns!" TO SUPERVISOR
  25.   ENDIF
  26.  
  27.  
  28.   // Call NLICLEAR.TSK which clears all NOT-LOGGED-IN connections
  29.  
  30.   CALL NLICLEAR.TSK
  31.  
  32. ENDIF
  33.  
  34.  
  35. // Check if the CPU Utilization is above an acceptable level.
  36. // If so, various actions can be taken, including unloading NLMs.
  37.  
  38. IF %CPU_UTIL%>075
  39.  
  40.   // First, we will call another .TSK to takes snapshots of processor util.
  41.  
  42.   CALL PROCUTIL.TSK
  43.  
  44.  
  45.   WRITE %DAY_OF_WEEK%, %MONTH_NAME% %DAY% at %HOUR%:%MINUTE%%AM_PM%
  46.   WRITE CPU Utilization = %CONNS_IN_USE%
  47.   WRITE Unloading non-critical NLMs to see if that helps!
  48.   WRITE
  49.  
  50.  
  51.   // If SUPERVISOR is logged in send a 25th line message
  52.  
  53.   IF LOGGED_IN SUPERVISOR
  54.     SEND "CPU Util @ %CPU_UTIL%5 - Unloading some NLMs!" TO SUPERVISOR
  55.   ENDIF
  56.  
  57.  
  58.   // At this point, you could unload some non-critical NLMs.
  59.  
  60.   IF LOADED DUMMY.NLM
  61.     // UNLOAD DUMMY
  62.   ENDIF
  63.  
  64. ENDIF
  65.  
  66.  
  67. // Check if the allocated Packet Receive Buffers are within 10 of Max
  68.  
  69. IF %RECV_BUFFS_IN_USE%+=10>=%RECV_BUFFS_MAX%
  70.   WRITE %DAY_OF_WEEK%, %MONTH_NAME% %DAY% at %HOUR%:%MINUTE%%AM_PM%
  71.   WRITE Recv Buffs = %RECV_BUFFS_IN_USE%, Max Recv Buffs = %RECV_BUFFS_MAX%
  72.   WRITE Increasing the Maximum Packet Receive Buffers SET parameter by 10
  73.   WRITE
  74.  
  75.  
  76.   // If SUPERVISOR is logged in send a 25th line message
  77.  
  78.   IF LOGGED_IN SUPERVISOR
  79.     SEND "Low on Recv Buffs, increased Max by 10" TO SUPERVISOR
  80.   ENDIF
  81.  
  82.  
  83.   // The following uses the standard console SET command with the
  84.   // substitution of the current Max level increased by 10.
  85.  
  86.   SET MAXIMUM PACKET RECEIVE BUFFERS = %RECV_BUFFS_MAX%+=10
  87.  
  88.   // The following uses a standard console command to reset the
  89.   // routing information used by the server.  On occasion, routing
  90.   // packets can be the cause of receive buffer congestion.
  91.  
  92.   RESET ROUTER
  93.  
  94. ENDIF
  95.  
  96.  
  97. // Check SYS: volume to see if we need to off-load files to free space
  98.  
  99. CD SYS:\
  100.  
  101. IF %VOL_FREE%<=005
  102.   WRITE %DAY_OF_WEEK%, %MONTH_NAME% %DAY% at %HOUR%:%MINUTE%%AM_PM%
  103.   WRITE Volume: %VOL_NAME% at %VOL_USED%% of capacity
  104.   WRITE Off-loading non-critical files to BACKUP: volume
  105.   WRITE
  106.  
  107.  
  108.   // Send every attached user the following message
  109.  
  110.   BROADCAST "SYS: is low on space - Be sure to back up your work"
  111.  
  112.  
  113.   // Check if BACKUP: is mounted - If not, MOUNT BACKUP:
  114.  
  115.   IF NOT MOUNTED BACKUP:
  116.     MOUNT BACKUP:
  117.   ENDIF
  118.  
  119.  
  120.   // Open the argument file containing the source and dest name
  121.   // of each file which can be moved in an emergency.
  122.   // Example:  SYS:\DATABASE\DATAFILE.BAK BACKUP:\DATABASE\DATAFILE.BAK
  123.  
  124.   IF EXIST SYS:SYSTEM\MOVEFILE.DAT
  125.     OPEN_READ SYS:SYSTEM\NON_CRIT.DAT
  126.  
  127.     WHILE
  128.  
  129.       // If there is a read error, such as an End-Of-File, break
  130.       // out of this WHILE/LOOP
  131.  
  132.       READ %0
  133.       IF ERRORLEVEL THEN BREAK
  134.  
  135.  
  136.       // The following line takes advantage of a unique aspect in
  137.       // EXIST - that it only searches for the first specification.
  138.       // Therefore, even though two files are part of the %0 variable
  139.       // record read from MOVEFILE.DAT, only the first file name is
  140.       // checked for existence.
  141.  
  142.       // If the first file exists then the COPY command is executed
  143.  
  144.       IF EXIST %0 THEN COPY %0
  145.  
  146.  
  147.       // If the COPY succeeds then DELETE the first file specification
  148.       // Again, the logic depends upon a unique aspect of the DELETE
  149.       // command in that it will only DELETE the first file name.
  150.       IF NOT ERRORLEVEL THEN DELETE %0
  151.  
  152.     LOOP
  153.   ENDIF
  154. ENDIF
  155.  
  156.  
  157. // CLOSE any open files before exiting (not required, just proper cleanup).
  158.  
  159. CLOSE
  160.  
  161.