Custom Date in Email Output
Posted: Thu Jan 26, 2012 8:44 pm
Hi,
How can I pass a custom date into email output? The formats provided from the macros $LONGDATETIME$ or $SHORTDATETIME$ aren't exactly what i'm after, so I'm trying to figure out a way to substitute output from Bash's date function or via some other method.
I've taken a couple simple swings at it, but figured I'd ask before tinkering with wrapper scripts and investing siginificant time. I tried assigning $(date +%m/%d/%Y" "%I:%m:%S" "%p) as a user defined macro in resources.cfg, then calling that given user macro in the command definition, but all the email returned was the raw text of the date function instead of its output. Next I attempted to add the command directly to the command definition, meaning I substituted in /bin/date date +%m/%d/%Y" "%I:%m:%S" "%p in place of $SHORTDATETIME$? Another thought I had was putting a wrapper around NRPE - since that's what we're using to collect most of our data - that would return the custom date in the additional info section.
What's an easy way to have a notification command execute Bash or pull in a custom date?
Any assistance is greatly appreciated.
Thanks!
Bryant
How can I pass a custom date into email output? The formats provided from the macros $LONGDATETIME$ or $SHORTDATETIME$ aren't exactly what i'm after, so I'm trying to figure out a way to substitute output from Bash's date function or via some other method.
I've taken a couple simple swings at it, but figured I'd ask before tinkering with wrapper scripts and investing siginificant time. I tried assigning $(date +%m/%d/%Y" "%I:%m:%S" "%p) as a user defined macro in resources.cfg, then calling that given user macro in the command definition, but all the email returned was the raw text of the date function instead of its output. Next I attempted to add the command directly to the command definition, meaning I substituted in /bin/date date +%m/%d/%Y" "%I:%m:%S" "%p in place of $SHORTDATETIME$? Another thought I had was putting a wrapper around NRPE - since that's what we're using to collect most of our data - that would return the custom date in the additional info section.
What's an easy way to have a notification command execute Bash or pull in a custom date?
Any assistance is greatly appreciated.
Thanks!
Bryant