Archive for November, 2012

How to find how much power (electricity) consumption a server or PC has?

Friday, November 2nd, 2012

Kill-A-Watt track system power electricty consumption on GNU / Linux servers and FreeBSD
A friend of mine today ask me if I have clue if it is possible to track his home computer Consumption with some piece of Software?

The question is quite interesting, since I run a home server with Linux and it would have been nice if I can exactly track how much electricity per month it  consumes

Now knowing, the answer I first checked online for some kind of software and all I can find something that does something similar but all can find is powertop.

Though powertop is nice Linux tool to keep an eye which program on PC consumes most from overall consumed electricity and order the programs and modules based on electricity consumption it is not providing information on overall electricity consumption.

As the topic seem to be some interesting, I've decided to ask in irc.freenode.net #deiban
Here is a paste from  irssi channel log:

17:21 < hipodilski> hi any idea, how can I find how much electricity a server conmuses per month
17:21 < hipodilski> is there some some kind of software
17:21 -!- digdilem [~digdilem@plague.digdilem.org] has joined #debian
17:22 < babilen> hipodilski: I would recommend an electricity meter rather than software
17:22 -!- tommy_e [~tommy@81.27.221.202] has quit [Ping timeout: 260 seconds]
17:22 < jelly-home> watt meters ftw
17:22 -!- msx [~msx@190.194.114.10] has joined #debian
17:22 -!- blackshirt [~najwa@103.3.223.5] has left #debian []
17:23 < hipodilski> yes but i don't have electricity metter, if there is software it would be interesting to try it
17:23 -!- badiane [~gdurand@D8FF67fa.cst.lightpath.net] has quit [Remote host closed the connection]
17:23 < xand> hipodilski: no, you need a hardware device.
17:23 < jelly-home> now everything can be solved in software, hipodilski
17:23 < jelly-home> not*
17:23 < jelly-home> dammit
17:23 < xand> unless you have a very fancy PSU, software can't find that out
17:23 < babilen> jelly-home: hehe, nice typo !
17:23 < vacuous> hipodilski yes
17:24 < HelloShitty> nsadmin, are you out of ideas for me?
17:24 < vacuous> there's various devices that do it
17:24 -!- firecode [~irc@unaffiliated/firecode] has joined #debian
17:24 < vacuous> you can either get a killawat which are highly innacurate but it might give you a clue
17:24 < vacuous> and they're very cheap too
17:25 < vacuous> you can get a device which measures your entire houses electric, then you just turn off all the appliances and run the
                 server only
17:25 -!- trysten [~trysten@37-251-103-145.FTTH.ispfabriek.nl] has quit [Quit: be back]
17:25  * babilen likes that approach
17:25 < babilen> But this is getting a bit too off-topic. Maybe hipodilski wants to take it to #debian-offtopic
17:25 < vacuous> or you can keep all fridges on, check what the reading is and then negate that from the total
17:25 < hipodilski> yes thanks 🙂
 

The answer makes it clear right of time of writing this post there is no software for Linux or BSD that keeps track electricity consumption daily or monthly

I've googled to see what is Kill-A-Watt hardware? and found fuzzy named device Kill-A-Watt for sale on ThinkGeek's website for the not so expensive 24.99$

To use Kill-A-Watt device is to be connected inside the power plug and then PC or Server has to be plugged into  Kill-A-Watt dev. I've red also (while researching) many Intelligent UPS devs has support for keeping log of discharged energy, so just buying a good UPS with web administrator or even a cheap one providing statistical information of UPS use via serial port should be another alternative to track ur server consumption.

tmux – FreeBSD, BSD* and Linux alterinative to GNU screen terminal emulator

Thursday, November 1st, 2012

tmux gnu screen (newer) alternative terminal emulator for Linux, FreeBSD, OpenBSD
After my yesterday blog post explaining basis GNU screen use, I've decided to blog a bit more on the topic as I find terminal emulation to be quite interesting 🙂

Just like on on GNU / Linux, GNU Screen is available and installable via FreeBSD port – /usr/ports/sysutils/screen. Though screen is compatible with FreeBSD, it is not from scratch written to run on BSD architecture, but rather ported. Besides, that within the fild of terminal emulation, there are plenty of recent developments and feature richer programs available from install already. One of those I reference is tmux..  tmux's is superior to screen in that it is a re-writen terminal (from scratch) terminal emulator – multiplexer (as referenced in man tmux).

Another fundamental difference is it comes licensed under "less restrictive" BSD license (interesting fact is BSD has only 3 clauses), whether to GNU Screen applies GPLv 2 / 3 (4 freedoms clauses).
Tmux is presently existing for multiple architectures besides BSD including Linux and even as I check in its documentation has support for HP-HX and IRIX.

To install / use tmux on FreeBSD / NetBSD install port /usr/ports/sysutils/tmux with

: freebsd# cd /usr/ports/sysutils/tmux
freebsd# make install clean
....

Installing mux on Debian GNU Linux is available straight from default package repositories, i.e. :

debian:~# apt-get install --yes mux
....

It is inteersting fact to mention, since OpenBSD 4.6 – Mr. Theo De Raddt and friends decided tmux to part of the base system! This means a lot since OpenBSD has always existed with the main ideology to be the most secure UNIX / BSD based OS around. This fact probably means from purely secure stand point tmux might be better choice than gnu screen

Another reason why tmux might be better alternative to Screen for BSD users besides security, is its configuration is much more simplistic whilst compared with Screen. If you have used screen, already you should surely know how complicated things are when it comes to configuration and screen (set) variables.

tmux's pre-defined command bindings are similar to SCREEN's, the difference is instead of Screen's:

CTRL + a + (letter)

key bindings are invoked with:

CTRL + b + (kbd letter)
 

People who already are acustomed to screen (like myself 🙂 )  would not be easy to re-learn use CTRL + b, thus it is helpful to revert default tmux CTRL + b  to screen's CTRL + a.


http://niallohiggins.com/2009/06/04/tmux-a-bsd-alternative-to-gnu-screen/

$ echo 'set -g prefix C-a' >> ~/.tmux.conf
$ echo 'bind-key C-a last-window' >> ~/.tmux.conf

Moving over virtual windows in tmux just like in screen can be done using:

CTRL + a + 1 … 9

One has to be careful, as pressing CTRL + a should be done with a llittle delay before pressing the next letter, otherwise the command does not take affect.
 

Detaching emulated session, in tmux is done like in screen with pressing:

CTRL + a + (d [half a sec delay before pressing])

Attaching to latest detached tmux session is done with:

tmux attach

 

There are plenty of other stuff and applications but here I will not get in detail as it is all  in man page.


tmux
is great for BSD users,
but for Linux users  byobu is  more interactive and user friendly (out of the box – with no need for extra configs)

Here are 2 screenshots from tmux website:
advanced tmux use 4 squares split virtual terminals / tmux use screenshot

tmux screenshot with shared multiple wins

Check how webpage looks with Internet Explorer on Linux and FreeBSD with Mozilla Firefox (Netrenderer Firefox plugin)

Thursday, November 1st, 2012

Simulate Internet Explorer in screenshots on GNU / Linux and FreeBSD using Netrenderer in Firefox - Internet Explorer testing tool for web developers on Linux and FreeBSD

I'm not full time web developer. But sometimes, I develop websites too or just had to do some website testing.
I'm using GNU / Linux and BSD as main server and desktop platforms for many years already and hence I don't have regular access to Windows OS and respectively Internet Explorer. In that manner of thoughts it is very useful to have a way to check if a certain website I create displays fine on Internet Explorer 6,7,8 too.

Usually whether I need to test if website displays properly its elements in Internet Explorer I do use the infamous  http://ipinfo.info/netrenderer/index.php – I guess it is almost impossible anyone is developing websites on Linux and don't know it :). Fortunately while I was googling to remind myself about the exact link location to netrenderer, I've stumbled upon Mozilla Firefox add-on extension which does precisely what ipinfo.info/netrenderer/ website does – i.e. renders a website with HTML Web Engine compatible   to most Internet Explorer versions and creating screenshots on how a website would look under Internet Explorer. Of course the plugin is not a panace and since it only makes screenshots whether there are problems with interactivity (Javascript AJAX) of a website on IE will the plugin will be of zero use. However in general it is good to know if at least the website elements are ordered fine.
After the plugin is added in the usual way as any other plugin in FF, you can start using it with keyboard shortcuts:

Ctrl+Shift+F5/F6/F7/F8 – respectively renders the page in IE5.5, IE 6, IE 7 / IE 8 Beta 2

Pressing CTRL + Shift + FX, makes the IE screenshot of site using http://ipinfo.info/netrenderer/

I'm currently running latest Firefox version 16.0.2 and here plugin works, fine I guess on most FF releases not older than few years it should work fine too.

Below is description of the plugin, as taken from plugin website:

IE NetRendered Add-on Description

Adds buttons, tools menu and contextual menu entries to get a screenshot of the current page with IE NetRenderer.

Keyboard shortcuts are also available: Ctrl+Shift+F5/F6/F7/F8 to render the page in IE5.5/6/7/8 Beta 2 (Cmd+Shift+F* on Mac).

Really useful for webmasters which are not using Windows!

You can also access the IE NetRenderer service here: http://ipinfo.info/netrenderer/index.php

Please note that the extension developper is not affiliated with GEOTEK, providing the IE NetRenderer service. You can visit his website here: http://nicopensource.free.fr/