Postgres

Jedes Mal wenn ich eine neue Datenbank auf einem neuen Rechner anlegen will, stellt sich wieder dasselbe Problem: Wie komme ich an die ersten Nutzer? Hier ist es aufgeschrieben.

  1. Als Benutzer root die Datei pg_hba.conf anpassen. Für den Zugriff per Passwort empfielt es sich z.B. diese Zeilen drin zu haben:
    1. host    all         all         127.0.0.1/32          md5
    2. host    all         all         172.26.0.0/16         md5
    ident sollte in der letzten Spalte nicht vorkommen. Ich bin zwar nicht ganz sicher warum, aber es kann sein, dass es mich hier gehindert hat, eine Verbindung zu bekommen.
  2. Ebenfalls als root in der Datei postgresql.conf einen Eintrag listen_addresses = '*' und einen Eintrag port = 5432 anlegen.
  3. Benutzer postgres werden (sudo -s -u postgres)
  4. psql aufrufen
  5. Dem Benutzer postgres ein Passwort verpassen, z.B. mit alter user postgres with password 'xyz';
  6. Nun kann man als beliebiger Nutzer z.B. pgadmin3 verwenden und sich als Benutzer postgres anmelden und so Datenbanen und Benutzer anlegen.

Switch between nvidia and intel

According to an article on Ask Ubuntu it is possible to switch between nvidia and interl graphics card with these simple commands:

prime-select query
sudo prime-select intel
sudo prime-select nvidia

I shall use this next time when using my notebook without power supply to see if it significantly enhances battery life!

Zabbix: How to check a modification of a web page

To check if the content of a certain web page changed is not as obvious as it should be in Zabbix but my experience with Zabbix is limited so I needed some time to figure out how to do this.

First of all you need a host, lets say "java-cup.de". On this host you define an item with a key that is constructed like this:

web.page.get[https://java-cup.de/]

 

This key just retrieves the content of the web page, including all headers. There are more parameters to web.page.get possible but we do not need them, if we supply a complete URL on the first parameter.

There is also the key web.page.regexp but I prefer to collect the full web page in this step because of being more flexible afterwards.

Then we need a trigger that references the just created item. It uses the function changes to tell if the page was modified since the last retrieval.

With just this setup a change is detected on every retrieval, because of the headers being included. There are always the headers date and expires that contain a date and time of the retrieval/expiry of the page, so that changes on every usage of the item.

To avoid this we have to parse the content from the page that we want to watch. This can easily been done by using the Preprocessing tab on the item. Here we can employ a regexp to extract the data that we want to watch.

Even better, we can do this in multiple stages so that we can do the extraction process in small steps. Of course, it isn't optimal to use regexps on HTML but there is no HTML parser available and the XPath parser that we coud use here instead of the regexp will not work on most HTML pages since they are not well defined XML.

Gast-WLAN

Heute Morgen habe ich bemerkt, dass sich ein unbekanntes Gerät mit unserem Gast-WLAN verbunden hat und zwar von 18:30 Uhr bis 23:00 Uhr. Das Gerät hat die MAC-Adresse 06:75:0E:48:D2:50. Komisch daran ist, dass es für diese MAC-Adresse keinen registrierten Hersteller gibt.

Außerdem wüsste ich nicht, wer ohne mein Wissen ein neues Gerät mit unserem Gast-WLAN verbunden haben sollte, schon gar nicht in diesem Zeitraum.

Also: Passwort geändert. Mal schauen, ob das Gerät nochmal auftaucht!

New homepage launched

That took a long time! I needed to relaunch because liferay was too big and too difficult to maintain for me personally. So I decided to go with Joomla again. It is not the big thing I hoped to have but it is a home page. We will see how long that goes.