source: FOIAVistA/trunk/r/CAPACITY_MANAGEMENT_RUM-KMPR/KMPRSSA.m@ 808

Last change on this file since 808 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 6.6 KB
Line 
1KMPRSSA ;OAK/RAK - Resource Usage Monitor Status ;11/19/04 10:32
2 ;;2.0;CAPACITY MANAGEMENT - RUM;**1**;May 28, 2003
3 ;
4FORMAT(KMPRLN) ;-format text for dislay
5 ;-----------------------------------------------------------------------------
6 ; KMPRLN.... return number of lines - called by reference
7 ;-----------------------------------------------------------------------------
8 ;
9 N CHECK,LN,VERSION S LN=0 K TMP
10 ;
11 ; check environment
12 ;D ENVCHECK^KMPRUTL1(.CHECK,1)
13 ; if RUM turned on but background job not queued ask user if they want
14 ; to queue it at this time.
15 ;D:(+CHECK)=200 ENVCHECK^KMPRUTL1(.CHECK)
16 ;
17 ; if no kmprutl routine
18 S X="KMPRUTL" X ^%ZOSF("TEST") I '$T D Q
19 .D SET^VALM10(LN,"The CAPACITY MANAGEMENT - RUM package is not installed!")
20 .S LN=LN+1
21 ;
22 W !," formatting..."
23 W "."
24 ; option data
25 D OPT
26 W "."
27 ; bacground data
28 D BKGRND
29 W "."
30 ; file data
31 D FILES
32 W "."
33 ; routine version check
34 D ROUCHK("R")
35 W "."
36 ; node/cpu data
37 D CPU
38 W "."
39 ; legend
40 D LEGEND
41 ;
42 S KMPRLN=LN-1
43 ;
44 Q
45 ;
46BKGRND ; hl7 background info
47 ;
48 N DATA,DELTA,ENDT,I,STAT,STDT,Z
49 ;
50 D SET^VALM10(LN," Temporary collection global..")
51 S LN=LN+1
52 D SET^VALM10(LN," ^KMPTMP(""KMPR"").............. "_$S('$D(^KMPTMP("KMPR")):"NOT ",1:"")_"Present")
53 S LN=LN+1
54 D SET^VALM10(LN,"")
55 S LN=LN+1
56 ;
57 D PARAMS^KMPDUT("DATA") Q:'$D(DATA)
58 S DATA(2)=$G(DATA(2))
59 S STDT=$P(DATA(2),U,5),ENDT=$P(DATA(2),U,6),DELTA=$P(DATA(2),U,7)
60 S:$E(DELTA)=" " $E(DELTA)="0"
61 D SET^VALM10(LN,"")
62 S LN=LN+1
63 D SET^VALM10(LN," RUM Dly Bckgrnd Last Start... "_$$FMTE^XLFDT(STDT))
64 S LN=LN+1
65 D SET^VALM10(LN," RUM Dly Bckgrnd Last Stop.... "_$$FMTE^XLFDT(ENDT))
66 S LN=LN+1
67 D SET^VALM10(LN," RUM Dly Bkgrnd Total Time.... "_DELTA)
68 S LN=LN+1
69 D SET^VALM10(LN,"")
70 S LN=LN+1
71 S STDT=$P(DATA(2),U,8),ENDT=$P(DATA(2),U,9),DELTA=$P(DATA(2),U,10)
72 S:$E(DELTA)=" " $E(DELTA)="0"
73 D SET^VALM10(LN," RUM Wkly Backgrnd Last Start. "_$$FMTE^XLFDT(STDT))
74 S LN=LN+1
75 D SET^VALM10(LN," RUM Wkly Bckgrnd Last Stop... "_$$FMTE^XLFDT(ENDT))
76 S LN=LN+1
77 D SET^VALM10(LN," RUM Wkly Bckgrnd Total Time.. "_DELTA)
78 S LN=LN+1
79 D SET^VALM10(LN," RUM Purge Data After......... "_$P(DATA(2),U,11)_" weeks")
80 S LN=LN+1
81 D TRANSTO^KMPDUTL7(1,2,.Z)
82 I '$D(Z) D SET^VALM10(LN," RUM Transmit Data to......... <>") S LN=LN+1
83 E D
84 .S I=$O(Z("")) D:I'="" SET^VALM10(LN," RUM Transmit Data to......... "_I) S LN=LN+1
85 .F S I=$O(Z(I)) Q:I="" D SET^VALM10(LN,$J(" ",33)_I) S LN=LN+1
86 D SET^VALM10(LN,"")
87 S LN=LN+1
88 ;
89 Q
90 ;
91CPU ;-- cpu/node data
92 ;
93 N COUNT,DATA,I,LEN,TEXT
94 ;
95 D CPUGET^KMPDUTL6(.DATA)
96 Q:'$D(DATA)
97 D SET^VALM10(LN,"")
98 S LN=LN+1
99 S TEXT=" Node/CPU Data............... "
100 S (COUNT,I,LEN)=0
101 F S I=$O(DATA(I)) Q:'I D
102 .S COUNT=COUNT+1,DATA=$G(DATA(I,0)) Q:DATA=""
103 .; length of node name
104 .S:'LEN LEN=$L($P(DATA,U))+2
105 .S TEXT=$S(COUNT=1:TEXT,1:$J(" ",32))_$P(DATA,U)
106 .S TEXT=TEXT_$J(" ",30-$L(TEXT)+LEN)_$P(DATA,U,2)_" ("_$P(DATA,U,3)_")"
107 .D SET^VALM10(LN,TEXT)
108 .S LN=LN+1
109 ;
110 Q
111 ;
112LEGEND ;-- display legend
113 ;
114 D SET^VALM10(LN,"")
115 S LN=LN+1
116 D SET^VALM10(LN,"")
117 S LN=LN+1
118 D SET^VALM10(LN," RUM = Resource Usage Monitor")
119 S LN=LN+1
120 ;
121 Q
122 ;
123OPT ;-- option data
124 ;
125 ; daily/weekly background job info
126 N DIR,KMPRX,KMPRX1,TEXT,X,Y
127 ;
128 ; if background option is missing
129 I '$O(^DIC(19,"B","KMPR BACKGROUND DRIVER",0)) D
130 .D SET^VALM10(LN," The 'RUM Background Driver' option [KMPR BACKGROUND DRIVER] is missing!")
131 .S LN=LN+1
132 ; background option is present
133 E D
134 .S KMPRX=+$O(^DIC(19,"B","KMPR BACKGROUND DRIVER",0))
135 .S KMPRX=+$O(^DIC(19.2,"B",KMPRX,0))
136 .; if not scheduled or no task id
137 .I 'KMPRX!('$G(^DIC(19.2,+KMPRX,1))) D Q:'Y
138 ..K DIR S DIR(0)="YO",DIR("B")="YES"
139 ..S DIR("A")="Do you want to queue this option to run each night at 1am"
140 ..W ! D ^DIR I 'Y D Q
141 ...D SET^VALM10(LN," The 'RUM Background Driver' [KMPR BACKGROUND DRIVER] is not scheduled")
142 ...S LN=LN+1
143 ...D SET^VALM10(LN," to run!"),SET^VALM10(LN,"")
144 ...S LN=LN+1
145 ..D QUEBKG^KMPRUTL1
146 .S KMPRX=+$O(^DIC(19,"B","KMPR BACKGROUND DRIVER",0))
147 .S KMPRX=+$O(^DIC(19.2,"B",KMPRX,0))
148 .S KMPRX=$G(^DIC(19.2,KMPRX,0)),KMPRX1=$G(^(1))
149 .S $P(KMPRX,U,2)=$$FMTE^XLFDT($P(KMPRX,U,2))
150 .D SET^VALM10(LN," RUM Background Driver........ KMPR BACKGROUND DRIVER")
151 .S LN=LN+1
152 .D SET^VALM10(LN," QUEUED TO RUN AT............. "_$P(KMPRX,U,2))
153 .S LN=LN+1
154 .D SET^VALM10(LN," RESCHEDULING FREQUENCY....... "_$P(KMPRX,U,6))
155 .S LN=LN+1
156 .D SET^VALM10(LN," TASK ID...................... "_+KMPRX1)
157 .S LN=LN+1
158 .; user info.
159 .S KMPRX1=$G(^%ZTSK(+KMPRX1,0))
160 .S TEXT=" QUEUED BY.................... "_$P($G(^VA(200,+$P(KMPRX1,U,3),0)),U)
161 .; if user
162 .I (+$P(KMPRX1,U,3)) D
163 ..; user 'active' or 'terminated'
164 ..S KMPRX1=$$ACTIVE^XUSER(+$P(KMPRX1,U,3))
165 ..S TEXT=TEXT_" ("_$S($P(KMPRX1,U,2)["TERMINATED":"Terminated - "_$$FMTE^XLFDT($P(KMPRX1,U,3),2),1:"Active")_")"
166 .D SET^VALM10(LN,TEXT)
167 .S LN=LN+1
168 D SET^VALM10(LN,"")
169 S LN=LN+1
170 ;
171 Q
172 ;
173 ;
174FILES ;-- file data
175 ;
176 N TEXT,X
177 ;
178 D SET^VALM10(LN,$J(" ",35)_" # of Oldest Recent")
179 S LN=LN+1
180 D SET^VALM10(LN," File"_$J(" ",28)_"Entries Date Date")
181 S LN=LN+1
182 D SET^VALM10(LN," ------------------------- ------- ------- -------")
183 S LN=LN+1
184 ; file name
185 S TEXT=" 8971.1-"_$P($G(^DIC(8971.1,0)),U)
186 ; number of entries
187 S TEXT=TEXT_$J(" ",35-$L(TEXT))_$J($FN($P($G(^KMPR(8971.1,0)),U,4),",",0),7)
188 ; oldest date
189 S X=$$FMTE^XLFDT(+$O(^KMPR(8971.1,"B",0)),2)
190 S X=$S(X=0:"---",1:X)
191 S TEXT=TEXT_$J(" ",45-$L(TEXT))_X
192 ; current date
193 S X=$$FMTE^XLFDT(+$O(^KMPR(8971.1,"B","A"),-1),2)
194 S X=$S(X=0:"---",1:X)
195 S TEXT=TEXT_$J(" ",55-$L(TEXT))_X
196 D SET^VALM10(LN,TEXT)
197 S LN=LN+1
198 ;
199 Q
200 ;
201ROUCHK(KMPDPKG) ;--display routine version info
202 ;-----------------------------------------------------------------------
203 ; KMPDPKG... CM Package:
204 ; "D" - CM Tools
205 ; "R" - RUM
206 ; "S" - SAGG
207 ;-----------------------------------------------------------------------
208 ;
209 Q:$G(KMPDPKG)=""
210 Q:KMPDPKG'="D"&(KMPDPKG'="R")&(KMPDPKG'="S")
211 ;
212 N I,TEXT,X
213 ;
214 ; routine check
215 D VERPTCH^KMPDUTL1(KMPDPKG,.X)
216 D SET^VALM10(LN,"")
217 S LN=LN+1
218 D SET^VALM10(LN,"")
219 S LN=LN+1
220 S TEXT=" "_$S(KMPDPKG="D":"CM TOOLS",KMPDPKG="R":"RUM",1:"SAGG")_" routines"
221 S TEXT=TEXT_$$REPEAT^XLFSTR(".",31-$L(TEXT))_" "
222 I '$P($G(X(0)),U,3) D SET^VALM10(LN,TEXT_+X(0)_" Routines - No Problems") S LN=LN+1 Q
223 D SET^VALM10(LN,TEXT)
224 S LN=LN+1
225 D SET^VALM10(LN,$J(" ",20)_"Current Version"_$J(" ",20)_"Should be")
226 S LN=LN+1
227 S I=0 F S I=$O(X(I)) Q:I="" I $P(X(I),U) D
228 .S TEXT=" "_I
229 .S TEXT=TEXT_$J(" ",20-$L(TEXT))_$P(X(I),U,4)
230 .S:$P(X(I),U,5)]"" TEXT=TEXT_" - "_$P(X(I),U,5)
231 .S TEXT=TEXT_$J(" ",55-$L(TEXT))_$P(X(I),U,2)
232 .S:$P(X(I),U,3)]"" TEXT=TEXT_" - "_$P(X(I),U,3)
233 .D SET^VALM10(LN,TEXT)
234 .S LN=LN+1
235 ;
236 Q
Note: See TracBrowser for help on using the repository browser.