Am I reinventing a wheel?

The thing that hath been, it is that which shall be; and that which is done is that which shall be done: and there is no new thing under the sun. Is there any thing whereof it may be said, See, this is new? it hath been already of old time, which was before us. (Ecclesiastes 1:9,10)

Outthentic is a tool for rapid plugin developments. When I say "plugin" I mean a little utility to solve a specific task.

Having a risk to reinvent the wheel, from time to time I still start to create some useful stuff, at least useful from my point of view ...

Disk usage monitoring

This little plugin does what is stated at the header:

  • checks disk space in partition by partition basis
  • alerts in case of shortage
  • a threshold parameter could be set and equal 80 default, which means before 80 percentage of disk usage we are ok.

Sparrow

This plugin is written on outthentic and better way to install is sparrow - outthentic plugin manager. So here we go:

# a basic prerequisites  
apt-get install curl
cpanm Sparrow

# now we install plugin
sparrow index update
sparrow plg install df-check
sparrow project create system
sparrow check add system disk
sparrow check set system disk df-check
sparrow check ini system disk # skip this step if you want default settings

Once plugin is installed one my run it:

sparrow check run  system disk | perl -n -e 'print "    ", $_'
# running cd /home/vagrant/sparrow/plugins/public/df-check && carton exec 'strun --root ./  --ini /home/vagrant/sparrow/projects/system/checkpoints/disk/suite.ini ' ...

/tmp/.outthentic/9034/home/vagrant/sparrow/plugins/public/df-check/disk-shortage/story.t ..
ok 1 - perl /home/vagrant/sparrow/plugins/public/df-check/disk-shortage/story.pl succeeded
ok 2 - stdout saved to /tmp/.outthentic/9034/gJBohrjXGg
# threshhold: 93
# verify ... /dev/sda1
# verify ... udev
# verify ... tmpfs
# verify ... tmpfs
# verify ... tmpfs
# verify ... tmpfs
# verify ... none
# verify ... none
ok 3 - output match /(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/
ok 4 - enough disk space (74%) on /dev/sda1
ok 5 - enough disk space (0%) on udev
ok 6 - enough disk space (1%) on tmpfs
ok 7 - enough disk space (1%) on tmpfs
ok 8 - enough disk space (0%) on tmpfs
ok 9 - enough disk space (0%) on tmpfs
ok 10 - enough disk space (90%) on none
ok 11 - enough disk space (90%) on none
1..11
ok
All tests successful.
Files=1, Tests=11,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.04 cusr  0.00 csys =  0.06 CPU)
Result: PASS

And finally make it cronable

crontab -e 
*/30 * * * *  sparrow check run  system disk --cron

Is it a better wheel?

Well, ... I think so )))), at least my thoughts are:

  • it is written on perl
  • it has clear and simple installation and configuration layout
  • it has minimal dependencies - a few perl modules and df utility itself
  • it is hack-able - consider some improvements? check out a source code and make a MR!

Leave a comment

About melezhik

user-pic Dev & Devops --- Then I beheld all the work of God, that a man cannot find out the work that is done under the sun: because though a man labour to seek it out, yet he shall not find it; yea further; though a wise man think to know it, yet shall he not be able to find it. (Ecclesiastes 8:17)