Good Evening All,
So, I was planning to use this thread (please admin tell if I shouldn't) as a landing page to a project that I've decided to work on in order to learn Python. As I mentioned in a previous post, I've used bash shell scripts for everything for so long, it's about time I learned Python.
The script I'm planning would probably take me no more than an hour in a regular bash script, but I see it as a good opportunity to put in a little more effort and learn something new
So.. my plan is to create a script that I can run every morning to tell me which nodes in a cluster are down compared to the day before. The problem is this;
The script will be ran from a management node. The down node information is only available from a login node, so in bash I guess I'd just SSH to the login node, run the command and export the data, then store it in a tmp file and then use diff to tell me whats different and then get to working on the additional nodes which are down.
So my questions are twofold:
1.) Is there a module or something which would make the SSH section of this simple? Or would I just use Python to send shell commands, with subversion or something?
2.) The next step in the process would be to look for common strings in log files associated to the node names the first step reports. So again, in a regular shell script, I would just load the node name into a variable, or list and loop through them or something outputting log lines to the screen. I know with Python we can parse xml files with a module called xml.etree.ElementTree, is there something similar to help me parse just straight log files?
3.) The last step (ish) would be to run some specific commands against the nodes to check the MCE Banks for Memory Errors and CATERRS, I think I know the answer to this, which is just use something like subversion to run the tool and capture the output, so I guess my question is with regards to capturing the output... I suppose this question will develop as I move on.
So I know what you're probably thinking... he's asking all these questions, but where's his script. We're not going to do it for him!!! And I agree, I'm wanting to learn Python and so there is no script at the moment, but I'm really just looking for pointers, modules you know of which I can go away and read about, and as the days move on I'll post the script as it develops. I hope this is acceptable?
Thanks
Jon