Novell Home

Using NAL XML Reporting to report on ZENworks Imaging

Novell Cool Solutions: Feature
By Peter Lambrechtsen

Digg This - Slashdot This

Posted: 8 Dec 2005
 

Related Files
  • Download: ZENworks XML Reporting
  • PDF version of this article.
  • In today's business environment, when a user's desktop needs to be rebuilt, in most cases strict Service Level Agreements will need to be adhered to, in order to ensure that the desktop management team are meeting or exceeding those SLAs.

    Traditionally this has been a challenge since the ZENworks Imaging environment runs within a PreBoot (PXE) Linux environment. The management and monitoring of the imaging process has been a "Black box" and there has been no easy way to monitor progress. Because there is not the full suite of Linux applications available in the PXE environment, an additional open source application (cURL) was statically compiled to provide this functionality. Also because the Linux box will be logging events directly into the NAL Database, the correct time must be used when adding entries into the database.

    The NAL XML Reporting in ZENworks Imaging Deployment

    cURL and ntpdate have been compiled statically to enable setting the correct date and time on the local workstation and to upload the XML file into the NAL XML Reporting servlet.

    Also, the zfdamrServlet.war that needs to be deployed on the server side running the database needs to be upgraded to the version from ZENworks Desktop Management 6.5 Service Pack 2. The shipping version of the servlet with ZENworks Desktop Management is broken and will included as part of ZENWorks Desktop Management 7 Support Pack 1.

    Setup

    There are five files that are needed (and are included in this Cool Tool). The files need to be added to the TFTP directory (SYS:\TFTP on a NetWare server) These include:

    • ntpdate - The linux ELF complied NTPDATE
    • curl - The linux ELF complied cURL
    • zoneinfo - A tar compressed version of all the Timezones for Linux
    • download.sh - A shell script to download all the necessary files and expand them
    • logerror.sh - The shell script to provide logging to the NAL XML Reporting server

    You must set the following variables in the Scripted ZENworks Image.

    First create the ZENworks Image object.





    Select Scripted ZENworks Image, and give it a name.





    Then you are presented with the standard ZENworks Imaging Scripted build window. The extra commands you will need to add to the scripting build are:

    ---- Begin Script ----
    #!/bin/bash
    export NALXMLSRV=10.1.1.1
    export TZ=NZ
    echo -e "get download.sh\nq\n" | tftp $PROXYADDR
    chmod 755  download.sh
    ./ download.sh
    img rp $PROXYADDR //$PROXYADDR/ZEN/IMAGING/PC.ZMG > /imgerror.txt
    ./logerror.sh I $? PC.ZMG
    ---- End Script ----

    Since this is Linux you need to start the script with a #!/bin/bash to ensure we are in the BASH shell. Then two variables are exported (set).

    • The first is "NALXMLSRV" which is the IP address of the NAL XML Reporting server, change this appropriately.
    • The second is "TZ" - this sets the linux timezone. You must set it to the correct timezone so that the local PC's time is set correctly and logged into the database. Refer to http://www.timezoneconverter.com/cgi-bin/tzref.tzc for your correct timezone syntax. (such as "TZ=US/Mountain" etc)

    The script then downloads the "download.sh" script which is a helper script to download all necessary files, instead of embedding the commands into the Scripted image.

    The "download.sh" script:

    ---- Begin download.sh script ----
    #!/bin/bash
    #
    # Download all the necessary files needed to run the build.
    # Also change the permissions on all the files to make them executable (755)
    #
    # The script is use a \n to get a newline, add any additional files needed to be downloaded to this script.
    #
    
    #Download binaries
    cd /bin
    echo -e "bin\nget curl\nget ntpdate\nq\n" | tftp $PROXYADDR > /dev/null
    chmod 755 curl ntpdate
    cd /
    #Download the zoneinfo file.
    echo -e "bin\nget zoneinfo\nq\n" | tftp $PROXYADDR > /dev/null
    tar -xzvf zoneinfo > /dev/null
    cd /
    #Download script
    echo -e "get logerror.sh\nq\n" | tftp $PROXYADDR > /dev/null
    chmod 755 logerror.sh
    ---- End download.sh script ----

    Then ZENworks Imaging is called to download the image using the command:

    img rp $PROXYADDR //$PROXYADDR/ZEN/IMAGING/PC.ZMG > /imgerror.txt

    The $PROXYADDR is the ip address of the server that PXE booted off, then the path to the image. Then this data is redirected to /imgerror.txt. This file is then picked up by logerror.sh.

    The logerror.sh script

    This script is the main logging script.

    The script takes up to five parameters:

    ./logerror.sh Type EventString1 EventString2 EventString3 EventString4

    The type is the database that you want to log the message into, either have a "I" for the "T_Info" table, "S" for the "T_Success" table or "F" for the "T_Failure" table.

    Then you can parse the previous error level using the "$?" which is the variable used for the previous application's errorlevel (as shown above in the scripted build). Otherwise you can parse any entries into the "EventStringX" values in the database.

    Lastly, the error from the img application put into /imgerror.txt is used to put into the EventString 5.

    Querying the database

    Then an ODBC client can be used to query the database. If you are using SyBase on NetWare then the SyBase probe can be downloaded from TID 2967126 - the probe allows you to run basic SQL queries against the SyBase database to ensure that information is turning up there.

    The ODBC Drivers are on the ZENworks Desktop Management Companion CD 2 under the SyBase directory.

    Also included is the XML Schema.txt which details the information that can put into the XML file uploaded to the NAL XML Reporting Servlet

    Last Point

    Remember to use the zfdamrServlet.war that is included in this ZIP (and also available in ZDM6.5 SP2) since the shipping version with ZDM7 doesn't work. Then follow the installation instructions here.

    Also included in the ZIP is an updated zfdamrServlet.conf which can easily be put in:
    sys:/tomcat/4/webapps/zfdamrServlet/WEB-INF/zfdamrServlet.conf

    And then you can add the include line into SYS:\apache2\conf\httpd.conf as follows:
    Include sys:/tomcat/4/webapps/zfdamrServlet/WEB-INF/zfdamrServlet.conf

    Appendix A: Credits and Legal Attribution

    Author: Peter Lambrechtsen Consultant, Novell New Zealand.

    *Windows is a registered trademark of Microsoft Corporation. Linux is a registered trademark of Linus Torvalds. All other third-party trademarks are the property of their respective owners.


    Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

    © 2014 Novell