Merge lp:~jontai/openvista-gtm-integration/bug701554 into lp:openvista-gtm-integration

Proposed by Derek_
Status: Needs review
Proposed branch: lp:~jontai/openvista-gtm-integration/bug701554
Merge into: lp:openvista-gtm-integration
Diff against target: 636 lines (+603/-7)
2 files modified
kids/XU_80_1510.KID (+556/-0)
mumps/MSCZJOBS.m (+47/-7)
To merge this branch: bzr merge lp:~jontai/openvista-gtm-integration/bug701554
Reviewer Review Type Date Requested Status
jeff.apple Approve
Review via email: mp+54723@code.launchpad.net
To post a comment you must log in.
Revision history for this message
jeff.apple (jeff-apple) wrote :

I haven't tested this, but it seems just fine.

review: Approve

Unmerged revisions

150. By Jon Tai

add patch number to second line of routine

149. By Jon Tai

add KIDS build with updated MSCZJOBS routine

148. By Jon Tai

refactor the netstat call so it's in its own subroutine and will only be called once per call of %SS

147. By Jon Tai

first pass at calling netstat to get the local port number

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'kids/XU_80_1510.KID'
--- kids/XU_80_1510.KID 1970-01-01 00:00:00 +0000
+++ kids/XU_80_1510.KID 2011-03-24 16:18:29 +0000
@@ -0,0 +1,556 @@
1KIDS Distribution saved on Jan 11, 2011@11:23:04
2artf10950 - %SS port number fix
3**KIDS**:XU*8.0*1510^
4
5**INSTALL NAME**
6XU*8.0*1510
7"BLD",7341,0)
8XU*8.0*1510^KERNEL^0^3110111^n
9"BLD",7341,4,0)
10^9.64PA^^
11"BLD",7341,6.3)
122
13"BLD",7341,"ABPKG")
14n
15"BLD",7341,"KRN",0)
16^9.67PA^8989.52^19
17"BLD",7341,"KRN",.4,0)
18.4
19"BLD",7341,"KRN",.401,0)
20.401
21"BLD",7341,"KRN",.402,0)
22.402
23"BLD",7341,"KRN",.403,0)
24.403
25"BLD",7341,"KRN",.5,0)
26.5
27"BLD",7341,"KRN",.84,0)
28.84
29"BLD",7341,"KRN",3.6,0)
303.6
31"BLD",7341,"KRN",3.8,0)
323.8
33"BLD",7341,"KRN",9.2,0)
349.2
35"BLD",7341,"KRN",9.8,0)
369.8
37"BLD",7341,"KRN",9.8,"NM",0)
38^9.68A^1^1
39"BLD",7341,"KRN",9.8,"NM",1,0)
40MSCZJOBS^^0^B46514052
41"BLD",7341,"KRN",9.8,"NM","B","MSCZJOBS",1)
42
43"BLD",7341,"KRN",19,0)
4419
45"BLD",7341,"KRN",19.1,0)
4619.1
47"BLD",7341,"KRN",101,0)
48101
49"BLD",7341,"KRN",409.61,0)
50409.61
51"BLD",7341,"KRN",771,0)
52771
53"BLD",7341,"KRN",870,0)
54870
55"BLD",7341,"KRN",8989.51,0)
568989.51
57"BLD",7341,"KRN",8989.52,0)
588989.52
59"BLD",7341,"KRN",8994,0)
608994
61"BLD",7341,"KRN","B",.4,.4)
62
63"BLD",7341,"KRN","B",.401,.401)
64
65"BLD",7341,"KRN","B",.402,.402)
66
67"BLD",7341,"KRN","B",.403,.403)
68
69"BLD",7341,"KRN","B",.5,.5)
70
71"BLD",7341,"KRN","B",.84,.84)
72
73"BLD",7341,"KRN","B",3.6,3.6)
74
75"BLD",7341,"KRN","B",3.8,3.8)
76
77"BLD",7341,"KRN","B",9.2,9.2)
78
79"BLD",7341,"KRN","B",9.8,9.8)
80
81"BLD",7341,"KRN","B",19,19)
82
83"BLD",7341,"KRN","B",19.1,19.1)
84
85"BLD",7341,"KRN","B",101,101)
86
87"BLD",7341,"KRN","B",409.61,409.61)
88
89"BLD",7341,"KRN","B",771,771)
90
91"BLD",7341,"KRN","B",870,870)
92
93"BLD",7341,"KRN","B",8989.51,8989.51)
94
95"BLD",7341,"KRN","B",8989.52,8989.52)
96
97"BLD",7341,"KRN","B",8994,8994)
98
99"BLD",7341,"MSC")
100/home/jon/XU_80_1510.KID
101"BLD",7341,"MSCOM")
102artf10950 - %SS port number fix
103"BLD",7341,"QUES",0)
104^9.62^^
105"MBREQ")
1060
107"PKG",3,-1)
1081^1
109"PKG",3,0)
110KERNEL^XU^SIGN-ON, SECURITY, MENU DRIVER, DEVICES, TASKMAN^
111"PKG",3,20,0)
112^9.402P^^
113"PKG",3,22,0)
114^9.49I^1^1
115"PKG",3,22,1,0)
1168.0^3040115^2960606^1
117"PKG",3,22,1,"PAH",1,0)
1181510^3110111
119"QUES","XPF1",0)
120Y
121"QUES","XPF1","??")
122^D REP^XPDH
123"QUES","XPF1","A")
124Shall I write over your |FLAG| File
125"QUES","XPF1","B")
126YES
127"QUES","XPF1","M")
128D XPF1^XPDIQ
129"QUES","XPF2",0)
130Y
131"QUES","XPF2","??")
132^D DTA^XPDH
133"QUES","XPF2","A")
134Want my data |FLAG| yours
135"QUES","XPF2","B")
136YES
137"QUES","XPF2","M")
138D XPF2^XPDIQ
139"QUES","XPI1",0)
140YO
141"QUES","XPI1","??")
142^D INHIBIT^XPDH
143"QUES","XPI1","A")
144Want KIDS to INHIBIT LOGONs during the install
145"QUES","XPI1","B")
146NO
147"QUES","XPI1","M")
148D XPI1^XPDIQ
149"QUES","XPM1",0)
150PO^VA(200,:EM
151"QUES","XPM1","??")
152^D MG^XPDH
153"QUES","XPM1","A")
154Enter the Coordinator for Mail Group '|FLAG|'
155"QUES","XPM1","B")
156
157"QUES","XPM1","M")
158D XPM1^XPDIQ
159"QUES","XPO1",0)
160Y
161"QUES","XPO1","??")
162^D MENU^XPDH
163"QUES","XPO1","A")
164Want KIDS to Rebuild Menu Trees Upon Completion of Install
165"QUES","XPO1","B")
166NO
167"QUES","XPO1","M")
168D XPO1^XPDIQ
169"QUES","XPZ1",0)
170Y
171"QUES","XPZ1","??")
172^D OPT^XPDH
173"QUES","XPZ1","A")
174Want to DISABLE Scheduled Options, Menu Options, and Protocols
175"QUES","XPZ1","B")
176NO
177"QUES","XPZ1","M")
178D XPZ1^XPDIQ
179"QUES","XPZ2",0)
180Y
181"QUES","XPZ2","??")
182^D RTN^XPDH
183"QUES","XPZ2","A")
184Want to MOVE routines to other CPUs
185"QUES","XPZ2","B")
186NO
187"QUES","XPZ2","M")
188D XPZ2^XPDIQ
189"RTN")
1901
191"RTN","MSCZJOBS")
1920^1^B46514052
193"RTN","MSCZJOBS",1,0)
194MSCZJOBS ;JKT/MSC ;OpenVista System status; 11 JAN 2011 - 1122
195"RTN","MSCZJOBS",2,0)
196 ;;8.0;KERNEL;**1501,1510**;5/20/2009
197"RTN","MSCZJOBS",3,0)
198 ;
199"RTN","MSCZJOBS",4,0)
200ALL D SS() Q
201"RTN","MSCZJOBS",5,0)
202THIS N FILTERS S FILTERS(1)="I^"_$$CURRENT^ZCD() D SS(.FILTERS) Q
203"RTN","MSCZJOBS",6,0)
204 ;
205"RTN","MSCZJOBS",7,0)
206INT ;Interactive -- ask for filters, then do SS in a loop
207"RTN","MSCZJOBS",8,0)
208 N FILTERS,QUIT S FILTERS=0,QUIT=0
209"RTN","MSCZJOBS",9,0)
210 F D Q:QUIT
211"RTN","MSCZJOBS",10,0)
212 . N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,U
213"RTN","MSCZJOBS",11,0)
214 . S DIR(0)="SAO^J:PID/$J;P:PORT NUMBER;I:INSTANCE NAME;R:RUNNING ROUTINE;Z:ZLINKED ROUTINE;U:USER;D:IDENTITY"
215"RTN","MSCZJOBS",12,0)
216 . S DIR("A")="Select FILTER: "
217"RTN","MSCZJOBS",13,0)
218 . S DIR("?")="Optionally select criteria to filter processes by."
219"RTN","MSCZJOBS",14,0)
220 . D ^DIR
221"RTN","MSCZJOBS",15,0)
222 . I $G(DTOUT)!$G(DUOUT) S QUIT=2 Q ; exit program
223"RTN","MSCZJOBS",16,0)
224 . I (Y="") S QUIT=1 Q ; exit loop
225"RTN","MSCZJOBS",17,0)
226 . N FILTER S FILTER=Y
227"RTN","MSCZJOBS",18,0)
228 . ;
229"RTN","MSCZJOBS",19,0)
230 . N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,U
231"RTN","MSCZJOBS",20,0)
232 . D:FILTER="J"
233"RTN","MSCZJOBS",21,0)
234 . . S DIR(0)="NAO"
235"RTN","MSCZJOBS",22,0)
236 . . S DIR("A")=" PID/$J: "
237"RTN","MSCZJOBS",23,0)
238 . . S DIR("?")="If a numeric process ID ($J) is entered here, only processes with that process ID will be displayed."
239"RTN","MSCZJOBS",24,0)
240 . D:FILTER="P"
241"RTN","MSCZJOBS",25,0)
242 . . S DIR(0)="NAO"
243"RTN","MSCZJOBS",26,0)
244 . . S DIR("A")=" PORT NUMBER: "
245"RTN","MSCZJOBS",27,0)
246 . . S DIR("?")="If a numeric port number is entered here, only processes listening on that port or connected to that port will be displayed."
247"RTN","MSCZJOBS",28,0)
248 . D:FILTER="I"
249"RTN","MSCZJOBS",29,0)
250 . . S DIR(0)="FOU"
251"RTN","MSCZJOBS",30,0)
252 . . S DIR("A")=" INSTANCE NAME"
253"RTN","MSCZJOBS",31,0)
254 . . S DIR("?")="If an instance name is entered here, only processes running in that instance will be displayed."
255"RTN","MSCZJOBS",32,0)
256 . D:FILTER="R"
257"RTN","MSCZJOBS",33,0)
258 . . S DIR(0)="FOU"
259"RTN","MSCZJOBS",34,0)
260 . . S DIR("A")=" RUNNING ROUTINE"
261"RTN","MSCZJOBS",35,0)
262 . . S DIR("?")="If a routine name is entered here, only processes running that routine will be displayed."
263"RTN","MSCZJOBS",36,0)
264 . D:FILTER="Z"
265"RTN","MSCZJOBS",37,0)
266 . . S DIR(0)="FOU"
267"RTN","MSCZJOBS",38,0)
268 . . S DIR("A")=" ZLINKED ROUTINE"
269"RTN","MSCZJOBS",39,0)
270 . . S DIR("?")="If a routine name is entered here, only processes that have previously loaded (ZLINK'd) that routine will be displayed."
271"RTN","MSCZJOBS",40,0)
272 . D:FILTER="U"
273"RTN","MSCZJOBS",41,0)
274 . . S DIR(0)="FOU"
275"RTN","MSCZJOBS",42,0)
276 . . S DIR("A")=" USER"
277"RTN","MSCZJOBS",43,0)
278 . . S DIR("?")="If a Linux username is entered here, only processes that are running under that user will be displayed."
279"RTN","MSCZJOBS",44,0)
280 . D:FILTER="D"
281"RTN","MSCZJOBS",45,0)
282 . . S DIR(0)="FOU"
283"RTN","MSCZJOBS",46,0)
284 . . S DIR("A")=" IDENTITY"
285"RTN","MSCZJOBS",47,0)
286 . . S DIR("?")="If an OpenVista user's name is entered here, only processes that are running under that user will be displayed."
287"RTN","MSCZJOBS",48,0)
288 . D ^DIR Q:$G(DTOUT)!$G(DUOUT)!(Y="")
289"RTN","MSCZJOBS",49,0)
290 . S FILTERS($I(FILTERS))=FILTER_"^"_Y
291"RTN","MSCZJOBS",50,0)
292 Q:QUIT=2
293"RTN","MSCZJOBS",51,0)
294 ;
295"RTN","MSCZJOBS",52,0)
296 N QUIT S QUIT=0
297"RTN","MSCZJOBS",53,0)
298 F D Q:QUIT
299"RTN","MSCZJOBS",54,0)
300 . D SS(.FILTERS)
301"RTN","MSCZJOBS",55,0)
302 . N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,U
303"RTN","MSCZJOBS",56,0)
304 . S DIR(0)="SA^U:UPDATE;Q:QUIT"
305"RTN","MSCZJOBS",57,0)
306 . S DIR("A")="Action: "
307"RTN","MSCZJOBS",58,0)
308 . S DIR("B")="UPDATE"
309"RTN","MSCZJOBS",59,0)
310 . D ^DIR
311"RTN","MSCZJOBS",60,0)
312 . I Y'="U" S QUIT=1 Q
313"RTN","MSCZJOBS",61,0)
314 Q
315"RTN","MSCZJOBS",62,0)
316 ;
317"RTN","MSCZJOBS",63,0)
318SS(FILTERS) ;Print GT.M mumps processes
319"RTN","MSCZJOBS",64,0)
320 ;
321"RTN","MSCZJOBS",65,0)
322 Q:$G(^%ZOSF("OS"))'["GT.M"
323"RTN","MSCZJOBS",66,0)
324 ;
325"RTN","MSCZJOBS",67,0)
326 D INTRPT^MSCZJOBU("*") H .5
327"RTN","MSCZJOBS",68,0)
328 ;
329"RTN","MSCZJOBS",69,0)
330 N DATETIME S DATETIME=$$HTE^XLFDT($H)
331"RTN","MSCZJOBS",70,0)
332 W #!,?28,"OpenVista System Status"
333"RTN","MSCZJOBS",71,0)
334 W !,?(40-($L(DATETIME)/2)\1),DATETIME
335"RTN","MSCZJOBS",72,0)
336 W !!,?1,"PID/$J",?9,"%CPU",?15,"Device",?32,"Instance",?42,"Routine",?52,"User",?66,"Identity"
337"RTN","MSCZJOBS",73,0)
338 ;
339"RTN","MSCZJOBS",74,0)
340 N MSC S MSC="^TMP(""MSCZJOB1"",$J)" K @MSC
341"RTN","MSCZJOBS",75,0)
342 D JOBEXAM^MSCZJOBU(MSC)
343"RTN","MSCZJOBS",76,0)
344 N NETSTAT S NETSTAT=0
345"RTN","MSCZJOBS",77,0)
346 N PID S PID=""
347"RTN","MSCZJOBS",78,0)
348 F S PID=$O(@MSC@(PID)) Q:PID="" D
349"RTN","MSCZJOBS",79,0)
350 . ; evaluate filters; AND different filter types, but if more than one criteria is given of the same type, use OR
351"RTN","MSCZJOBS",80,0)
352 . N MATCH,TYPE,QUIT S QUIT=0
353"RTN","MSCZJOBS",81,0)
354 . N FILTER S FILTERS="" F S FILTERS=$O(FILTERS(FILTERS)) Q:FILTERS="" S FILTER=FILTERS(FILTERS) D
355"RTN","MSCZJOBS",82,0)
356 . . S TYPE=$P(FILTER,"^")
357"RTN","MSCZJOBS",83,0)
358 . . I '$D(MATCH(TYPE)) S MATCH(TYPE)=0
359"RTN","MSCZJOBS",84,0)
360 . . I TYPE="J" S:PID=$P(FILTER,"^",2) MATCH(TYPE)=1 Q
361"RTN","MSCZJOBS",85,0)
362 . . I TYPE="P" S:$P($$DEVICE(PID),",")=$P(FILTER,"^",2) MATCH(TYPE)=1 Q
363"RTN","MSCZJOBS",86,0)
364 . . I TYPE="I" S:$$INSTANCE(PID)=$P(FILTER,"^",2) MATCH(TYPE)=1 Q
365"RTN","MSCZJOBS",87,0)
366 . . I TYPE="R" S:$$ROUTINE(PID)=$P(FILTER,"^",2) MATCH(TYPE)=1 Q
367"RTN","MSCZJOBS",88,0)
368 . . I TYPE="Z" S:$D(@MSC@(PID,"RTN",$P(FILTER,"^",2))) MATCH(TYPE)=1 Q
369"RTN","MSCZJOBS",89,0)
370 . . I TYPE="U" S:$$USER(PID)=$P(FILTER,"^",2) MATCH(TYPE)=1 Q
371"RTN","MSCZJOBS",90,0)
372 . . I TYPE="D" S:$$IDENT(PID)=$P(FILTER,"^",2) MATCH(TYPE)=1 Q
373"RTN","MSCZJOBS",91,0)
374 . S TYPE="" F S TYPE=$O(MATCH(TYPE)) Q:TYPE="" I 'MATCH(TYPE) S QUIT=1 Q
375"RTN","MSCZJOBS",92,0)
376 . I QUIT Q
377"RTN","MSCZJOBS",93,0)
378 .
379"RTN","MSCZJOBS",94,0)
380 . ; print line of output for this process
381"RTN","MSCZJOBS",95,0)
382 . W !,$$PID(PID)
383"RTN","MSCZJOBS",96,0)
384 . W ?9,$$PCPU(PID)
385"RTN","MSCZJOBS",97,0)
386 . W ?15,$$DEVICE(PID)
387"RTN","MSCZJOBS",98,0)
388 . W ?32,$$INSTANCE(PID)
389"RTN","MSCZJOBS",99,0)
390 . W ?42,$$ROUTINE(PID)
391"RTN","MSCZJOBS",100,0)
392 . W ?52,$$USER(PID)
393"RTN","MSCZJOBS",101,0)
394 . W ?66,$$IDENT(PID)
395"RTN","MSCZJOBS",102,0)
396 K @MSC
397"RTN","MSCZJOBS",103,0)
398 ;
399"RTN","MSCZJOBS",104,0)
400 W !! ZSY "uptime"
401"RTN","MSCZJOBS",105,0)
402 Q
403"RTN","MSCZJOBS",106,0)
404 ;
405"RTN","MSCZJOBS",107,0)
406PID(PID) ;Return process ID formatted for display
407"RTN","MSCZJOBS",108,0)
408 Q $J(PID,7)_$S($J=PID:"*",1:"")
409"RTN","MSCZJOBS",109,0)
410 ;
411"RTN","MSCZJOBS",110,0)
412PCPU(PID) ;Return CPU usage
413"RTN","MSCZJOBS",111,0)
414 Q $J($G(@MSC@(PID,"PCPU")),4)
415"RTN","MSCZJOBS",112,0)
416 ;
417"RTN","MSCZJOBS",113,0)
418DEVICE(PID) ;Return device
419"RTN","MSCZJOBS",114,0)
420 N PRI S PRI=$$FIND(PID,"I","$PRINCIPAL")
421"RTN","MSCZJOBS",115,0)
422 Q:PRI'="0" PRI ; FIXME: this could probably be more general
423"RTN","MSCZJOBS",116,0)
424 ;
425"RTN","MSCZJOBS",117,0)
426 ; look at devices for listening or connected sockets
427"RTN","MSCZJOBS",118,0)
428 N SOCK,DEV S SOCK=$$FIND(PID,"D"," SOCKET[0]"),DEV=""
429"RTN","MSCZJOBS",119,0)
430 I $P(SOCK," ",3)="LISTENING" D
431"RTN","MSCZJOBS",120,0)
432 . S DEV=$$FINDSOCK("PORT")_",LISTENING"
433"RTN","MSCZJOBS",121,0)
434 I $P(SOCK," ",3)="CONNECTED" D
435"RTN","MSCZJOBS",122,0)
436 . N LOCAL S LOCAL=$$FINDSOCK("LOCAL")
437"RTN","MSCZJOBS",123,0)
438 . I LOCAL'="" S DEV=$P(LOCAL,"@",2)_",CONNECTED" Q
439"RTN","MSCZJOBS",124,0)
440 . ;
441"RTN","MSCZJOBS",125,0)
442 . ; If the local port info is not available, we have to look up the
443"RTN","MSCZJOBS",126,0)
444 . ; remote port in netstat to figure out the local port. This happens
445"RTN","MSCZJOBS",127,0)
446 . ; on single listeners (listeners that stop listening once they get a
447"RTN","MSCZJOBS",128,0)
448 . ; connection). See LP #701554.
449"RTN","MSCZJOBS",129,0)
450 . N REMOTE S REMOTE=$TR($$FINDSOCK("REMOTE"),"@",":")
451"RTN","MSCZJOBS",130,0)
452 . D NETSTAT
453"RTN","MSCZJOBS",131,0)
454 . S LOCAL=$G(NETSTAT(REMOTE))
455"RTN","MSCZJOBS",132,0)
456 . I LOCAL'="" S DEV=$P(LOCAL,":",$L(LOCAL,":"))_",CONNECTED" Q
457"RTN","MSCZJOBS",133,0)
458 Q DEV
459"RTN","MSCZJOBS",134,0)
460 ;
461"RTN","MSCZJOBS",135,0)
462FINDSOCK(KEY) ;Find a key in the SOCK line, private to DEVICE()
463"RTN","MSCZJOBS",136,0)
464 Q $P($P(SOCK," "_KEY_"=",2)," ")
465"RTN","MSCZJOBS",137,0)
466 ;
467"RTN","MSCZJOBS",138,0)
468NETSTAT ;Call netstat, private to DEVICE()
469"RTN","MSCZJOBS",139,0)
470 Q:NETSTAT ; if netstat has been run already, don't run it again
471"RTN","MSCZJOBS",140,0)
472 N PIPE,%I,LINE,I,PIECE,LOCAL,REMOTE
473"RTN","MSCZJOBS",141,0)
474 S PIPE="pipe",%I=$I
475"RTN","MSCZJOBS",142,0)
476 O PIPE:(COMMAND="netstat -n -A inet":READONLY)::"PIPE"
477"RTN","MSCZJOBS",143,0)
478 U PIPE
479"RTN","MSCZJOBS",144,0)
480 F R LINE Q:LINE="" D
481"RTN","MSCZJOBS",145,0)
482 . ;
483"RTN","MSCZJOBS",146,0)
484 . ; Iterate over the pieces (delimited by spaces)
485"RTN","MSCZJOBS",147,0)
486 . ; Put the first piece that has a ":" in it into LOCAL
487"RTN","MSCZJOBS",148,0)
488 . ; Put the second piece that has a ":" in it into REMOTE
489"RTN","MSCZJOBS",149,0)
490 . S LOCAL="",REMOTE=""
491"RTN","MSCZJOBS",150,0)
492 . F I=1:1:$L(LINE," ") S PIECE=$P(LINE," ",I) D Q:REMOTE'=""
493"RTN","MSCZJOBS",151,0)
494 . . Q:$P(PIECE,":",2)="" ; no colon, not an address
495"RTN","MSCZJOBS",152,0)
496 . . I LOCAL="" S LOCAL=PIECE Q
497"RTN","MSCZJOBS",153,0)
498 . . I REMOTE="" S REMOTE=PIECE Q
499"RTN","MSCZJOBS",154,0)
500 . ;
501"RTN","MSCZJOBS",155,0)
502 . ; Build a dictionary of remote => local for easy lookup later
503"RTN","MSCZJOBS",156,0)
504 . I REMOTE'="" S NETSTAT(REMOTE)=LOCAL
505"RTN","MSCZJOBS",157,0)
506 U %I
507"RTN","MSCZJOBS",158,0)
508 C PIPE
509"RTN","MSCZJOBS",159,0)
510 S NETSTAT=1 ; set flag to indicate that netstat has been run
511"RTN","MSCZJOBS",160,0)
512 Q
513"RTN","MSCZJOBS",161,0)
514 ;
515"RTN","MSCZJOBS",162,0)
516INSTANCE(PID) ;Return name of OpenVista instance
517"RTN","MSCZJOBS",163,0)
518 N ZG S ZG=$$FIND(PID,"I","$ZGBLDIR")
519"RTN","MSCZJOBS",164,0)
520 Q $P(ZG,"/",$L(ZG,"/")-2)
521"RTN","MSCZJOBS",165,0)
522 ;
523"RTN","MSCZJOBS",166,0)
524ROUTINE(PID) ;Return routine
525"RTN","MSCZJOBS",167,0)
526 Q $P($$FIND(PID,"V","%ZPOS"),"^",2)
527"RTN","MSCZJOBS",168,0)
528 ;
529"RTN","MSCZJOBS",169,0)
530USER(PID) ;Return Linux user
531"RTN","MSCZJOBS",170,0)
532 Q $G(@MSC@(PID,"USER"))
533"RTN","MSCZJOBS",171,0)
534 ;
535"RTN","MSCZJOBS",172,0)
536IDENT(PID) ;Return OpenVista user
537"RTN","MSCZJOBS",173,0)
538 N DUZ S DUZ=+$$FIND(PID,"V","DUZ")
539"RTN","MSCZJOBS",174,0)
540 N ZG S ZG=$$FIND(PID,"I","$ZGBLDIR")
541"RTN","MSCZJOBS",175,0)
542 Q $P($G(^|ZG|VA(200,DUZ,0)),"^")
543"RTN","MSCZJOBS",176,0)
544 ;
545"RTN","MSCZJOBS",177,0)
546FIND(PID,ARR,KEY) ;Return the value of a key in one of the ZSHOW arrays
547"RTN","MSCZJOBS",178,0)
548 N I,X S I="",X=""
549"RTN","MSCZJOBS",179,0)
550 F S I=$O(@MSC@(PID,ARR,I)) Q:'I I $P(@MSC@(PID,ARR,I),KEY_"=")="" S X=$TR($P(@MSC@(PID,ARR,I),"=",2,999),"""") Q
551"RTN","MSCZJOBS",180,0)
552 Q X
553"VER")
5548.0^22.0
555**END**
556**END**
0557
=== modified file 'mumps/MSCZJOBS.m'
--- mumps/MSCZJOBS.m 2010-07-30 19:25:44 +0000
+++ mumps/MSCZJOBS.m 2011-03-24 16:18:29 +0000
@@ -1,5 +1,5 @@
1MSCZJOBS ;JKT/MSC ;OpenVista System status; 30 JUL 2010 - 12251MSCZJOBS ;JKT/MSC ;OpenVista System status; 11 JAN 2011 - 1122
2 ;;8.0;KERNEL;**1501**;5/20/20092 ;;8.0;KERNEL;**1501,1510**;5/20/2009
3 ;3 ;
4ALL D SS() Q4ALL D SS() Q
5THIS N FILTERS S FILTERS(1)="I^"_$$CURRENT^ZCD() D SS(.FILTERS) Q5THIS N FILTERS S FILTERS(1)="I^"_$$CURRENT^ZCD() D SS(.FILTERS) Q
@@ -73,6 +73,7 @@
73 ;73 ;
74 N MSC S MSC="^TMP(""MSCZJOB1"",$J)" K @MSC74 N MSC S MSC="^TMP(""MSCZJOB1"",$J)" K @MSC
75 D JOBEXAM^MSCZJOBU(MSC)75 D JOBEXAM^MSCZJOBU(MSC)
76 N NETSTAT S NETSTAT=0
76 N PID S PID=""77 N PID S PID=""
77 F S PID=$O(@MSC@(PID)) Q:PID="" D78 F S PID=$O(@MSC@(PID)) Q:PID="" D
78 . ; evaluate filters; AND different filter types, but if more than one criteria is given of the same type, use OR79 . ; evaluate filters; AND different filter types, but if more than one criteria is given of the same type, use OR
@@ -113,11 +114,50 @@
113 N PRI S PRI=$$FIND(PID,"I","$PRINCIPAL")114 N PRI S PRI=$$FIND(PID,"I","$PRINCIPAL")
114 Q:PRI'="0" PRI ; FIXME: this could probably be more general115 Q:PRI'="0" PRI ; FIXME: this could probably be more general
115 ;116 ;
116 ; look at devices for sockets117 ; look at devices for listening or connected sockets
117 N SOCK S SOCK=$$FIND(PID,"D"," SOCKET[0]")118 N SOCK,DEV S SOCK=$$FIND(PID,"D"," SOCKET[0]"),DEV=""
118 I $P(SOCK," ",3)="LISTENING" Q $P($P(SOCK," PORT=",2)," ")_",LISTENING"119 I $P(SOCK," ",3)="LISTENING" D
119 I $P(SOCK," ",3)="CONNECTED" Q $P($P($P(SOCK," LOCAL=",2)," "),"@",2)_",CONNECTED"120 . S DEV=$$FINDSOCK("PORT")_",LISTENING"
120 Q ""121 I $P(SOCK," ",3)="CONNECTED" D
122 . N LOCAL S LOCAL=$$FINDSOCK("LOCAL")
123 . I LOCAL'="" S DEV=$P(LOCAL,"@",2)_",CONNECTED" Q
124 . ;
125 . ; If the local port info is not available, we have to look up the
126 . ; remote port in netstat to figure out the local port. This happens
127 . ; on single listeners (listeners that stop listening once they get a
128 . ; connection). See LP #701554.
129 . N REMOTE S REMOTE=$TR($$FINDSOCK("REMOTE"),"@",":")
130 . D NETSTAT
131 . S LOCAL=$G(NETSTAT(REMOTE))
132 . I LOCAL'="" S DEV=$P(LOCAL,":",$L(LOCAL,":"))_",CONNECTED" Q
133 Q DEV
134 ;
135FINDSOCK(KEY) ;Find a key in the SOCK line, private to DEVICE()
136 Q $P($P(SOCK," "_KEY_"=",2)," ")
137 ;
138NETSTAT ;Call netstat, private to DEVICE()
139 Q:NETSTAT ; if netstat has been run already, don't run it again
140 N PIPE,%I,LINE,I,PIECE,LOCAL,REMOTE
141 S PIPE="pipe",%I=$I
142 O PIPE:(COMMAND="netstat -n -A inet":READONLY)::"PIPE"
143 U PIPE
144 F R LINE Q:LINE="" D
145 . ;
146 . ; Iterate over the pieces (delimited by spaces)
147 . ; Put the first piece that has a ":" in it into LOCAL
148 . ; Put the second piece that has a ":" in it into REMOTE
149 . S LOCAL="",REMOTE=""
150 . F I=1:1:$L(LINE," ") S PIECE=$P(LINE," ",I) D Q:REMOTE'=""
151 . . Q:$P(PIECE,":",2)="" ; no colon, not an address
152 . . I LOCAL="" S LOCAL=PIECE Q
153 . . I REMOTE="" S REMOTE=PIECE Q
154 . ;
155 . ; Build a dictionary of remote => local for easy lookup later
156 . I REMOTE'="" S NETSTAT(REMOTE)=LOCAL
157 U %I
158 C PIPE
159 S NETSTAT=1 ; set flag to indicate that netstat has been run
160 Q
121 ;161 ;
122INSTANCE(PID) ;Return name of OpenVista instance162INSTANCE(PID) ;Return name of OpenVista instance
123 N ZG S ZG=$$FIND(PID,"I","$ZGBLDIR")163 N ZG S ZG=$$FIND(PID,"I","$ZGBLDIR")

Subscribers

People subscribed via source and target branches