How to use logmon command execution to format date strings?

book

Article ID: 17122

calendar_today

Updated On:

Products

DX Infrastructure Management NIMSOFT PROBES

Issue/Introduction



How to use logmon command execution to format date strings?

Environment

Release:
Component: UIMLGM

Resolution

The logmon probe has a time formatting primitive that allows you to pass dates to commands as well as log selectors.  The format string for the date command requires percent signs to used in place of white spaces; otherwise, the date formats will not work correctly.  Use the following format to correct:

 

ts=$(date +%%s%%N) ; for x in {1..1000}; do ping -c 1 hostname; done | grep "100%" | wc -l ; tt=$((($(date +%%s%%N) - $ts)/1000000)) ; echo "${tt}ms" 

 

As shown in the above example, any white spaces in the date format need to be escaped with '%%'.  This will allow logmon to parse the date format and successfully complete the command.