RSS
 

Archive for the ‘English’ Category

New gem snmpstats

22 jan

I developed a new gem that includes a command line script (snmpstats) and the class SNMP::Collector for basic information gathering through SNMP.

The script snmpstats can be very useful for system administrators because it simplifies some tasks and hides the SNMP’s boring side.

The git repository for the project can be found in the following url where you can also find a brief documentation about the script and the library: http://github.com/hgfischer/snmpstats

To install the gem, you only need to run the command bellow:

$ sudo gem install snmpstats

That’s all folks! ;-)

 

Ruby Tip #1 – abort

22 jan

For some time I have been studying and practicing the Ruby language. Thus, to register my discoveries I’ll post them as Ruby tips in this blog.

The first tip is about writing to stderr and quitting your script when something goes wrong. It’s a common practice for UNIX hackers do this.

In Ruby there is a lot of ways for doing something and this is one of the few examples.

So, instead of doing this:

STDERR.puts "Something gone wrong"
exit(1)

we can do this:

abort "Something gone wrong"

To know more about the abort method, click here.

That’s it. ;-)