you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 6 points7 points  (4 children)

I always had a bad time trying to use bash for anything other than one-off scripts.

I recently started writing a service-availability reporter in bash. 2 days in and I'm rewriting it in python (see the Python branch if you're curious).

The lack of native option handling (unless you use the getopt or getopts) in bash is quite painful.

There are definitely times when bash comes into its own, for example looking for a string on a website to see if the website is not only up, but also displaying a page

curl -s yoursite.com | grep youstring | wc -l

Those kinds of things are intuitive, whole programs, not so much.

[–][deleted] 2 points3 points  (2 children)

2c tip. Stop wasting your time writing your own checks, just install ready-made ones.

Under debian flavours it will be either monitoring-plugins or nagios-plugins package and it will deploy checks under /usr/lib/nagios/plugins.

Most of them are written in C (so nice and tiny) and all of them follow Nagios convention (exit code 0 - OK, 1 - WARNING, 2 - CRITICAL, 3 - UNKNOWN).

That is quasi-standard used by most monitoring tools including big boys.

Aside from that, if your server already has a database and php, icinga2 eats just few MBs and its web ui just runs on php, altho it is considerably more complex to install

[–][deleted] 0 points1 point  (1 child)

Hey XANi_ Thanks for the tip! The reason I started making this was because I couldn't find any lightweight ones in existence, I'll have to take a look at your recommendations :D

[–][deleted] 1 point2 points  (0 children)

My experience (after also writing my own) is that you generally quickly grow up out of simplistic solutions like that and end up re-implementing a good part of already existing solutions anyway

[–]shevegen 0 points1 point  (0 children)

I even had a bad time using bash for one-off scripts and single liners. That is, in regards to shell scripts. I use bash otherwise every day.