Skip to content

Commit 718a078

Browse files
authored
Merge pull request #11 from intersystems-ru/Branch_Install_remaster
Branch install remaster
2 parents 876e967 + 862b6b3 commit 718a078

File tree

5 files changed

+249
-43
lines changed

5 files changed

+249
-43
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Installation
1616
where:
1717

1818
{Namespace} is a namespace you want to install to. If it does not exist it would be created automatically. If it does exist only kutac package would be overwritten. If {Namespace} is not defined, then SYSMON namespace will be created.
19-
On this step installer would create (if needed) Namespace and corresponding database, download source code from GitHub and compile it, create required web application (named /cls/{Namespace}) if one does not exist (skipping web application creation process if one does exist), and map kutac package to %All namespace (which will be created if it does not exist).
19+
On this step installer would create (if needed) Namespace and corresponding database, download source code from GitHub and compile it, create required web application (named /cls/{Namespace}) if one does not exist (skipping web application creation process if one does exist), and map globals,packages and routines to {Namespace}.
2020

2121

2222
Installation without fs access to server
@@ -30,7 +30,7 @@ Installation without fs access to server
3030
where:
3131

3232
{Namespace} is a namespace you want to install to. If it does not exist it would be created automatically. If it does exist only kutac package would be overwritten. If {Namespace} is not defined, then SYSMON namespace will be created.
33-
On this step installer would create (if needed) Namespace and corresponding database, download source code from GitHub and compile it, create required web application (named /cls/{Namespace}) if one does not exist (skipping web application creation process if one does exist), and map kutac package to %All namespace (which will be created if it does not exist).
33+
On this step installer would create (if needed) Namespace and corresponding database, download source code from GitHub and compile it, create required web application (named /cls/{Namespace}) if one does not exist (skipping web application creation process if one does exist), and map globals,packages and routines to {Namespace}.
3434

3535
Offline Installation
3636
-----------------
@@ -40,7 +40,7 @@ Offline Installation
4040

4141
do ##class(%Installer.Installer).InstallFromCommandLine("{SourceDir}\cls\kutac\monitor\utils\Installer.cls.xml","Namespace={Namespace},SourceDir={SourceDir}")
4242

43-
On this step installer would create (if needed) Namespace and corresponding database, import source code and compile it, create required web application (named /cls/{Namespace}) if one does not exist (skipping web application creation process if one does exist), and map kutac package to %All namespace (which will be created if it does not exist).
43+
On this step installer would create (if needed) Namespace and corresponding database, import source code and compile it, create required web application (named /cls/{Namespace}) if one does not exist (skipping web application creation process if one does exist), and map and map globals,packages and routines to {Namespace}.
4444

4545
Default Settings
4646
----------------

cls/kutac/monitor/task/Builder.cls.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<Export generator="Cache" version="25" zv="Cache for Windows (x86-32) 2015.1 (Build 429U)" ts="2015-08-10 15:45:00">
2+
<Export generator="Cache" version="25">
33
<Class name="kutac.monitor.task.Builder">
44
<Super>%SYS.Task.Definition</Super>
5-
<TimeChanged>63774,56446.562698</TimeChanged>
65
<TimeCreated>63544,45910.609546</TimeCreated>
76

87
<Method name="OnTask">
@@ -40,25 +39,27 @@ In order to execute a real task, override this method in a subclass.]]></Descrip
4039
d ##class(kutac.monitor.task.Builder).Setup()</Description>
4140
<ClassMethod>1</ClassMethod>
4241
<Implementation><![CDATA[
43-
&sql(select Name from %SYS.Task where Name = 'Rebuild SYSMON Cubes')
44-
if +SQLCODE {
4542
try {
4643
set tTask=##class(%SYS.Task).%New()
4744
set tTask.Name="Rebuild SYSMON Cubes"
4845
set tTask.DailyFrequency=1
4946
set tTask.DailyFrequencyTime=0
50-
set tTask.DailyIncrement=60 // run every 15 minutes
47+
set tTask.DailyIncrement=35 // run every 15 minutes
5148
set tTask.DailyStartTime=28800 // 8AM
5249
set tTask.DailyEndTime=64800 // 6PM
53-
set tTask.StartDate=+$h+1
50+
if ($p($h,",",2) >= 64800)
51+
set tTask.StartDate=+$h+1
52+
else
53+
set tTask.StartDate=+$h
5454
set tTask.Description="Rebuild System Monitor Cubes"
5555
set tTask.NameSpace=$namespace
5656
set tTask.TaskClass="kutac.monitor.task.Builder"
5757
$$$THROWONERROR(tSC,tTask.%Save())
58+
do ##class(%SYS.Task).Resume(tTask.%Id())
59+
do ##class(%SYS.Task).RunNow(tTask.%Id())
5860
} catch (ex) {
5961
w !,ex.DisplayString()
6062
}
61-
}
6263
quit
6364
]]></Implementation>
6465
</Method>

cls/kutac/monitor/utils/Installer.cls.xml

Lines changed: 95 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<Export generator="Cache" version="25" zv="Cache for Windows (x86-32) 2015.1 (Build 429U)" ts="2015-08-10 15:49:47">
2+
<Export generator="Cache" version="25">
33
<Class name="kutac.monitor.utils.Installer">
4-
<TimeChanged>63774,56462.968571</TimeChanged>
54
<TimeCreated>63732,50627.865496</TimeCreated>
65

76
<XData name="Install">
@@ -12,41 +11,74 @@
1211
<Var Name="Namespace" Value="SYSMON"/>
1312
<Log Text="Set namespace to ${Namespace}" Level="0"/>
1413
</IfNotDef>
14+
15+
1516
<If Condition='(##class(Config.Namespaces).Exists("${Namespace}")=0)'>
1617
<Log Text="Creating namespace ${Namespace}" Level="0"/>
17-
<Namespace Name="${Namespace}" Create="yes" Code="CACHESYS" Ensemble="" Data="CACHESYS">
18+
19+
<Namespace Name="${Namespace}" Create="yes" Code="${Namespace}" Ensemble="" Data="${Namespace}">
20+
<Log Text="Creating database ${Namespace}" Level="0"/>
21+
1822
<Configuration>
1923
<Database Name="${Namespace}" Dir="${MGRDIR}/${Namespace}" Create="yes" MountRequired="true" Resource="%DB_${Namespace}" PublicPermissions="RW" MountAtStartup="true"/>
2024
</Configuration>
25+
26+
<Log Text="End creating database ${Namespace}" Level="0"/>
27+
</Namespace>
28+
29+
<Log Text="End creating namespace ${Namespace}" Level="0"/>
30+
</If>
31+
32+
33+
<If Condition='(##class(Security.Applications).Exists($ZCONVERT("/csp/${Namespace}", "L"))=0)'>
34+
<Namespace Name="${Namespace}" Create="no">
2135
<Log Text="Creating web application /csp/${Namespace}" Level="0"/>
22-
<CSPApplication Url='#{$ZCONVERT("/csp/${Namespace}", "L")}' Directory='#{##class(%DeepSee.Report.UI.reportModelServer).GetCSPDirectory()_$ZCONVERT("${Namespace}", "L")}' AuthenticationMethods="64" IsNamespaceDefault="true" />
36+
37+
<CSPApplication Url='#{$ZCONVERT("/csp/${Namespace}", "L")}' Directory='#{##class(%DeepSee.Report.UI.reportModelServer).GetCSPDirectory()_$ZCONVERT("${Namespace}", "L")}' AuthenticationMethods="64" IsNamespaceDefault="true" Recurse="true"/>
2338
<RunInstall Class="kutac.monitor.utils.Installer" Method="EnableDeepSee"/>
39+
40+
<Log Text="End creating web application /csp/${Namespace}" Level="0"/>
2441
</Namespace>
25-
<Log Text="End Creating namespace ${Namespace} and web application /csp/${Namespace}" Level="0"/>
2642
</If>
2743
44+
2845
<Namespace Name="${Namespace}" Create="no">
2946
<IfDef Var="SourceDir">
3047
<Log Text="SourceDir defined - offline install from ${SourceDir}" Level="0"/>
31-
<Import File="${SourceDir}"/>
48+
<RunInstall Class="kutac.monitor.utils.Installer" Method="OfflineInstall"/>
3249
</IfDef>
3350
3451
<IfNotDef Var="SourceDir">
3552
<Log Text="SourceDir undefined - online install from GitHub" Level="0"/>
3653
<RunInstall Class="kutac.monitor.utils.Installer" Method="DownloadFromGitHub"/>
3754
</IfNotDef>
55+
</Namespace>
3856
3957
58+
<Namespace Name="${Namespace}" Create="no" Code="${Namespace}" Data="${Namespace}" Ensemble="">
59+
<Log Text="Mapping SYS.History package to choosed namespace." Level="0"/>
4060
41-
</Namespace>
61+
<Configuration>
62+
<ClassMapping From="CACHESYS" Package="SYS.History"/>
63+
</Configuration>
64+
65+
<Log Text="Mapping SYS.History global to choosed namespace." Level="0"/>
4266
67+
<Configuration>
68+
<GlobalMapping From="CACHESYS" Global="SYS.History"/>
69+
</Configuration>
4370
71+
<Log Text="Mapping MONEXT routine to choosed namespace." Level="0"/>
4472
45-
<Log Text="Mapping kutac package to choosed namespace" Level="0"/>
46-
<Namespace Name="${Namespace}" Create="no">
47-
<ClassMapping From="${Namespace}" Package="kutac"/>
73+
<Configuration>
74+
<RoutineMapping From="CACHESYS" Routines="MONEXT"/>
75+
</Configuration>
4876
</Namespace>
4977
78+
<If Condition='##class(Config.Namespaces).Exists("MDX2JSON")'>
79+
<Log Text="Setup DSW settings." Level="0"/>
80+
<RunInstall Class="kutac.monitor.utils.Installer" Method="SetDSWSettings"/>
81+
</If>
5082
5183
5284
<Log Text="Moving to configuring monitor" Level="0"/>
@@ -88,7 +120,8 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
88120
<FormalSpec>pVars,pLogLevel,tInstaller</FormalSpec>
89121
<ReturnType>%Status</ReturnType>
90122
<Implementation><![CDATA[
91-
do EnableDeepSee^%SYS.cspServer("/csp/"_$ZCONVERT(pVars("Namespace"), "L")_"/")
123+
set namespace = tInstaller.Evaluate("${Namespace}")
124+
do EnableDeepSee^%SYS.cspServer("/csp/"_$ZCONVERT(namespace, "L")_"/")
92125
quit $$$OK
93126
]]></Implementation>
94127
</Method>
@@ -100,7 +133,7 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
100133
<Implementation><![CDATA[
101134
Set Namespace=tInstaller.Evaluate("${Namespace}")
102135
Do tInstaller.PushNS("%SYS")
103-
Set tSC = ..Update(Namespace, "intersystems-ru", "deepsee-sysmon-dashboards", "master")
136+
Set tSC = ..Update(Namespace, "intersystems-ru", "deepsee-sysmon-dashboards", "Branch_Install_remaster")
104137
Do tInstaller.PopNS()
105138
If $$$ISERR(tSC) Throw ##class(%Installer.Exception).CreateFromStatus(tSC)
106139
quit $$$OK
@@ -151,7 +184,7 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
151184
Set location = Request.Location
152185
Set Request.Location = Request.Location _ Path
153186
154-
Set st = Request.Get()
187+
Set st = Request.Get(,,$$$NO)
155188
Return:$$$ISERR(st) st
156189
Return:(Request.HttpResponse.StatusCode = 404) $$$ERROR($$$GeneralError,"Repository doesn't exist OR you don't have access")
157190
Return:((Request.HttpResponse.StatusCode = 403) && (Request.HttpResponse.GetHeader("X-RATELIMIT-REMAINING")=0)) $$$ERROR($$$GeneralError,"API rate limit exceeded. Try logging in.")
@@ -221,12 +254,16 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
221254
Do tInstaller.PushNS("%SYS")
222255
write !, "Activating Monitor Classes"
223256
set st2 = ..ActivatingClasses()
224-
write !, "Starting Monitor"
257+
write !, "Starting Monitor", !
225258
set st3 = ..RunningMonitor()
226-
write !, "Creating Task"
227259
Do tInstaller.PopNS()
228260
Do tInstaller.PushNS(Namespace)
229-
do ##class(kutac.monitor.task.Builder).Setup()
261+
&sql(select Name from %SYS.Task where Name = 'Rebuild SYSMON Cubes')
262+
if +SQLCODE
263+
{
264+
write "Creating Task",!
265+
Do ##class(kutac.monitor.task.Builder).Setup()
266+
}
230267
Do tInstaller.PopNS()
231268
set st = $$$ADDSC(st2, st3)
232269
if $$$ISERR(st) Throw ##class(%Installer.Exception).CreateFromStatus(st)
@@ -270,9 +307,50 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
270307
<Implementation><![CDATA[
271308
s sc = ##class(%SYS.Monitor).Stop()
272309
s sc1 = ##class(%SYS.Monitor).Start()
273-
w !, "System Monitor has been restarted!", !
310+
w "System Monitor has been restarted!", !
274311
return sc1
275312
]]></Implementation>
276313
</Method>
314+
315+
<Method name="OfflineInstall">
316+
<ClassMethod>1</ClassMethod>
317+
<FormalSpec><![CDATA[&pVars,pLogLevel:%Integer=0,tInstaller:%Installer.Installer]]></FormalSpec>
318+
<ReturnType>%Status</ReturnType>
319+
<Implementation><![CDATA[
320+
set ns = $Namespace
321+
set namespace = tInstaller.Evaluate("${Namespace}")
322+
323+
zn namespace
324+
do $system.OBJ.ImportDir(tInstaller.Evaluate("${SourceDir}"),"*.xml","ck",.st,1)
325+
326+
zn ns
327+
quit $$$OK
328+
]]></Implementation>
329+
</Method>
330+
331+
<Method name="SetDSWSettings">
332+
<ClassMethod>1</ClassMethod>
333+
<FormalSpec>pVars,pLogLevel,tInstaller</FormalSpec>
334+
<ReturnType>%Status</ReturnType>
335+
<Implementation><![CDATA[
336+
set id = $classname()_"||DSWSettings"
337+
quit:(##class(%Dictionary.CompiledXData).%ExistsId(id) = 0) $$$ERROR($$$GeneralError,"You don't export DSW settings")
338+
set xdata = ##class(%Dictionary.CompiledXData).%OpenId(id)
339+
340+
set settings = xdata.Data.Read()
341+
if (##class(%Dictionary.CompiledMethod).%ExistsId("MDX2JSON.Users||SetConfig"))
342+
{
343+
do ##class(MDX2JSON.Users).SetConfig(tInstaller.Evaluate("${Namespace}"),settings,"DeepSeeWeb")
344+
}
345+
else{w "Please, update MDX2JSON."}
346+
quit $$$OK
347+
]]></Implementation>
348+
</Method>
349+
350+
<XData name="DSWSettings">
351+
<MimeType>text/plain</MimeType>
352+
<Data><![CDATA[{"Default":{"addons":"","app":{"language":"en","hideFolders":false,"showImages":true,"isMetro":false},"namespaces":{"tiles":{"":{"":{"row":0,"col":0,"sizeX":1,"sizeY":1,"color":2,"fontColor":0,"icon":27,"title":""},"CPU Utilization":{"row":0,"col":1,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":1,"title":"CPU Utilization"},"Database Sizes":{"row":0,"col":2,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":1,"title":"Database Sizes"},"Globals Performance":{"row":0,"col":3,"sizeX":3,"sizeY":3,"color":1,"fontColor":0,"icon":1,"widget":1,"title":"Globals Performance"},"Journal size history":{"row":3,"col":4,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":1,"title":"Journal size history"},"LicenseHistory":{"row":3,"col":5,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":1,"title":"LicenseHistory"},"Object Performance":{"row":0,"col":6,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":1,"title":"Object Performance"},"Routines Performance History":{"row":0,"col":7,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":1,"title":"Routines Performance History"},"Various System Parameters Performance":{"row":0,"col":8,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":1,"title":"Various System Parameters Performance"},"WIJ Performance":{"row":0,"col":9,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":1,"title":"WIJ Performance"}},"mobile/":{"":{"row":0,"col":0,"sizeX":1,"sizeY":1,"color":2,"fontColor":0,"icon":27,"title":""},"CPU Utilization":{"row":0,"col":1,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":0,"title":"CPU Utilization"},"Database Sizes":{"row":0,"col":2,"sizeX":4,"sizeY":3,"color":1,"fontColor":0,"icon":0,"widget":1,"title":"Database Sizes"},"Globals Performance":{"row":2,"col":1,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":0,"title":"Globals Performance"},"Journal size history":{"row":1,"col":1,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":0,"title":"Journal size history"},"LicenseHistory":{"row":0,"col":9,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":0,"title":"LicenseHistory"},"Object Performance":{"row":0,"col":6,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":0,"title":"Object Performance"},"Routines Performance History":{"row":0,"col":8,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":0,"title":"Routines Performance History"},"Various System Parameters Performance":{"row":1,"col":6,"sizeX":4,"sizeY":2,"color":1,"fontColor":0,"icon":0,"title":"Various System Parameters Performance","widget":0},"WIJ Performance":{"row":0,"col":7,"sizeX":1,"sizeY":1,"color":1,"fontColor":0,"icon":0,"title":"WIJ Performance"}}},"widgets":{"mobile/DBSizes.dashboard":{"w2":{"isLegend":true,"showValues":false,"isTop":false,"showZero":false,"sizeY":5,"sizeX":5}}}}}}
353+
]]></Data>
354+
</XData>
277355
</Class>
278356
</Export>

csp-data/csp/confpage.csp.xml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Export generator="Cache" version="25">
3+
<CSP name="confpage.csp" application="/csp/sysmon/" default="1"><![CDATA[
4+
<html>
5+
<head>
6+
7+
<title>SYSMON Configure page</title>
8+
9+
</head>
10+
11+
<script language="javascript">
12+
function classChk(checked, class_name)
13+
{
14+
checked = Number(checked);
15+
#call(..WriteClassChanges(checked,class_name))#;
16+
}
17+
18+
function submitAll()
19+
{
20+
#server(..SaveAll())#;
21+
}
22+
23+
function stopMon()
24+
{
25+
#server(..StopMonitor())#;
26+
}
27+
function startMon()
28+
{
29+
#server(..StartMonitor())#;
30+
}
31+
function docLoc(page)
32+
{
33+
var newloc = 'http://' + window.location.host + '/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25' + page;
34+
window.open(newloc,"_blank","");
35+
}
36+
</script>
37+
38+
<csp:method name = "WriteClassChanges" Arguments="a:%Integer,b:%String">
39+
new $namespace
40+
set $namespace = "%SYS"
41+
set ^SYSMONClassTemp(b) = a
42+
</csp:method>
43+
44+
<csp:method name = "SaveAll">
45+
new $namespace
46+
set $namespace = "%SYS"
47+
if $data(^SYSMONClassTemp)
48+
{
49+
set key = $order(^SYSMONClassTemp(""))
50+
while (key '= "")
51+
{
52+
set value = ^SYSMONClassTemp(key)
53+
do ##class(%Monitor.ItemGroup).MetricsClassItemGroup(key,.id)
54+
set class=##class(%Monitor.ItemGroup).%OpenId(id)
55+
set class.Activated = value
56+
do class.%Save()
57+
set key = $order(^SYSMONClassTemp(key))
58+
}
59+
kill ^SYSMONClassTemp
60+
&js<alert("Settings changed")>
61+
&js<location.reload()>
62+
63+
}
64+
</csp:method>
65+
66+
<csp:method name = "StopMonitor">
67+
new $namespace
68+
set $namespace = "%SYS"
69+
set sc = ##class(%SYS.Monitor).Stop()
70+
if sc=1 {
71+
&js< alert(" System Monitor stopped")>
72+
} elseif sc=-1 {
73+
&js< alert(" System Monitor not running!")>
74+
} else {
75+
&js< alert("ERROR: "+#($ZE)#)>
76+
}
77+
</csp:method>
78+
79+
<csp:method name = "StartMonitor">
80+
new $namespace
81+
set $namespace = "%SYS"
82+
set sc = ##class(%SYS.Monitor).Start()
83+
if sc=1 {
84+
&js< alert("System Monitor started")>
85+
} elseif sc =-1 {
86+
&js< alert("System Monitor already running!")>
87+
} else {
88+
&js< alert("ERROR: "+#($ZE)#)>
89+
}
90+
</csp:method>
91+
92+
<body>
93+
94+
<script language="cache" runat="server">
95+
new $namespace
96+
set $namespace = "%SYS"
97+
kill ^SYSMONClassTemp
98+
Set Rset = ##class(%Library.ResultSet).%New("%Monitor.ItemGroup:Classes")
99+
s Rset.RuntimeMode=1
100+
d Rset.Execute()
101+
</script>
102+
103+
<b>Sysmon Applicatin Classes configuration:</b><br/>
104+
<form name="configform">
105+
<csp:while condition="Rset.Next()" counter="i">
106+
<script language="cache" runat="server">
107+
if Rset.GetData(2) {set chkd = "checked"}
108+
else {set chkd = ""}
109+
</script>
110+
<input type="checkbox" name="#(i)#" value="#(Rset.GetData(1))#" #(chkd)# onclick="classChk(this.checked, this.value)">
111+
<a name="#(i)#" href = "##(i)#" onClick="docLoc('#($p(Rset.GetData(1),"%",2))#'); return false;">#(Rset.GetData(1))#</a></br>
112+
</csp:while>
113+
<input type="button" value="Apply" onclick="submitAll();"/>
114+
</form>
115+
116+
<br/><br/>
117+
118+
<b>Control System Monitor:</b><br/>
119+
<form name="stspform">
120+
<input type="button" value="Start SYSMON" onclick="startMon();"/>
121+
<input type="button" value="Stop SYSMON" onclick="stopMon();"/>
122+
</form>
123+
</body>
124+
</html>
125+
]]></CSP>
126+
</Export>

0 commit comments

Comments
 (0)