|
RE: Antwort: RE: Custom Resource Model Problem: msg#00467sysutils.tivoli.tme10
Lars, I am sorry if this sounds harsh. You are going to have to get some fundamental training on how to write resource models if you are going to continue with this endeavor. Otherwise you are going to always be making one step forward and two steps backwards. What you are doing is similar to trying to write a Java program with out reading a book or taking a class. Your newest problem is your GetStrParameter("param_perl_path") method call. You didn't supply an instance number. This is something you could have found in the RMB User's Guide Appendix B if you looked up the syntax of the GetStrParameter. However, even after you fix that some of your logic is not correct. There are some performance and logic problems in your resource model. For example, in your visittree you loop on the paramInstances count which is set from the GetStrParameterCount("param_host_port") in init. This can be a different count from the Svc.GetStrParameter("param_perl_path") instance count. You will need to make sure you hardwire the instance number or better yet set the param_perl_path variable in the init function as a global variable. There are a number of resources for learning how to write Resource Models. Redbooks http://publib-b.boulder.ibm.com/abstracts/sg245519.html?Open http://gulfsoft.com/modules.php?op=modload&name=Downloads&file=index Gulf Breeze Website (Newsletters and Tips) http://gulfsoft.com/modules.php?op=modload&name=Downloads&file=index IBM Classes http://www-306.ibm.com/software/tivoli/education/ Gulf Breeze Classes http://www.gulfsoft.com/modules.php?op=modload&name=GBClasses&orderby=Cl assName&file=index&ClassType=GBWKSHP There are also some field guides on the IBM site for writing shell based resource models. Good Luck John Willis Gulf Breeze Software www.gulfsoft.com OpenESM Project www.sourceforge.net/projects/gulfsoft -----Original Message----- From: owner-tme10@xxxxxxxxxxxxxxxx [mailto:owner-tme10@xxxxxxxxxxxxxxxx] On Behalf Of lars.kleiner@xxxxxxxxxx Sent: Thursday, January 27, 2005 2:33 PM To: tme10@xxxxxxxxxxxxxxxx Subject: Antwort: RE: [tme10] Custom Resource Model Problem Hi, sorry, it don't works ! The trace shows: Jan 27 20:22:59 3 Checkport 1584 RM TRACE: Start VisitTree Jan 27 20:22:59 0 Analyzer 1584 Error occurred while running Script. The line is Source line not available - Context:13911344 - Line 153 - Col 17 - Descr Falsche Anzahl an Argumenten oder ungültige Eigenschaftszuweisung - Source Laufzeitfehler in Microsoft JScript Jan 27 20:22:59 2 Analyzer 1584 The Script is being left Jan 27 20:22:59 0 Analyzer 1584 Error while calling 'VisitTree' Subroutine E:\PROGRA~1\Tivoli\lcf\dat\1\LCFNEW\Tmw2k\dec\Checkport.js Jan 27 20:22:59 0 Analyzer 1584 Error while visiting the decision tree Checkport step number 0 Jan 27 20:22:59 0 Analyzer 1584 Exiting thread of the resource model Checkport at step number 0, due to a scripting exception Jan 27 20:22:59 2 Analyzer 1584 Async Collection successfully stopped for the model Checkport Jan 27 20:22:59 0 Analyzer 1584 Error while running the model Checkport, error code 24, message Error not Decoded (24) ! Jan 27 20:22:59 1 Analyzer 1584 Destroying the script site... The problem seems to be "var perlpath = Svc.GetStrParameter("param_perl_path");" but I don't know why ? The parameter param_perl_path should be d:/programme/perl/bin/perl.exe ... Thanks in advance Lars "john willis" <john_willis@gulf soft.com> An Gesendet von: <tme10@xxxxxxxxxxxxxxxx> owner-tme10@lists Kopie .us.ibm.com Thema RE: [tme10] Custom Resource Model 27.01.2005 19:08 Problem Bitte antworten an tme10@xxxxxxxxxxx m.com Try: curScriptResult = Svc.Shell(perlpath + " chkport.pl " + host + " " +port); John Willis Gulf Breeze Software www.gulfsoft.com OpenESM Project www.sourceforge.net/projects/gulfsoft -----Original Message----- From: owner-tme10@xxxxxxxxxxxxxxxx [mailto:owner-tme10@xxxxxxxxxxxxxxxx] On Behalf Of lars.kleiner@xxxxxxxxxx Sent: Thursday, January 27, 2005 12:46 PM To: tme10@xxxxxxxxxxxxxxxx Subject: Re: [tme10] Custom Resource Model Problem Hi, I would like to add the parameter "param_perl_path" (for example: c:/perl5/bin/perl.exe) to my resource model ... But I get errors while running the script ! The problem is the following: .......... Svc.DefineStrParameter ("param_perl_path", "C:/Tivoli/Perl/bin/Perl5.exe"); ........... var perlpath = Svc.GetStrParameter("param_perl_path"); curScriptResult = Svc.Shell("+perlpath+ chkport.pl "+host+" "+port); Any ideas ? Lars My script: //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' // Decision Tree script // // This file was generated by the IBM Tivoli Resource Model Builder. // // 01/21/2004 18:56:36 // // Änderungen wurden durchgeführt von Lars Kleiner 21.01.2004 // //'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' // Trace constants to be used by Svc.Trace calls. var TRACE_ERROR = 0; var TRACE_FINE = 1; var TRACE_FINER = 2; var TRACE_FINEST = 3; // This variable can be used in your Svc.Trace calls to make it easier to // search through the log file and find calls made by the resource models. var TRACE_SOURCE = "RM TRACE: "; // Return code constants for various error conditions. var RC_COLLECTION_ERROR = 407; var RC_INVALID_METRIC = 406; var RC_INVALID_RESOURCE_TYPE = 801; var RC_INVALID_VERSION = 802; var RC_RESOURCE_UNAVAILABLE = 405; var flagNotFirstRun = 0; var hTableScriptResult; var allHosts = new Array(); var allPorts = new Array(); var paramInstances; // This function defines the default settings of the resource model. // It is called only once, when the resource model is started. // Don't modify remarks containing tags like <<....>> ... <<\...>> // You can write additional initializing code in this function if required. function SetDefaultConfiguration(Svc) { Svc.Trace(TRACE_FINEST, TRACE_SOURCE + "Start SetDefaultConfiguration"); // General info section //<<GENERAL_INFO>> Svc.SetModelName ("Checkport"); Svc.SetProfileName ("1106842375129"); Svc.SetCycleTime (60); //<<\GENERAL_INFO>> // Thresholds section //<<THRESHOLDS_INFO>> Svc.DefineThreshold ("thr_result", 0.0); //<<\THRESHOLDS_INFO>> // Parameters section //<<PARAMETERS_INFO>> Svc.DefineStrParameter ("param_host_port", "ogtivadmin01;9495"); Svc.DefineStrParameter ("param_perl_path", "C:/Tivoli/Perl/bin/Perl5.exe"); //<<\PARAMETERS_INFO>> // Dynamic model section //<<DATA_INFO>> //<<\DATA_INFO>> // Event definition section //<<EVENTS_INFO>> Svc.DefineEvent ("PortFailed" , "MatchingValue,ScriptResult", "port,host"); //<<\EVENTS_INFO>> // Logging definition section //<<LOGGING_INFO>> //<<\LOGGING_INFO>> // Place your additional intializing code below. Svc.Trace(TRACE_FINEST, TRACE_SOURCE + "End SetDefaultConfiguration"); return (0); } // This function is called by the monitoring engine after the resource // model default settings have been overridden. It is called only once, // when the resource model is started. You can write additional // initialization code in this function if required. function Init(Svc) { var k; var words = new Array(2); Svc.Trace(TRACE_FINEST, TRACE_SOURCE + "Start Init"); hTableScriptResult = Svc.CreateMap(); hTableParameters = Svc.CreateMap(); paramInstances = Svc.GetStrParameterCount("param_host_port"); if (paramInstances > 0) { for (k = 0; k < paramInstances; k++) { var line = new String(Svc.GetStrParameter("param_host_port",k)); words = line.split(/;/); allHosts[k] = words[0]; allPorts[k] = words[1]; } } return (0); } // This function contains the monitoring algorithm. It is called // once per cycle. Implement the monitoring code here. function VisitTree(Svc) { Svc.Trace(TRACE_FINEST, TRACE_SOURCE + "Start VisitTree"); //vars for data source: perl chkport.pl oginnb50 9495 var curScriptResult; var hashKey; var found; var OldScriptResult; var hPropTable; var hTableScriptResult; var ParamCount; var ParamIdx; var Different; //Zusätzliche Variablen var k; var host; var port; if (paramInstances > 0) { for (k = 0; k < paramInstances; k++) { hPropTable = Svc.CreateMap(); hTableScriptResult = Svc.CreateMap(); host = allHosts[k]; port = allPorts[k]; Svc.RemoveMapAll(hPropTable); var perlpath = Svc.GetStrParameter("param_perl_path"); curScriptResult = Svc.Shell("+perlpath+ chkport.pl "+host+" "+port); Svc.SetMapNumElement(hPropTable, "ScriptResult", curScriptResult); found = Svc.ExistsMapElement(hTableScriptResult, hashKey); if (found) OldScriptResult = Svc.GetMapNumValue(hTableScriptResult, hashKey); else OldScriptResult = 0; if (curScriptResult == Svc.GetThreshold("thr_result")) { Svc.SetMapNumElement(hPropTable, "MatchingValue", Svc.GetThreshold("thr_result")); Svc.SetMapStrElement(hPropTable, "host", host); Svc.SetMapStrElement(hPropTable, "port", port); Svc.SendEventEx ("PortFailed", hPropTable); } Svc.SetMapNumElement(hTableScriptResult, hashKey, curScriptResult); flagNotFirstRun = true; } Svc.DestroyMap(hPropTable); } return (0); } ------------------- L E G A L D I S C L A I M E R ----------------------- Die Informationen in dieser Nachricht sind vertraulich und ausschliesslich fuer den Adressaten bestimmt. Kenntnisnahme durch Dritte ist unzulaessig. Die Erstellung von Kopien oder das Weiterleiten an weitere, nicht originaere und benannte Adressaten ist nicht vorgesehen und kann ungesetzlich sein. Die Meinungen in dieser Nachricht stellen lediglich die Meinungen des Senders dar. Falls Sie vermuten, dass diese Nachricht veraendert wurde, setzen Sie sich mit dem Absender in Verbindung. Die Markant Handels und Service GmbH uebernimmt ohne weitere Ueberpruefung keine Verantwortung fuer die Richtigkeit und Vollstaendigkeit des Inhalts. Unbefugte Empfaenger werden gebeten, die Vertraulichkeit der Nachricht zu wahren und den Absender sofort ueber einen Uebertragungsfehler zu informieren. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Antwort: RE: Custom Resource Model Problem: 00467, lars . kleiner-QGvAMEw2u1+ELgA04lAiVw |
|---|---|
| Next by Date: | RE: [FWK4.1] Authentication with NT account: 00467, Venkita Sundaresan |
| Previous by Thread: | Antwort: RE: Custom Resource Model Problemi: 00467, lars . kleiner-QGvAMEw2u1+ELgA04lAiVw |
| Next by Thread: | RE: Custom Resource Model Problem: 00467, lars . kleiner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |