Am attempting to construct a "simple" programable configlet in OpManager NCM to SCP a file out to an external server for DR purposes and using the $device.hostname() built-in variable to set the hostname in the file that's written out.
However so far, I either get this variable not translated or if I attempt to esc it, I get the hostname but it's got the esc'ed characters in it.
Base command I'm using is...
$device.execute("copy running-config scp://user:password@ipaddr/Path/to/file/$device.hostname().txt")
But this outputs the filename as $device.hostname().txt not as the actual hostname. If I use ' or ` to escape it, I get the hostname but also these characters.
If I set the $device.hostname() as a variable, e.g.
#set ($variable = $device.hostname())
and use that I get the same result.
Any suggestions?