SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Automatically add Jobs or Templates to 24x7 Windows 3.6.x

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Automatically add Jobs or Templates to 24x7 Windows 3.6.x
Author Message
cpohle



Joined: 03 Jun 2008
Posts: 11
Country: Germany

Post Automatically add Jobs or Templates to 24x7 Windows 3.6.x Reply with quote
Hi,

we have a request to more or less "automatically" add Jobs to the Schedulers Database. As we have to add around 100 Jobs into the database for this specific application we want to use as much automatisation as possible to avoid typos and other errors. A Consultant showed us a small program he wrote, that produces INI Files in the correct Format for 24x7 Multi Platform and stores them in the [24x7Home]/template directory. From there he then creates a new job out of this specific template. Unfortunately this works only with the 24x7 MP and not with the Windows Version 3.6.10 that is in use here.

On the Windows Version there is also a [24x7Home]/template directory but storing a file there does not make this file available to the templates in the scheduler, nor do I find a preferences.xml where I may enter a refrence to the new ini file. Is there some kind of automated way to bring the files in the template directory to the Templates dialog?

Or is there another way to create jobs in some kind of automated way? What would you suggest so solve this requirement?

Best regards
Christian
Mon Feb 14, 2011 3:21 pm View user's profile Send private message
SysOpJ



Joined: 20 Aug 2010
Posts: 95

Post Reply with quote
There are the Job Management Statements available in JAL (see starting on page 256 in the User Guide: http://www.softtreetech.com/24x7/24x7manual.pdf). Here's an example of their use: http://www.softtreetech.com/24x7/archive/24.htm .

There's also the API Job Definition Language commands (see starting on page 129 in the User Guide.) Here's some examples of those: http://www.softtreetech.com/24x7/archive/api.htm .

Using either one of these would be preferable to generating template .ini files. However, this should still work fine, just remember to also update the template.ini in the installation root to make your templates show up in the hierarchy with a name and group. See page 74 of the user guide:

"Job Templates are not stored in the job database. They are stored in separate .INI files, which are located by default in the Template subdirectory. The template names and group definitions are stored in the TEMPLATE.INI file. You can find this file in 24x7 Automation Suite installation directory. When backing up or copying 24x7 jobs database and configuration files to another computer do not forget to copy templates that you want to use on that computer."
Tue Feb 15, 2011 6:40 am View user's profile Send private message
cpohle



Joined: 03 Jun 2008
Posts: 11
Country: Germany

Post Reply with quote
Thank you for your fast reply. I just overlooked the hint to the Template.ini file in the manual. Now I see it. Don't know why I did not see this yesterday when studying exactly this page (after searching for "template") in the Manual.
Otherwise the method with the JDL File sounds interesting, too, because it creates the job and dies not require someone to create a job from the Template.
Again thank you for your fast and competent help.
Tue Feb 15, 2011 7:01 am View user's profile Send private message
cpohle



Joined: 03 Jun 2008
Posts: 11
Country: Germany

Post Some Questions to the JDL Interface Reply with quote
We have some follow up questions to the JDL Interface. I managed now to create a job based on your example with the following JDL File:

; Add the New job to the schedule
ADD
NAME=AddJob Test
COMMAND=F:\24x7\AddJob\AddJob_Batch.cmd
ASYNC=N
TIMEOUT=1
DESCRIPTION=This job has been automatically created
; Save all changes
SAVE

That works fine, however all Jobs are created in a folder "Dynamic Jobs" and we have no luck to change this (except moving them manually to another folder). Is there a programmatic way to move these Jobs to another folder or even create them in another folder?

We are also not successful in deleting the Job, based on the Language Description in the manual page 133 I create a JDL File

; Delete the job
DELETE "AddJob Test"
SAVE

but it gives me an error message stating that the DDE command is invalid. Are there any examples for JDL Files somewhere where I can learn from how the syntax really works?

Best regards
Christian
Wed Feb 16, 2011 2:50 pm View user's profile Send private message
SysOpJ



Joined: 20 Aug 2010
Posts: 95

Post Reply with quote
All jobs created with JDL are put in the dynamic jobs folder. This is by design.

With your delete statement, don't use quotation marks.
Thu Feb 17, 2011 9:02 am View user's profile Send private message
cpohle



Joined: 03 Jun 2008
Posts: 11
Country: Germany

Post Reply with quote
Is there any kind of command to move a job from the JDL file to another folder?

And:
I removed the Quotation marks from the Delete statement, but get the same error:
Error: 4 - DDE request denied, invalid property name or job cannot be found.

I looked into the Scheduler, the job is there, in the Dynamic Jobs folder and its name is AddJob Test as I have it in my JDL File.
Thu Feb 17, 2011 11:59 am View user's profile Send private message
SysOpJ



Joined: 20 Aug 2010
Posts: 95

Post Reply with quote
I haven't found a programmatic way to move a job from one folder to another. Let me check with a colleague and get back to you if we have a way.

Can you paste the full delete script you're using? It works in my tests.
Fri Feb 18, 2011 6:17 am View user's profile Send private message
cpohle



Joined: 03 Jun 2008
Posts: 11
Country: Germany

Post Reply with quote
Sure. Here is the Batch

@echo off
rem : DeleteJob.cmd - Automatically delete a Job from 24x7
rem : (c) 2011 Pohle & Schultes IT Consulting AG

rem : Start the 24x7 Scheduler (one Directory above this one)
rem : and process the JDL File that creates the new Job
..\24x7.exe /SCRIPT F:\24x7\AddJob\DeleteJob.JDL

rem : If you like, Display the Log of the Job
type ..\jdl.log
pause

and here the DeleteJob.JDL

; GetJob.JDL - Testjob for automatically deleting Jobs
; (c) 2011 Pohle & Schultes IT Consulting AG

; Delete the job
DELETE AddJob Test
SAVE
Fri Feb 18, 2011 6:27 am View user's profile Send private message
SysOpJ



Joined: 20 Aug 2010
Posts: 95

Post Reply with quote
Oddly, I got the same error for "DELETE", but it works fine for "DEL". Please use the latter for now. I'll check on the issue with "DELETE".
Fri Feb 18, 2011 7:44 am View user's profile Send private message
SysOpJ



Joined: 20 Aug 2010
Posts: 95

Post Reply with quote
Ok, the word is that you should not use spaces in the JDL job names if you want to do this, otherwise it may have problems in which the commands interpret space-separated things as separate parameters to the command.

You can not change folders with standard JDL, but it can be done using the API ChangeFolder method.

It was also suggested to me that you use VBScript and 24x7 COM interface instead of JDL?
Mon Feb 21, 2011 7:23 am View user's profile Send private message
cpohle



Joined: 03 Jun 2008
Posts: 11
Country: Germany

Post Reply with quote
Hi,

yes, when I shorten the DELETE statement to DEL then it works fine. Thank you for this. I also noticed for me that I will noch use Spaces in JobNames. Should be no problem.

As you suggested, I tried to use the COM+ Interface from VBS and prepared a script out of the examples in the Remote COM Manual:

' Declare COM object variable
Dim Remote_24x7
' Create 24x7 Remote Control, using its programmatic
' identifier (ProgID="w24x7ASP.vbRemote24x7")
Set Remote_24x7 = CreateObject("w24x7ASP.vbRemote24x7")

' Identifiers for the Job
Dim RetCode, JobDefinition
' Define Job
JobDefinition = "NAME=AddJobTest" & VbCrLf & _
"COMMAND=F:\24x7\AddJob\AddJob_Batch.cmd" & VbCrLf & _
"ASYNC=N" & VbCrLf & _
"TIMEOUT=1" & VbCrLf & _
"DESCRIPTION=This job has been automatically created"
' Create new job
RetCode = Remote_24x7.CreateJob(JobDefinition)
If RetCode < 0 Then
' Display error message
Response.Write(Remote_24x7.LastError)
Else
Response.Write("Job ID: " & CStr(RetCode))
End If

Unfortunately this gives me an Error "Type mismatch: 'Create Job'" in Line 16. Is my suggestion correct to set JobDefinition to a String with the JDL Commands or am I completely wrong?
Tue Feb 22, 2011 4:35 am View user's profile Send private message
cpohle



Joined: 03 Jun 2008
Posts: 11
Country: Germany

Post Reply with quote
Please disregard my last Error, got it to work. I put all the JDL Statements into the Parameter of the CreateJob and it works fine.

Best Regards,
Christian
Tue Feb 22, 2011 5:25 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.