Skip to content

Commit 0172da6

Browse files
committed
Merge pull request #5 from alexandrov-nikita/master
fixed task
2 parents 35a94f0 + d4a5fff commit 0172da6

File tree

3 files changed

+83
-51
lines changed

3 files changed

+83
-51
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ On this step installer would create (if needed) Namespace and corresponding data
4545
Default Settings
4646
----------------
4747

48-
After mapping kutac package to %All namespace, namespaces %SYS and {Namespace} will be defined as startup namespaces for monitor. Then, the installer activates in the namespace %SYS" following monitor classes:
48+
The installer activates in the namespace %SYS" following monitor classes:
4949

5050
* %Monitor.System.HistoryPerf
5151
* %Monitor.System.Diskspace
@@ -56,7 +56,19 @@ After mapping kutac package to %All namespace, namespaces %SYS and {Namespace} w
5656
* %Monitor.System.LockTable
5757
* %Monitor.System.Routines
5858

59-
The next step is starting monitor. Your namespace will appear in the list of accessible namespaces for DeepSee and you can see different dashboards there. However, if you open User Portal in the DeepSee immediately after installing, you will notice that all dashboards will be empty. You need to wait a little time, because the installer runs the task for rebuilding cubes in 1 minute after installing. This task will run every 3 hours for updating information for monitor dashboards.
59+
The next step is starting monitor. Your namespace will appear in the list of accessible namespaces for DeepSee and you can see different dashboards there. However, if you open User Portal in the DeepSee immediately after installing, you will notice that all dashboards will be empty. You need to wait a little time, because the installer runs the task for rebuilding cubes in 1 minute after installing. This task will run every 1.5 hours for updating information for monitor dashboards. Also, this task is available in the Task Manager, so you can run the task whenever you want or change the task.
60+
61+
In case of absense of new facts and notes, please, restart System Monitor using ^%SYSMONNGR utility. Run in Terminal:
62+
63+
zn "%SYS"
64+
do ^%SYSMONMGR
65+
1
66+
2
67+
1
68+
3
69+
70+
After that, check "View System Monitor State": run "4" in the Terminal. All states must be OK. In another case, please, restart Caché and start System Monitor.
71+
6072

6173

6274

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

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +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-07-24 16:07:29">
2+
<Export generator="Cache" version="25" zv="Cache for Windows (x86-32) 2015.1 (Build 429U)" ts="2015-07-28 19:41:02">
33
<Class name="kutac.monitor.utils.Installer">
4-
<TimeChanged>63757,58028.937681</TimeChanged>
4+
<TimeChanged>63761,70845.703415</TimeChanged>
55
<TimeCreated>63732,50627.865496</TimeCreated>
66

77
<XData name="Install">
@@ -19,7 +19,7 @@
1919
<Database Name="${Namespace}" Dir="${MGRDIR}/${Namespace}" Create="yes" MountRequired="true" Resource="%DB_${Namespace}" PublicPermissions="RW" MountAtStartup="true"/>
2020
</Configuration>
2121
<Log Text="Creating web application /csp/${Namespace}" Level="0"/>
22-
<CSPApplication Url='#{$ZCONVERT("/csp/${Namespace}", "L")}' Directory="#{##class(%DeepSee.Report.UI.reportModelServer).GetCSPDirectory()}/${Namespace}" AuthenticationMethods="64" IsNamespaceDefault="true" />
22+
<CSPApplication Url='#{$ZCONVERT("/csp/${Namespace}", "L")}' Directory='#{##class(%DeepSee.Report.UI.reportModelServer).GetCSPDirectory()_$ZCONVERT("${Namespace}", "L")}' AuthenticationMethods="64" IsNamespaceDefault="true" />
2323
<RunInstall Class="kutac.monitor.utils.Installer" Method="EnableDeepSee"/>
2424
</Namespace>
2525
<Log Text="End Creating namespace ${Namespace} and web application /csp/${Namespace}" Level="0"/>
@@ -100,7 +100,7 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
100100
<Implementation><![CDATA[
101101
Set Namespace=tInstaller.Evaluate("${Namespace}")
102102
Do tInstaller.PushNS("%SYS")
103-
Set tSC = ..Update(Namespace, "intersystems-ru", "deepsee-sysmon-dashboards", "master")
103+
Set tSC = ..Update(Namespace, "alexandrov-nikita", "deepsee-sysmon-dashboards", "master")
104104
Do tInstaller.PopNS()
105105
If $$$ISERR(tSC) Throw ##class(%Installer.Exception).CreateFromStatus(tSC)
106106
quit $$$OK
@@ -109,7 +109,7 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
109109

110110
<Method name="Update">
111111
<ClassMethod>1</ClassMethod>
112-
<FormalSpec>Namespace=$Namespace,Owner:%String="intersystems-ru",Repository:%String="deepsee-sysmon-dashboards",Branch:%String,Username:%String,Password:%String</FormalSpec>
112+
<FormalSpec>Namespace=$Namespace,Owner:%String="alexandrov-nikita",Repository:%String="deepsee-sysmon-dashboards",Branch:%String,Username:%String,Password:%String</FormalSpec>
113113
<ReturnType>%Status</ReturnType>
114114
<Implementation><![CDATA[
115115
Set namespace = $Namespace
@@ -219,46 +219,21 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
219219
<Implementation><![CDATA[
220220
Set Namespace=tInstaller.Evaluate("${Namespace}")
221221
Do tInstaller.PushNS("%SYS")
222-
write !, "Configuring startup namespace"
223-
set st1 = ..ConfiguringClasses(Namespace)
224222
write !, "Activating Monitor Classes"
225223
set st2 = ..ActivatingClasses()
226224
write !, "Starting Monitor"
227225
set st3 = ..RunningMonitor()
228226
write !, "Creating Task"
229227
Do tInstaller.PopNS()
230228
Do tInstaller.PushNS(Namespace)
231-
set st4 = ..CreateTask()
229+
set st4 = ..CreateTask(Namespace)
232230
Do tInstaller.PopNS()
233-
set st = $$$ADDSC(st4, $$$ADDSC(st1, $$$ADDSC(st2, st3)))
231+
set st = $$$ADDSC(st4, $$$ADDSC(st2, st3))
234232
if $$$ISERR(st) Throw ##class(%Installer.Exception).CreateFromStatus(st)
235233
quit $$$OK
236234
]]></Implementation>
237235
</Method>
238236

239-
<Method name="ConfiguringClasses">
240-
<ClassMethod>1</ClassMethod>
241-
<FormalSpec>Namespace=$Namespace</FormalSpec>
242-
<ReturnType>%Status</ReturnType>
243-
<Implementation><![CDATA[
244-
Set rsm = ##class(%SYS.Monitor).SetStartNS(Namespace)
245-
if rsm'=1
246-
{
247-
write !, "Error setting Monitor namespaces: "_$ze,!
248-
//quit $$$ISERR
249-
}
250-
251-
Set rsys = ##class(%SYS.Monitor).SetStartNS("%SYS")
252-
if rsys'=1
253-
{
254-
write !, "Error setting Monitor namespaces: "_$ze,!
255-
//quit $$$ISERR
256-
}
257-
//quit $$$OK
258-
return $$$ADDSC(rsm, rsys)
259-
]]></Implementation>
260-
</Method>
261-
262237
<Method name="ActivatingClasses">
263238
<ClassMethod>1</ClassMethod>
264239
<ReturnType>%Status</ReturnType>
@@ -293,31 +268,43 @@ do ##class(kutac.monitor.utils.Installer).setup(.pVars)</Description>
293268
<ClassMethod>1</ClassMethod>
294269
<ReturnType>%Status</ReturnType>
295270
<Implementation><![CDATA[
296-
set sc = ##class(%SYS.Monitor).Start()
297-
if sc = 1
298-
{
299-
write !, " System Monitor started"
300-
}
301-
elseif sc = -1
302-
{
303-
write !, " System Monitor already running!"
304-
}
305-
else
306-
{
307-
write !,"ERROR: "_$ZE
308-
return sc
309-
}
310-
return $$$OK
271+
s sc = ##class(%SYS.Monitor).Stop()
272+
s sc1 = ##class(%SYS.Monitor).Start()
273+
w !, "System Monitor has been restarted!", !
274+
return sc1
311275
]]></Implementation>
312276
</Method>
313277

314278
<Method name="CreateTask">
315279
<ClassMethod>1</ClassMethod>
316-
<FormalSpec>hrs:%Integer=3</FormalSpec>
280+
<FormalSpec>Namespace=$Namespace,min:%Integer=90</FormalSpec>
317281
<ReturnType>%Status</ReturnType>
318282
<Implementation><![CDATA[
319283
320-
q ##class(%DeepSee.CubeManager.Task.Synch).Schedule(0, 1, 1, hrs, ($p($H, ",", 2) + 60) # 10800, 0)
284+
//q ##class(%DeepSee.CubeManager.Task.Synch).Schedule(0, 1, 1, hrs, ($p($H, ",", 2) + 60) # 10800, 0)
285+
//q ##class(%DeepSee.CubeManager.Task.Build).Schedule(0, 0, 1, "", ($p($H, ",", 2) + 10))
286+
Set task=##class(%SYS.Task).%New()
287+
Set task.Name = "Build cubes in "_Namespace
288+
Set task.NameSpace= Namespace
289+
Set task.TimePeriod=0 // Daily
290+
Set task.TimePeriodEvery=1 // Every 1 day
291+
Set task.DailyFrequency=1 // Run Several times in a day
292+
Set task.DailyFrequencyTime=0 // Run every x minutes
293+
Set task.DailyIncrement=min // # of minutes between runs
294+
Set task.DailyStartTime = 0 // Start at 00:00:00
295+
Set task.DailyEndTime = 86399 // End at 23:59:59
296+
Set task.StartDate = $p($H,",",1) // Start today
297+
298+
299+
Set taskdef = ##class(kutac.monitor.utils.Task).%New()
300+
Set taskdef.Namespace = Namespace
301+
Do task.AssignSettings(taskdef)
302+
Set task.TaskClass=$classname(taskdef)
303+
304+
Set st = task.%Save()
305+
Return:$$$ISERR(st) st
306+
Set id = task.%Id()
307+
Return ##class(%SYS.Task).RunNow(id)
321308
]]></Implementation>
322309
</Method>
323310
</Class>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?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-07-28 15:23:21">
3+
<Class name="kutac.monitor.utils.Task">
4+
<Description>
5+
Simple update task. Use CacheGitHubCI.Hook if you need more functionality.</Description>
6+
<Super>%SYS.Task.Definition</Super>
7+
<TimeChanged>63761,55062.906473</TimeChanged>
8+
<TimeCreated>63761,54770.687029</TimeCreated>
9+
10+
<Parameter name="TaskName">
11+
<Default>CubesBuildTask</Default>
12+
</Parameter>
13+
14+
<Property name="Namespace">
15+
<Description>
16+
Namespace, where to download and compile repository</Description>
17+
<Type>%String</Type>
18+
<InitialExpression>$Namespace</InitialExpression>
19+
</Property>
20+
21+
<Method name="OnTask">
22+
<ReturnType>%Status</ReturnType>
23+
<Implementation><![CDATA[
24+
do ##class(%DeepSee.Utils).%BuildCube("HistoryPerfData")
25+
do ##class(%DeepSee.Utils).%BuildCube("CurrentSysDataDB")
26+
do ##class(%DeepSee.Utils).%BuildCube("HistoryPerfDataWD")
27+
do ##class(%DeepSee.Utils).%BuildCube("HistorySysData")
28+
do ##class(%DeepSee.Utils).%BuildCube("HistorySysDataDB")
29+
q $$$OK
30+
]]></Implementation>
31+
</Method>
32+
</Class>
33+
</Export>

0 commit comments

Comments
 (0)