TIG: Telegraf InfluxDB Grafana Monitoring

13 June 2019

I've set up the open source TIG stack to monitor the services running on these servers. TIG = Telegraf + InfluxDB + Grafana.

  • Telegraf is a server agent for collecting and reporting metrics. It comes with a large number of input, processing and output plugins. Telegraf has built-in support for Docker.

  • InfluxDB is a time series database.

  • Grafana is a feature-rich metrics dashboard supporting a variety of backends including InfluxDB.

Each of the above runs in a Docker container. Architecturally, Telegraf stores the metrics data that it collects into InfluxDB. Grafana generates visualizations from the data that it reads from InfluxDB.

Here are the CPU and memory visualizations for this blog, running on Pharo 7 within a Docker container. The data is as collected by Telegraf via querying the host's Docker engine.

Grafana Pharo CPU

Grafana Pharo Memory

Following comes to mind:

  • While Pharo is running on the server, historically I've kept its GUI running via RFBServer. I haven't had to VNC in for a long time now though. Running Pharo in true headless mode may reduce Pharo's CPU usage.

  • In terms of memory, ~10% usage by a single application is a lot on a small server. Currently this blog stores everything in memory once loaded/rendered. But with the blog's low volume, there really isn't a need to cache; all items can be read from disk and rendered on demand.

Only one way to find out - modify software, collect data, review.

Pharo SQLite I18N Enhancements

2 March 2019

I've enhanced the Pharo SQLite library to be even more multilingual. It has always supported data elements that are Pharo WideString instances, these being converted to/from UTF8 transparently by the library. Now the library also handles multilingual table names, column names and default column values; in other words, multilingual SQL statements.

To install in Pharo 7, load GlorpSQLite from the Catalog Browser.


| db |
db := UDBCSQLite3Connection openOn: '/tmp/ml.db'.
[   "Chinese table name, column names, and default column value."   
    db basicExecute:  'create table 表一 (键一 integer primary key, 列二 text default ''中文'');'.
    "Insert a row, taking default column value for the 2nd column."
    db basicExecute: 'insert into 表一 (键一) values (NULL)'.
    "Insert another row, specifying a value in Chinese for the 2nd column."
    db execute: 'insert into 表一 values (NULL, ?)' 
        with: (Array with: '值二').
    (db execute: 'select * from 表一') rows inspect.
] ensure: [ db close ]

Inspector shows that it isn't quite I18N, although Transcript is:

Pharo SQLite I18N

From the SQLite shell:

% sqlite3 /tmp/ml.db 
SQLite version 3.27.2 2019-02-25 16:06:06
Enter ".help" for usage hints.
sqlite> .header on
sqlite> .schema 
CREATE TABLE 表一 (键一 integer primary key, 列二 text default '中文');
sqlite> select * from 表一;

Testing and feedback welcome, especially on which other parts of the library needing internationalization.

Pharo 7 Multilingual Input on Windows 7

22 February 2019

On Windows 7, setting up multilingual (for me, Chinese and Japanese) input for Pharo is straightforward: Outside of Pharo, configure Windows multilingual input. Start Pharo and choose a font such as Arial Unicode MS. Then, just switch Windows's input system using hot-key or mouse click, and type, or write, as the case may be.

Pharo on Windows multilingual input

Nvidia X11 hardware acceleration on Ubuntu 18.04

19 February 2019

After reinstalling Windows 7, I set my laptop up to dual boot Xubuntu 18.04. My laptop has an integrated Intel i915 graphics chip and also an Nvidia GeForce GT 330M GPU. This post describes how I set up X11 to use the GPU.

Start by finding out which drivers are in use and available:

% ubuntu-drivers devices
... currently running nouveau
... recommends nvidia-340

Install the recommended driver and reboot:

% sudo apt-get install nvidia-340
% sudo shutdown -r now

After the reboot, VT-7 showed a black screen. VTs 1-6 were still available and the machine was otherwise functional. X.org.0.log recorded that the Nvidia driver had set (the graphics) mode to NULL.

To fix:

% sudo apt-get install nvidia-prime
% sudo prime-select nvidia
% sudo shutdown -r now

The X environment came back. To validate:

% inxi -G
Graphics:  Card-1: Intel Core Processor Integrated Graphics Controller
           Card-2: NVIDIA GT216M [GeForce GT 330M]
           Display Server: x11 (X.Org 1.19.6 ) drivers: modesetting,nvidia (unloaded: fbdev,vesa,nouveau)
           Resolution: 1920x1080@59.94hz
           OpenGL: renderer: GeForce GT 330M/PCIe/SSE2 version: 3.3.0 NVIDIA 340.107

There's a tool to switch between the Nvdia and Intel chips:

Nvidia Profile Switching


% glxgears -info
13122 frames in 5.0 seconds = 2624.275 FPS
13039 frames in 5.0 seconds = 2607.778 FPS
13916 frames in 5.0 seconds = 2783.134 FPS
11971 frames in 5.0 seconds = 2394.196 FPS

For comparison and contrast, an even older GPU-less laptop managed about ~60 FPS running glxgears.

As for Pharo, the OSWindow external operating system window examples, such as SDL2AthensDrawingExample, now only run in Nvidia mode and crash Pharo instantly in Intel mode:

The program 'pharo' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 100 error_code 2 request_code 154 minor_code 3)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)