SSH into servers, filter required outputs, email to a group in Golang

(pmu) #1

I had earlier written scripts in Perl that did the following:
Log in to Storage arrays, run monitoring commands, gather the outputs in a text file, then using regular expressions, take out only the required sections from the output and email the outputs to a group.
The username and passwords of the storage arrays were saved in a separate file. The IP Addresses of the storage arrays were saved in another file. All these were text files which were fed to the Perl script.
I am wondering if the same can be done in Golang? Because it treats files also as a sort of “stream of bytes”. Also, Perl / Python has readymade SSH modules which can be used. Is there something similar for Golang?
Or may be the above approach works best for Perl or Python, but for Golang, I need to approach the task in a different way?
Please note - I am not looking for a readymade script/program, I just want some high level information if this is possible in Golang and I can use the same approach.
Due to my work commitments, I cannot allocate time everyday to learn, hence the question.

(Lutz Horn) #2

A SSH library for Go exists. And of course Go can do anything with files other languages can do. So it is possible to implement what you do with Go.

But since you call what you have a ‘script’, maybe you should use the scripting approach you are familiar with.

(system) closed #3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.