PATROL Agent debugging in a pure TrueSight environment

Version 1
    Share:|

    Dear TrueSight-Users,

     

    You might have come across some difficulties when it comes tor PATROL Agent debugging in a pure TrueSight environment. In particular if you do not have access to the systems where the PATROL Agents are running, this can be a challenging task. In most cases you have to involve the system administrators. So, I want to share some debugging techniques for PATROL Agents in TrueSight. Please also check out my idea TrueSight: PATROL Agent Debugging  and feel free to add your demands for BMC there.

     

    Ok, let's start with some easy things. In TrueSight we can leverage the "Query PATROL Agent" function in the "Managed Devices" view on TSPS to gather information from our PATROL Agents (the function is also available from some places on TSIM servers). In order to do that, we need some PSL-knowledge. But no worries, you can use the PSL-snippets provided further below. However, it is good to know what the PSL is doing before executing them, so if you are not so familiar with PSL please check out the documentation found here PATROL Script Language overview and functions - BMC PATROL Agent 11.0

     

    I will use PA as abreviation for the PATROL Agent in the following content.

     

    1. Get content of current PA logfile

     

    print(cat(get("/patrolHome")."/log/PatrolAgent-".get("/hostname")."-3181.errs"));

     

    If your PA runs on a different port, you have to change it accordingly. In order to get the content of previous PA logs, you have to append "~#~" to the logfile name - where # represents the previous log number.

     

    2. System Output Window

    You ever wondered where the System Output Window is gone? Actually it is not completely gone. The PA writes the SOW to a logfile. This logfile can be displayed in a similar fashion like the PA logfile.

     

    print(cat(get("/patrolHome")."/log/trace/".get("/hostname")."/".get("/tcpPort")."/issow.log"));

     

    This is basically the standard output of the PA on the system.

     

    3. Create PA diagnostic report

     

    patrol_diags=cat(get("/patrolHome")."/lib/psl/patroldiags.psl");PslExecute("patrol_diags", patrol_diags,errors,warnings); printf("compilation errors for patrol_diags :\n%s\ncompilation warnings for patrol_diags :\n%s\n",errors, warnings);

     

    This will create a diag-<hostname>-<port>.log in the PA log directory. You can either use a similar PSL like in "1. Get content of current PA logfile" to get the content or you ask the system admint to send the file to you. Because of the size of the log, it is not always possible to see the its full content of in "Query PATROL Agent" window.

     

    4. Get available appclasses on PA

     

    print(get_vars("/", "subnodes"));

     

    With this snippet you can drill down to the parameter level by simply build up the path of the application e.g.:

     

    print(get_vars("/NT_CPU/CPU__Total", "subnodes"));

     

    Which returns

    Command :    print(get_vars("/NT_CPU/CPU__Total", "subnodes"));

     

    Results : 

    CPUprcrIdleTimePercent

    CPUprcrInterruptsPerSec

    CPUprcrPrivTimePercent

    CPUprcrProcessorTimePercent

    CPUprcrUserTimePercent

    CPUprcrVMAvgProcessorTime

    CPUprcrVMLimit

    CPUprcrVMProcessorTimePercent

    CPUprcrVMReservation

     

    This is very useful to check if a KM is loaded and if the parameters are present. It can also be used to determine SIDs for instance filtering or to define thresholds for instances.

     

    5. Installed components

    This is a more complex one. If you want to determine what PA components are installed, you can use this PSL-snippets. Because of the complexity and differences between Windows and UNIX/Linux, there are two versions.

     

    Windows:

    components="<table style=\"border-collapse: collapse;\"><tr><th style=\"border: 2px solid;\">Product</th><th style=\"border: 2px solid;\">Package Name</th><th style=\"border: 2px solid;\">Version</th><th style=\"border: 2px solid;\">Descriprion</th><th style=\"border: 2px solid;\">PPF-File</th></tr>";foreach ppfFile (system("dir /S /B ".nthargf(get("patrolHome"), "-3", "\\", "\\")."\Install\insthist\*.ppf")){if(ppfFile =~ ".ppf"){ppfContent=grep("^PRODUCT=\\|^PKGNAME=\\|^VERSION=\\|^DESC=",cat(ppfFile));ppfProduct=replace(grep("^PRODUCT=", ppfContent), "PRODUCT=", "");ppfPkgName=replace(grep("^PKGNAME=", ppfContent), "PKGNAME=", "");ppfVersion=replace(grep("^VERSION=", ppfContent), "VERSION=", "");ppfDesc=replace(grep("^DESC=", ppfContent), "DESC=", "");components=sprintf("%s<tr><td style=\"border: 1px solid;\">%s</td><td style=\"border: 1px solid;\">%s</td><td style=\"border: 1px solid;\">%s</td><td style=\"border: 1px solid;\">%s</td><td style=\"border: 1px solid;\">%s</td></tr>", components, ppfProduct, ppfPkgName, ppfVersion, ppfDesc, ppfFile);}}print(components."</table>");

     

    UNIX/Linux:

    components="<table style=\"border-collapse: collapse;\"><tr><th style=\"border: 2px solid;\">Product</th><th style=\"border: 2px solid;\">Package Name</th><th style=\"border: 2px solid;\">Version</th><th style=\"border: 2px solid;\">Descriprion</th><th style=\"border: 2px solid;\">PPF-File</th></tr>";foreach ppfFile (system("ls -1R ".get("patrolHome")."/../../Install/insthist/*/*.ppf")){if(ppfFile =~ ".ppf"){ppfContent=grep("^PRODUCT=\\|^PKGNAME=\\|^VERSION=\\|^DESC=",cat(ppfFile));ppfProduct=replace(grep("^PRODUCT=", ppfContent), "PRODUCT=", "");ppfPkgName=replace(grep("^PKGNAME=", ppfContent), "PKGNAME=", "");ppfVersion=replace(grep("^VERSION=", ppfContent), "VERSION=", "");ppfDesc=replace(grep("^DESC=", ppfContent), "DESC=", "");components=sprintf("%s<tr><td style=\"border: 1px solid;\">%s</td><td style=\"border: 1px solid;\">%s</td><td style=\"border: 1px solid;\">%s</td><td style=\"border: 1px solid;\">%s</td><td style=\"border: 1px solid;\">%s</td></tr>", components, ppfProduct, ppfPkgName, ppfVersion, ppfDesc, ppfFile);}}print(components."</table>");

     

    This runs through the *.pff files found in the Install/insthist directory and prints a table with all installed components.

     

    Dieses Dokument wurde aus folgender Diskussion erzeugt: PATROL Agent debugging in a pure TrueSight environment