Monday, December 12, 2016

Percona Monitoring Plugins for Nagios on SmartOS

Using Percona monitoring plugins inside a SmartOS branded zone, I get an error related to the local command.

percona-monitoring-plugins-1.1.7/nagios/bin/pmp-check-mysql-innodb[58]: local: not found [No such file or directory]

To solve this problem, perform the following command against every script (i.e. inside the nagios/bin/ directory).

sed -i 's/^\( \{2,4\}\)local /\1typeset /' *

Monday, November 28, 2016

rsyslog gnutls: could not load module

Starting rsyslog with gnutls configured I got this error:

Nov 27 21:57:03 prometeo rsyslogd-2068: could not load module '/usr/lib64/rsyslog/lmnsd_gtls.so', rsyslog error -2078 [try http://www.rsyslog.com/e/2068 ]

The suggested link is not useful as the description (module could not be loaded - init failed) is too generic.

The problem here was that in the config file, the line DefaultNetstreamDriverCAFile was pointing to a non existent file.


Wednesday, June 15, 2016

We're sorry to see you go


We're sorry to see you go
Your LinkedIn account is now closed. Although you no longer have access to it, it'll take a few weeks for your public profile to disappear from search engines.
You may still receive invitations from LinkedIn members and groups.
Thanks,
The LinkedIn Team

Saturday, April 16, 2016

Giochini elettrificati

Per i lettori italiani.

Ho messo in piedi un sito vetrina dove condivido le mie creazioni elettroniche.
Oggetti altamente artigianali e dilettanteschi. Talvolta brutti e fatti male.

https://www.gioele.xyz

In questo sito raccolgo e presento qualche idea e qualche realizzazione, spesso maldestramente scopiazzate, di semplici e molto artigianali oggetti elettronici fatti in casa (circuiti e roba basata su Arduino) con cui far divertire in qualche modo bambine e bambini.
E magari, perché no, stimolare la loro curiosità nei confronti di hacking, DIY, elettronica e informatica.

Thursday, March 24, 2016

Arduino IDE and persistent serial port (Linux)

In the development of a little project with Arduino, I have to plug and unplug the USB cable a lot of times.
And I have a big annoyance: every time I plug the USB cable again, the port name changes from /dev/ttyUSB0 to /dev/ttyUSB1 and vice versa. So, in the IDE I have to go in Tools -> Port menu and select the right serial port every time before uploading the new sketch.
What a bore!

I've found this post, but the Arduino IDE seems that doesn't detect fancy names like /dev/arduino, but only names starting with "tty".

So my solution, in order to get a persistent name, is based on the http://hintshop.ludvig.co.nz/ blog post, but using a different port name:

sudo vi /etc/udev/rules.d/98-usb-serial.rules

SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="ttyUSB10"

Reload udev rules with:

sudo udevadm control --reload-rules -R

Now in the IDE you can select this port and it never change every time you unplug and plug the USB cable.

Monday, March 14, 2016

OMD: python problem after CentOS yum update

After yum update I got a problem, related to python, with check_mk in the OMD implementation.

Environment:

  • CentOS 7
  • check_mk 1.2.4p5
  • omd-1.20


In the check_mk web page you can see a lot of messages like this in each "Check_MK inventory" check.

(Return code of 5 is out of bounds)

and if you issue the check_mk command you get

Cannot read file /omd/sites/prod/share/check_mk/modules/check_mk_base.py: 'frozenset' object is not callable

My solution was:

cp /omd/versions/1.20/lib/python/hashlib.py /omd/versions/1.20/lib/python/hashlib.py.OLD

cp /usr/lib64/python2.7/hashlib.py /omd/versions/1.20/lib/python/hashlib.py

Wednesday, February 10, 2016

SmartOS: how to clone a KVM machine

Get the disk0 filesystem of the VM to clone.

vmadm get uuid-originvm | json disks

[
  {
    "path": "/dev/zvol/rdsk/zones/uuid-originvm-disk0",
    "boot": true,
    "model": "virtio",
    "media": "disk",
    "image_size": 10240,
    "image_uuid": "d8e65ea2-1f3e-11e5-8557-6b43e0a88b38",
    "zfs_filesystem": "zones/uuid-originvm-disk0",
    "zpool": "zones",
    "size": 10240,
    "compression": "off",
    "refreservation": 10240,
    "block_size": 8192
  }
]

Take a snapshot

zfs snapshot zones/uuid-originvm-disk0@toclone

Create a json file in order to create the new VM.
vi targetvm.json
Please note: there are no disks.

{
  "alias": "targetvm",
  "hostname": "targetvm",
  "dns_domain": "mydomain.it",
  "brand": "kvm",
  "resolvers": [
    "192.168.0.2"
  ],
  "ram": "2048",
  "vcpus": "2",
  "nics": [
    {
      "nic_tag": "admin",
      "ip": "192.168.0.201",
      "netmask": "255.255.255.0",
      "gateway": "192.168.0.1",
      "model": "virtio",
      "primary": true
    }
  ]
}

vmadm create -f targetvm.json

Let's clone the filesystem of the origin VM.

zfs clone zones/uuid-originvm-disk0@toclone zones/uuid-targetvm-disk0

Create a json in order to add a disk to the new VM.
vi adddisk.json

{
   "add_disks": [
      {
          "media": "disk",
          "model": "virtio",
          "boot": true,
          "nocreate": true,
          "size": 10240,
          "path": "/dev/zvol/rdsk/zones/435ca788-4935-ead3-f4e4-94e6eb7dd4b6-disk0"
      }
   ]
}

Let's add the disk to the newly created VM.

vmadm stop uuid-targetvm -F

vmadm update uuid-targetvm -f adddisk.json

This is important.

zfs promote  zones/uuid-targetvm-disk0

From man zfs:

zfs promote clone-filesystem

    Promotes a clone file system to no longer be dependent on its "ori-
    gin" snapshot. This makes it possible to destroy  the  file  system
    that  the clone was created from. The clone parent-child dependency
    relationship is reversed, so that the origin file system becomes  a
    clone of the specified file system.

    The  snapshot  that  was cloned, and any snapshots previous to this
    snapshot, are now owned by the promoted clone. The space  they  use
    moves  from the origin file system to the promoted clone, so enough
    space must be available to  accommodate  these  snapshots.  No  new
    space  is  consumed  by this operation, but the space accounting is
    adjusted. The promoted clone must not have any conflicting snapshot
    names  of  its own. The rename subcommand can be used to rename any
    conflicting snapshots.

Tuesday, January 19, 2016

mod_jk apache 2.4 smartos zone

If, compiling mod_jk, you get

/usr/bin/bash: ../build/libtool: No such file or directory

Then

cd native/
./configure --with-apxs=/opt/local/bin/apxs
mkdir build
cp libtool build/
make
cp ./apache-2.0/mod_jk.so /opt/local/lib/httpd/

Friday, January 15, 2016

tomcat sloooow to start, smartos, kvm: urandom?

A fresh installation of CentOS 7 in a SmartOS KVM virtual machine using a dataset (     image_uuid: d8e65ea2-1f3e-11e5-8557-6b43e0a88b38).
CentOS updated just after the installation.


  • apache-tomcat-7.0.64
  • Java(TM) SE Runtime Environment (build 1.7.0_80-b15)


I noticed that Tomcat, at startup was very very very, help me, very slow to start.
I used strace to look at what was happening (even if I don't understand anything).

I got a lot of

[pid  1279] futex(0x7f5a880a7154, FUTEX_WAIT_BITSET_PRIVATE, 1, {348, 455527976}, ffffffff) = -1 ETIMEDOUT (Connection timed out)
[pid  1279] futex(0x7f5a880a7128, FUTEX_WAKE_PRIVATE, 1) = 0


Just googled around. I found something similar.

So the solution is: to add the following option to java in the tomcat startup script

-Djava.security.egd=file:/dev/urandom

 (like CATALINA_OPTS="$CATALINA_OPTS -Djava.security.egd=file:/dev/./urandom").

Who knows?