NEWS:

CMDB I have known

April 23rd, 2009

Data center management is pretty big. I suspect most big centers have roll-your-own solutions. Here are the open source solutions I looked at:

Just FYI.

Datacenter / network management software

April 21st, 2009

Have you used any software for tracking data center assets? This computer powered by this UPS which is covered by this service contract?

Some background: I asked a similar question on the FreeBSD ISP mailing list. Check that out.

LANG prevents PostgreSQL initdb

April 17th, 2009

I was looking at RackMonkey and RackTables today. As part of the latter, I was installing PostgreSQL on my FreeBSD workstation. I failed. This had worked many times before, on many other servers. This was the first time I’d seen this particular situation.

# /usr/local/etc/rc.d/postgresql initdb
The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.

The database cluster will be initialized with locales
  COLLATE:  C
  CTYPE:    en_US.ISO8859-1
  MESSAGES: en_US.ISO8859-1
  MONETARY: en_US.ISO8859-1
  NUMERIC:  en_US.ISO8859-1
  TIME:     en_US.ISO8859-1
initdb: encoding mismatch
The encoding you selected (UTF8) and the encoding that the
selected locale uses (LATIN1) do not match.  This would lead to
misbehavior in various character string processing functions.
Rerun initdb and either do not specify an encoding explicitly,
or choose a matching combination.

Using the comand line, as the psql user:

[pgsql@subie ~]$ /usr/local/bin/initdb --encoding=utf-8 --lc-collate=C -D /usr/local/pgsql/data
The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.

The database cluster will be initialized with locales
  COLLATE:  C
  CTYPE:    en_US.ISO8859-1
  MESSAGES: en_US.ISO8859-1
  MONETARY: en_US.ISO8859-1
  NUMERIC:  en_US.ISO8859-1
  TIME:     en_US.ISO8859-1
initdb: encoding mismatch
The encoding you selected (UTF8) and the encoding that the
selected locale uses (LATIN1) do not match.  This would lead to
misbehavior in various character string processing functions.
Rerun initdb and either do not specify an encoding explicitly,
or choose a matching combination.

Say what? Googling did not help me. To the novice (that’s me), LOCALE and ENCODING are very odd things to read about. Nothing I read help.

What did help was someone else running the same thing. It ran fine. Both of us were on 7.2-PRERELEASE.

After much look, we discovered the difference was LANG. On my system:

$ echo $LANG
en_US.ISO8859-1
$

On his system, no value. My solution? comment out that line, rebuild the login.conf db (via: cap_mkdb /etc/login.conf), and reran the command. All fine. :)

# /usr/local/etc/rc.d/postgresql forceinitdb
The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.                               

The database cluster will be initialized with locale C.
The default text search configuration will be set to "english".

creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 40
selecting default shared_buffers/max_fsm_pages ... 24MB/153600
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    /usr/local/bin/postgres -D /usr/local/pgsql/data
or
    /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

Prior to reaching the above conclusion, we found another solution which also worked. As the pgsql user, I issued this command.

/usr/local/bin/initdb --encoding=utf-8 --locale=C -D /usr/local/pgsql/data

At this point, I’m not sure what solution is best for the FreeBSD port.

qemu - running emulation

April 15th, 2009

I managed to get CENTOS5 booting today. In a virtual machine on my FreeBSD workstation. This post is mainly just notes for myself.

Create the blank HDD image file on my host OS:

qemu-img create -f qcow2 c.img 3G

Installing the new guest OS, by booting from the ISO image which appears as a CDROM:

qemu -cdrom CentOS-5.2-i386-bin-DVD.iso.iso -hda c.img -m 256 -boot d

Setting up the bridging between the guest and the host OS:

/sbin/ifconfig tap0 destroy
/sbin/ifconfig tap create
/sbin/ifconfig bridge0 destroy
/sbin/ifconfig bridge create
/sbin/ifconfig bridge0 addm tap0 addm em0 up

… where em0 is the NIC on my host system.

# ifconfig
em0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=98<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:23:ae:78:ae:a8
        inet 192.168.1.101 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
lo5: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        inet 10.10.10.2 netmask 0xffffffff
        inet 10.10.10.1 netmask 0xffffffff
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33160
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:bd:11:1f:7a:00
        inet 0.0.0.0 netmask 0xff000000 broadcast 0.255.255.255
        Opened by PID 33013
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 2a:66:5d:fd:62:f9
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 1 priority 128 path cost 200000
        member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 6 priority 128 path cost 2000000

The ifup script:

# cat /usr/local/etc/qemu-ifup
#!/bin/sh
ifconfig ${1} 0.0.0.0 up

To start the image:

qemu -hda /usr/local/qemu/CentOS-5.2-i386.img -m 256 -boot c \
      -net nic -net tap,ifname=tap0,script=/usr/local/etc/qemu-ifup

My references:

  1. http://calamari.reverse-dns.net:980/cgi-bin/moin.cgi/QuickStartGuide
  2. http://www.nongnu.org/qemu/user-doc.html
  3. http://www.gnome.org/~markmc/qemu-networking.html
  4. http://wiki.freebsd.org/qemu
  5. http://www.oszoo.org/wiki/index.php/Main_Page
  6. http://compsoc.dur.ac.uk/~djw/qemu.html

MrOlsen’s startup script:

#!/bin/sh
/sbin/ifconfig tap0 destroy
/sbin/ifconfig tap create
/sbin/ifconfig bridge0 destroy
/sbin/ifconfig bridge create
/sbin/ifconfig bridge0 addm tap0 addm re0 up
/usr/local/bin/qemu -daemonize -net nic -net tap,script=/etc/qemu-ifup -hda /usr/img/RFMS.img -boot c -vnc :10
/sbin/ifconfig bridge0 up

NOTE this day: first time I’ve worked with iptables. This got things flowing:

iptables --flush

OneCMDB - notes for improvment

April 14th, 2009

These are my notes on attempting to setup OneCMBD. Some of these items would be added directly to their wiki, if I they give me access.

At http://www.onecmdb.org/wiki/index.php/Get_Started_V2.0#On_Linux_platforms_2:

  1. bin/onemdb.sh start should be bin/onecmdb.sh start (missing a ‘c’)

    Same for the stop command.

    Same error occurs in the README.

  2. bin/onecmdb.sh contains #!/bin/bash. Why bash? Why not /bin/sh?
  3. ELF binary type “0″ not known - you need to load linux compatibility: kldload linux. This needs to be done in the host system, not the jail.

[root@onecmdb /usr/local/onecmdb]# bash ./bin/onecmdb.sh stop
Lokomo OneCMDB
==============

Copyright (C) Lokomo Systems AB
Lokomo OneCMDB comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions; for
details see `LICENSE’ in the installation folder.

———————————————————————-
———————————————————————-

Lokomo OneCMDB is now stopping.

Using CATALINA_BASE: /usr/local/onecmdb/tomcat
Using CATALINA_HOME: /usr/local/onecmdb/tomcat
Using CATALINA_TMPDIR: /usr/local/onecmdb/tomcat/temp
Using JRE_HOME: /usr/local/onecmdb/jre
Java HotSpot(TM) Client VM warning: Can’t detect initial thread stack location - find_vma failed
Apr 13, 2009 8:58:23 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.
(Unknown Source)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:394)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:343)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:434)
Java HotSpot(TM) Client VM warning: Can’t detect initial thread stack location - find_vma failed
[root@onecmdb /usr/local/onecmdb]#

CMDB

April 13th, 2009

Are any of you running OneCMDB? If not, are you running some other Configuration Management Database?

Best Buy website reports incorrect stock levels

April 8th, 2009

I wanted to buy a netbook tonight. I failed. The website claimed the item was in stock. Off I went.

“Sorry, we don’t carry that item at this store.”

I’m sorry Best Buy, but I’m not driving to another store until you give me accurate information.

Bestbuy stock levels

Incorrect bind column causes HY093

April 1st, 2009

Over the past few weeks, I’ve been learning more about XSL, Javascript, and CSS. Along the way, I’ve been doing much more work with PDO. Yesterday I encountered a 501: Internal Server Error which had me stumped until this morning.

The SQL was something like this:

INSERT INTO mybconfig.keys (key_name, key_type_id) VALUES ( :key_name, :key_id_type )’

Upon calling execute(), the exception thrown was similar to this:

501: Internal Server Error

Description: The server encountered an internal error or misconfiguration and was unable to complete your request.

Message: HY093: SQL: INSERT INTO mybconfig.keys (key_name, key_type_id) VALUES ( :key_name, :key_id_type )

The code looked like this (greatly simplified for demonstration purposes):

$query = $this->tPDO->prepare('INSERT INTO keys (key_name, key_type_id) VALUES ( :key_name, :key_id_type )');
$query->bindValue( ':key_name',  'testing');
$query->bindValue( ':key_type_id', 1);

Look for a while, then find the problem. I know the cause, and will update this post with the solution.

PGCon 2009 Schedule released

March 16th, 2009

The preliminary PGCon 2009 schedule has been released.

PGCon is the premiere PostgreSQL conference. It is simply the best place to meet other PostgreSQL people and learn more. The talks are absolutely amazing, not to mention the great social atmosphere.

If you’re looking to hire any PostgreSQL talent, PGCon is the place to be. You’ll find more PostgreSQL people (DBAs, coders, web developers, core contributers) than at any other conference. If you’re looking for a PostgreSQL job, bring your resume!

If you are a PostgreSQL hacker or would like to be one, PGCon will have more committers and major contributors present than any other conference. Tom Lane will be giving a special talk on how to get your patches accepted.

If you’re a PostgreSQL user, this year’s conference includes more user content than ever before: 6 DBA technique sessions, 5 performance and scaling sessions and 6 talks on new 8.4 features. Take a look at the DBA track.

Plus four tutorials.

The full schedule is at http://www.pgcon.org/2009/schedule/.

Please start making your travel plans now.

Sponsorships are available for companies who want to be a part of the event and send their staff to learn more about PostgreSQL.

Ahh, wrong enigma

March 15th, 2009

I should have tried mail/enigmail-thunderbird not mail/enigmail

Let’s see how this goes.