No, really an actual update
So after feeling all bad for not committing any work to sentinel for a while I decided to brush off the dust and crack on with some simple bits.
As of right now Sentinel will:
- Perform basic checks of *nix processes
- Is there a process running?
- Is it in a running or sleep state (or other healthy state)?
- Basic check of system health
- Check disk usage with DF
- If the disk usage is high, Log the offending disk info to the system log
- Check memory usage of system
- Basic Application health
- Perform basic URL grab / scrape for search string
- Check the amount of memory the application is using of what it requested & of the system total
- Basic actions
- If process Zombied / Dead, Kill it
- Run as a cron job
- Log output to file and to screen in log4J style format
- Take options from CLI where appropriate
This is not to bad, there’s a few things still missing from what I’d like it to be able to do before I start testing it out such as:
- Identify service associated with process and restart if it kills it
- Restart application if URL check fails X number of times
- Tidy up disk space based on known “safe” files that can be deleted (like log files over X days)
That’s all I want to achieve. Once I have that I then need to start with what is a rather tiresome activity which will be the testing of that application to make sure it works in a way that is sensible. After the testing that’s it!
I wish, I will after I’ve done some testing then re-structure the code, although it works as it is it is not maintainable and it is becoming harder to write code for it without it being in the wrong place and not quite doing the right thing… so I want to split the code out so it is easier to see what each bit does. I will probably create a a few classes to put the code in and make it better, either way I’ll grab some advice from people that know how to program first so I can get it into a reasonable structure.
Other than code layout, theres the structure of the data I’m trying to store, at the moment I am trying to use a default constructor in Ruby to create a class for my scores, however this is not working out I’m pretty sure I’ll need to write my own constructor and methods to get and set the values. This way i’ll be able to create a hash to store the data in instead of a list of variables.
Then there’s writing a proper fix to my 50 line case statement which I imagine is no small task but hopefully that will be pleasantly challenging.
is it worth it?
I think so, even if no one ever uses this I am learning more about programming structures which I think will be rather useful in the long term as I imagine there may be a time when being able to code to a reasonable standard may be needed.
Hopefully when the re-structure of the code is done and the last of the features is there it will hopefully be a useful application to deploy and hopefully that will save me from being woken up at 3am to deal with a simple support issue.
So that is basically what I’ve been playing with for a majority of this last week and I will try to continue on with it for now to at least get the final proof of concept done and see how it works out, at that point I’ll start trying to design it a bit better so it works as a proper application rather than a dodgy script.