Justin_Lanoue
3 months agoNeophyte
ConfigSource for Linux Files.
I'm having trouble figuring this out.
How would I create a ConfigSource to cat the output of an ubuntu file and store that into ConfigSource?
I've been able to get the output if I specify just cat the command and expect the last line in the config but their examples don't work when the my shell prompt is "user@hostname~$".
https://www.logicmonitor.com/support/logicmodules/articles/creating-a-configsource#general
import com.santaba.agent.groovyapi.expect.Expect;
host = hostProps.get("system.hostname")
user = hostProps.get("test.user")
pass = hostProps.get("test.pass")
cli=Expect.open(host, user, pass)
cli.send("clear\n")
cli.send("cat test.conf\n")
cli.expect('~\$')
config=cli.before()
println config;
I've tried many combinations and I'm also not sure on how to remove the shell text information before the command such as the MOTD and system information.