Metrics Dashboard Comparision for Linux Desktop

I need to know how good/poorly my desktop(Loongson & Rasberry Pi 2) is running, so there should at least exits a solution that can see its realtime and history metrics of the the system like cpu, memory, network, disk io etc.

Also tools like Glances, nmon, sar(sysstat) or atop provide a nice realtime metircs, it can't get its history data easily which it more suitable for massive production use, also no web dashborard for a nicely view, so I just pass them. Systems like Icinga, Nagios, Graphite, Zabbix, etc. are so heavy and complicated which are also not convenient for a 2GB memory desktop use.

Below are some tools that may help you for setting up a tiny to small monitoring/metrics system. At the end, I'll pick up the most suitable one for my own.

psdash
A dashboard overview of the system using psutils and Flask.

The installation is quite straightforward with pip packager manager. Unfortunately, As my Debian jessie testing version, I happened to a "PROTOCOL_SSLv3 is not defined" bug that stop the system running, you can modify the python gevent lib to work around(1, 2).   

The web dashboard is qute lighweight and nice, you can get the realtime data from the every-3-second refresh web automatically, the fatal problem is it can't get the history data and charts.

Linux-dash 
Quite similar to psdash, but comes with more technical stack like Node.js, Go, and PHP. It's offical slogon is "A simple, low-overhead web dashboard for GNU / Linux. (~1MB)", besides that, not much eye-catching point.

ezservermonitor-web 
Besides all the feature psdash and Linux-dash, it also has a simple trigger configuration, Say, for the load average metric, it will be displayed with gauges, when is less than 50%, it's green, when is more than 76% util, it turns to red. Also, it has the built-in ping and servers check function, which is handy for your family internal use.

Ezservermonitor also has a console based tools called EZ SERVER MONITOR`SH, without web interface.

Web VMStat 
It’s a small application written in Java and HTML which displays live Linux system statistics. It just takes over vmstat command in a pretty web page with SmoothieCharts and websocketd in realtime.

munin 
The last is usually the best. Yes, it's the only one I want to recommend for you, no matter how many desktops you have, Munin can handle them easily and more importantly, it only taks you few minutes depending on your network quality if you use apt/yum to install it directly, the real out-of-box product. it used RRD as it's backend storage engine. by default, 300s interval which I think it's enough for most of desktop users, with at one year history. 

If you are unsatisfied with its hundreds of plugins, just write a new one or porting from any Unix platform by yourself by any scripts language. This is its killer feature.

After the above comparision, you could choose ones according to your demands.

Want near-realtime(5m or so) and history data with charts? Munin is a best option.

Want realtime data, without history data? psdash, Linux-dash, Web-VmStat are those you're looking for.

Still not satisfied? You may consider using Graphite, Zabbix if you have system admin experience, since both are enterprise level open source product.

Setup a AQI(Air Quality Index) Monitoring System with Dylos and Raspberry Pi 2

I have been using air purifier for years in Beijing, China. So far so good except the only problem troubles me, is that effective? is my PM2.5 or PM10 reduced? the answer is probably obvious, but how effectively is it? Nobody knows.

At the morment, Dylos is the only manufacturer that provides consumer level product with accurate air quality index, so, not many choice. I got a Dylos air quality counter from Amazon, there are many products, if you want to export the index data from the black box into your desktop for later process , you'll need at least a DC 1100 pro with PC interface or higher version. Strongly not recommend buying from Taobao or the similar online stores, as far as I saw, None of them can provide the correct version, most of them exaggerate for a higher sale.

Now, half done. You need to Raspberry Pi, at the time of writing, Raspberry Pi 2 is coming to the market. I got a complete starter kit with a Pi 2 Model B, Clear Case, power supply, WiFi Dongle and a 8GB Micro SD.

In order to make the Raspberry Pi up, it's better to find a screen monitoring, or it will take huge pain to you.

After turning Dylos and Raspberry Pi on, the left process is quite simple. You need to connect the Dylos and Raspberry Pi with a serial to USB interface, the serial to USB cable is uncommon these days, if you are a network engineer, you should be quite familir with the cable, else, you can get one from online or somewhere else.

Now, write a tiny program to read the data from Dylos. You can make use of Python's pyserial module to read the data with a few lines. Here is mine. Besides that, you can use other language to implement, such as PHP. The interval depends on your Dylos collecting data interval, the minimum is 60s, ususally 3600s is enough.

Once got the data, you can feed them into different metric systems like Munin, or you can feed them into highcharts to get a more pretty look.

Installing Debian jessie on Loongson notebook(8089_B) with Ubuntu keyboard suits

I got a white yeeloong notebook last year, and it costs me 300RMB which ships with a Loongson 2F CPU, 1GB DDR2 memory bar, and a 160GB HHD.

The netbook has a pre-installed Liunx based operating system, I can't tell its distribution, and it looks quite like a Windows XP. Since then, I put it in my closet and never use it again.

Yesterday the untouched toy crossed my mind, so I took it out and spent a whole night to get Debian Jessie working on my yeeloong notebook. Here are some procedures you may need to note if you want to have your own box running.


At the beginning, I download the vmlinux and initrd.gz file from Debian mirror. I set up a TFTP server on my mac, ensure it's working from local. later I power on the notebook,  enter into the GMON screen, using ifaddr to assign a IP address manually, and it can ping to my mac, this means the networking works now. Problem comes since then, I execute load directive to load the vmlinux file, everytime after several minutes waiting, it shows connection timeout, after some time debuging, nonthing exceptions can be found since the tftp server and the connectivity between my mac and yeeloong both normal.

I give it up and find a USB stick, this time I'm going to put vmlinix and initird file into USB and let the notebook boot from USB. You have to check that the filesystem is formatted as ext2/ext3. Most importantly, the single partition must not be larger than 4GB, say, you have a 8G USB,  you need to format at least 3 partiitons, 3-3-2 is a good choice. If the partition is larger than 4GB, you can't even enter into PMON, and it just stalls here after you power on with USB attached to your notebook with "filesys_type() usb0 don't find" showing on the screen.


After entering into PMON, you should find your USB using devls directive, then type:
> bl -d ide (usb0, 0)/vmlinux
> bl -d ide (usb0, 0)/initird.gz

Don't copy directly, you need to figure out partitions location in your USB, maybe yours is (usb0, 1), and your vmlinux file is called vmlinux-3.14-2-loongson-2f.

Be patient, I waited about 10 minutes before both files loaded into memory successfully, press "g" to let it run. Haaaaam, there're fews steps to get a brand new toy.

The installation process now begins, press Yes/No, answer questions as your normal. at the end, I choose to install LXDE desktop environment. For me, I waited about 2 hours to finish the installation.

Now, reboot, and finally, it enters into LEVEL 3 without X because of some buggy tools.

Download the xserver-xorg-video-siliconmotion package from here, don't upset with the tool's version, you need some modifications to make it work on jessie.

Using dpkg to unpack the deb file, remove xorg-video-abi-12 from its control file in "Depends" section, repack the file, before dpkg -i, using apt-get to install the xserver-xorg-core file.

startx, you will get the final screen. The default network manager for LXDE is Wicd Network Manager which is fine, what if you want to use command line, you need to modify the interface file and some other steps before connected to internet. 

Wow, with Ubuntu keyborad suits, it's definitely a good combo.

How about the performance? No matter what I run, it always ends with CPU bound, and the average load with LXDE is around 1. That does not hurt, since it does not bother me too much, but It takes more than 3 minutes to boot up, probably slower than the majority of Windows users ;-)

Since the dummy box is terribly slooow, Why you buy the box? well, just for fun.

换了套新工作环境

一年折腾一次,一次折腾两天。
花了点时间上了套四屏幕的工作环境。之前的工作环境是:
* 一台 mba,基本用来拿在手上到处跑。
* 一台台式机,Arch,还是 3.4 的 kernel,看 /lost+found/ 还是 12 年 2 月分的,工作主力,印象中是自费笔记本给公司打了大半年工之后给配置的。
* 台式机左边是另一台台式机,配置跟上面的类似,主要用来看监控,看图。使用时间跟上面一样。

后来随着要盯的图越来越多,要开的屏幕越来越多,两台 Arch/Awesome 已经无法满足需求了,尽管一台 Arch 默认可以切换 9 个屏幕,但是切来切去依然是是很不方面。
于是搞了个四屏的架子&一个四屏的显卡。架子型号是 BEWISER S4;四屏的显卡是 Nvidia quadro nvs

下图是新的环境。

把四台显示器上架捣鼓捣鼓一个多小时,显卡的 setup 绕了些弯。
最初听说是不支持 Linux,心想既然看看监控也就忍了,真的上上去了之后发现 Win7 太难用了。一块屏幕下面没法继续分屏,即使人肉把两个浏览器堆在一个屏幕上,由于浏览器乱七八糟导航栏之类的存在还是会浪费非常多的空间。即使他们可以手动去除,但是,用过平铺窗口管理器的都知道,他们离心目中想要的样子还是差很远。
于是尝试用目前服役的 Arch 来安装这块多屏显卡,结果手贱在升级之前 Syu 了下,整个系统都玩挂了,不想折腾了,确定 Ubuntu 可以安装 awesome 之后,直接搞了台 12.04 的机器过来。
安装 NVIDIA-Linux-x86_64-340.46.run 这个驱动,安装之前要关闭一切的 X,具体的安装过程看这几篇文档就好了(1, 2)。 

如果最后没成功,按照他的提示基本就是要么显卡没插系统没检测到,要么就是系统有其他不兼容的驱动存在等等之类问题。
nvidia.ko 生成了之后,按照我这边的情况是没发使用的,我的 master screen(四个显卡口的第一口)系统起起来之后一直是 Ubuntu 的紫色屏幕,后来估计是 xorg.conf 的问题,一看果真是。
xorg.conf 的书写还蛮麻烦的,需要先熟悉下语法。另外务必写对 BusID,否则再怎么折腾都是起不来的。
Nvidia 自带的 nvidia-setting 不是很好用,我试了几次没成功就直接改 xorg.conf 文件了,理论上 nvidia-setting 的所有变更都会反映到 xorg.conf 里面。
折腾到这里就差不多了,Ubuntu 该装什么就装什么,改成 awesome 的,外表看上去跟 Arch 差别不大, 目前的是:
* 左边一台继承自之前老的纯 Arch,已经不大用了,准备还给 IT 了。
* 中间四台屏幕由右下角的主机带着,主力工作环境,Ubuntu 12.04+Awesome 管理器,几乎所有的工作都在上面进行。上方的两块用来看我们核心业务的 dashboard,zabbix 的监控会在另外的一个桌面上,左下角的主要是浏览器,firefox 全局 sock proxy,chromium 的不开 proxy,右下角的写代码登录线上机器。OpenVPN,anyconnect,synergys,sock proxy 全部在右下角的另外一个桌面上。
* 右边的 mba 依然是打下手的工作。之前是把 anyconnect 放在这台机器上的,后来发现 Ubuntu 可以通过开启 OpenVPN 以及 anyconnect(anyconnect 真是个恶心的玩意儿,给你强行推送路由表,给你强行修改 iptables。推就推了,还把整个 10/8 的全给推过来了,要是你的内网也是这个段的,那是彻底废了),mac 现在除了开会几乎不用了,不过用 preview 看 pdf 倒是蛮爽了,尤其是高亮操作,Linux 下目前没有一款软件能真正的实现此类功能。
* 全局通过 synergys 以及一个 thinkpad 键盘控制所有的屏幕操作。
新安装的 chromium 好像没法在浏览器里面设置 socks5,不过可以通过命令行直接启动。一套好的做工环境对效率的提升还是非常明显的。
我这次可没黑苹果,别再发生什么口水战了。

Bug #1 @ launchpad.net

大家知道 ubuntu 的 launchpad.net 上的第一个 bug 是什么吗?

Mark Shuttleworth 大大在 2004 年的 08 月 20 日亲自提交了第一个 bug: Microsoft has a majority market share

 

经过近 10 年的发展,Ubuntu 在 desktop 市场还是取得了不少份额的,但是前方路途依然严峻。不管何种发型版本,Ubuntu 也好,Fedora 也罢,毕竟是 *nix 阵营的,内部竞争总比外部厮杀好。顺祝 microshit 早日结束它那又臭又长的垄断地位。

我为什么坚持使用 *nix 而不使用 MicroSHIT

最近有不少推友说把用了 N 久的 Ubuntu、Debian 什么的卸掉了,用回了久违的 MicroSHIT。那我来写篇『我为什么坚持使用 *nix 而不使用 MicroSHIT』来提出点『反对』意见吧。

先简单的介绍下我自己,我是一名 operations engineer,然后日常的 desktop 是 Arch Linux。

貌似都是以利与弊或者得到失去来总结的,那我也按照这个套路来吧。

首先,用 MicroSHIT 的那坨东西会失去或者说煎熬什么。

1. 要安装一个类似 PuTTy,或者 SecureCRT 类似的玩意儿,一个非常难用的 『terminal』,弄不好还被搞个后门。这个对于一个 7×24 的工程师来说,没有了 ssh 就没有一切。

2. 有人说用 MicroSHIT 主要是用他的 Office 套件,不过大家扪心自问吧,有多少人用的是盗版的或者破解的?有多少人是花钱购买的?或者有人说我可以使用 WPS,支持国产嘛,不过你愿意每次打开,右下角都要弹出一个恶心的窗口,让你注册登录那个什么金山快盘,另外,我在 MicroSHIT 上的技能确实比较烂,不知道如何屏蔽这类的垃圾应用。

3. 娱乐,游戏,音乐,电影?这类我的要求不是很高。游戏基本不碰,电影要么 online 要么 Transmission 拖下来直接 mplayer 看,音乐全部 online。

4. IM?要么 gmail,要么 gtalk,你如果愿意被审查,愿意被强奸,你完全可以使用这个全球安装量最大的,同时在线人数最高的,灰常灰常流弊的流氓软件。

5. 有人说 MicroSHIT 下安装软件方便,看到这话我就笑了,那些安装 QQ 的每次点击那个 .exe 文件都会有很多选项吧,『是否要安装 xx』,『是否要安装 oo』。我相信看我这篇博客的不可能不在乎这些而直接默认全部『下一步』,这个貌似能体现 MicroSHIT 下软件的流氓所在,国外的相对较好,大陆流弊的都是不问你愿不愿意安装『xx附件』就直接给你安好了。

有了上面的几点,完全没有理由使用这么一个难用的流氓 OS。下面谈谈用 nix 的好处,这个 google 能到一大把,这里只说个性问题。

1. 有人说 *nix 桌面难用,我个人觉得我现在这套 Arch+Awesome 的非常简洁高效,想怎么切就怎么切,想怎么新建窗口就怎么新建窗口,最差默认安装个 Ubuntu 12.04 都比 MicroSHIT 下新建个窗口来的方便。

2. 办公问题,无非就是 office 的问题,这个我通过行政手段基本已经避免,也就是说,我基本不收 .doc 类的文件,即使要用,gdocs 还能凑活着看。

最后说说 Mac,10 个有 7 个是装逼使用的,1 个真正喜欢的,还有 2 个是既不会用 *nix 又不屑用 MicroSHIT 的。