DX Application Performance Management

 View Only
Expand all | Collapse all

Script CLW change format timestamp

  • 1.  Script CLW change format timestamp

    Posted Aug 24, 2016 05:46 PM

    Hi Guys 

     

    I'm running a CLW script but the results show timestamp "Tue Aug 23 10:46:50 BRT 2016", is there some way to change this out to something like "23/08/2016 10:46:50"

     

    Command:

    java -Duser.timezone=America/Sao_Paulo -Duser.formatdate="DD/MM/YYYY" -Xmx128M -Duser=admin -Dpassword=XXXXXXX -Dhost=localhost -Dport=5001 -jar CLWorkstation.jar get historical data from agents matching .*Custom.* and metrics matching .*AS400_BVSA_DISK_BUSY_MAX.* for past 5 minute with frequency of 60 seconds

     

    Out:

     

    Domain, Host, Process, AgentName, Resource, MetricName, Record Type, Period, Intended End Timestamp, Actual Start Timestamp, Actual End Timestamp, Value Count, Value Type, Integer Value, Integer Min, Integer Max, Float Value, Float Min, Float Max, String Value, Date Value
    SuperDomain, Custom Metric Host (Virtual), Custom Metric Process (Virtual), Custom Metric Agent (Virtual), , AS400_BVSA_DISK_BUSY_MAX, Unknown, 60, Fri Jul 01 17:50:41 BRT 2016, Fri Jul 01 17:45:30 BRT 2016, Fri Jul 01 17:46:30 BRT 2016, 4, Long, 10, 6, 10 , , , , ,



  • 2.  Re: Script CLW change format timestamp
    Best Answer

    Broadcom Employee
    Posted Aug 25, 2016 02:38 PM

    Hello Alexandre,

    I don't have a solution for the way that APM export this information, but I offer a work around if you import the CSV to Excel.

    You would need to add a column to the spreadsheet and add a formula that would only capture part of the date and display it.

    Cell 1 = "Tue Aug 23 10:46:50 BRT 2016"

    Cell 2 might look like  "“=MID(A1,4,17)”

    The output would look like "Aug 23 10:46:50"

    I hope you will find this helpful until some better comes along.



  • 3.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 11:50 AM

    Only Linux you can use the following awk command:

    awk '
    BEGIN { FS = OFS = "," }
    {
    for(i = 9; i <= 11; i++)
    {
    split($i, date, / /)

    if (date[3] == "Jan") month = "01";
    else if (date[3] == "Feb") month = "02";
    else if (date[3] == "Mar") month = "03";
    else if (date[3] == "Apr") month = "04";
    else if (date[3] == "May") month = "05";
    else if (date[3] == "Jun") month = "06";
    else if (date[3] == "Jul") month = "07";
    else if (date[3] == "Aug") month = "08";
    else if (date[3] == "Sep") month = "09";
    else if (date[3] == "Oct") month = "10";
    else if (date[3] == "Nov") month = "11";
    else if (date[3] == "Dec") month = "12";

    if (date[4] != "Timestamp") {
    $i = date[4] "/" month "/" date[7] " " date[5]
    }
    }
    print $0
    }
    ' data.csv > data_converted.csv



  • 4.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 11:53 AM

    You can do this on Windows 10/Win2K8/Win2K12 with the Linux subsystem installed. ;-)



  • 5.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 11:56 AM

    Hiko, 

     

    I fixed your post for you.  I think you meant to say this...  

     

    "You can do this with the Linux installed. ;-)"

     

    Matt



  • 6.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 12:09 PM

    Incorrect.

     

    Windows now provides a Linux subsystem for all current versions of Windows, giving you a native shell environment.



  • 7.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 12:20 PM

    Not really incorrect.  Was pointing out that Linux was the real OS.  

     

    Just poking fun at windows.  I know what you meant.



  • 8.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 12:24 PM

    I get the poking; I'm just glad I can now write my scripts once and use it on all of my platforms.

     

    Actually, subsystem is the way to go since you don't need Linux at all on Windows. You just need the shell.



  • 9.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 12:26 PM

    I haven't tried this yet on headless Windows Server. I will have to give it a go soon and let everyone know.



  • 10.  Re: Script CLW change format timestamp

    Posted Aug 29, 2016 11:09 AM

    Hi Guenter Grossberger thanks for help me, I'll use this script, but CA could have done it for us, because that timestamp really don't help when we have work with this data on excel for example, in my case I want to send to Elasticsearch.



  • 11.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 11:45 AM

    You could also write a script to run the clw command and then parse the output and change the date to the format you want it to.  There is no way to automatically do it via the clw command.

     

    So either Norris's method or write a script to parse the output will work.



  • 12.  Re: Script CLW change format timestamp

    Broadcom Employee
    Posted Aug 26, 2016 11:47 AM

    Hi Alexandre:

    Marking as answered since a workaround was given and CLW would need an enhancement to do the desired functionality. You are free to post additional comments. But the basic question is answered

    Thanks 

    Hal German