wwwhizz' blog Jan Kazemier & his music, photography, nerd-projects, developing, electronics and gadgets

29Jun/101

Blog 2.1

I've been doing a few updates to my website. I have:

  • updated:
    • WordPress
    • WordPress plugins
    • LightWord theme
  • chosen the wider variant of the LightWord theme
  • created a child-theme of the LightWord theme
  • added a few plugins
  • added my twitterfeed to the right
  • created a custom 404-page ;)
  • I'm planning to add a few pages:
    • Change my avatar
    • My homemade music
    • Stats
    • My twitterfeed
Filed under: Uncategorized 1 Comment
9Feb/100

Re-importing ICal Calendar in Google Calendar (Agenda)

My time-tables are provided in the ICal-format. Since my time-tables had changed, I wanted to reimport the .ics-file for that course in my Google Calendar after deleting them first. Trying to do so gave the error:

Failed to import events: Some of the events in this file were not imported because you had imported them to Google Calendar before. Other events in this file have been imported..

Apparently Google prevents you from (accidentally?) importing the same appointments twice. However, I wanted to import them anyway. Luckily for me, Google only checks the UID. Since all my UID's started with UID:INBPC-08, I did a find and replace all on the text, and changed it to UID:INBPC-09. Now GCal was able to import them again :)

Cheers!

30Jan/100

su: Bad item passed to pam_*_item() fixed

I had a problem when trying to su. Everytime I tried to su it gave the following error:

su: Bad item passed to pam_*_item()

Since I didn't find my solution on the internet (the only solution I could find was removing wrong entries from /etc/environment), I'll post mine here:

I had a floating equals-sign in

/etc/default/locale

You should check that file, it should only contain something like

LANG=en_US.UTF-8

If that doesn't fix your problem, you might want to check your /etc/pam.d/su for strange entries.

Tagged as: , No Comments
20Oct/090

Adding tabs or tildes in LaTeX

(Just a reminding note to myself)

Backslash:
\backslash may be used in math formulae, but not into text itself, use \textbackslash instead
Tilde:
You can use \textasciitilde in text, $\sim$ in math and another option is \texttildelow.

Tagged as: No Comments
7Jul/090

Worklog Midibox #2

So, here's the beginning of the story about my MB-6582 MidiBox. As pictures say more than 1000 words, I've added as much pictures as possible :)

April 14, 2009

090417_1_big

Still quite empty

On the 14th of April, the board still was quite empty, just a few resistors inserted. The soldering had begun. :D

Bent leads

Bent leads

At the bottom you can see how I bent all the leads, just before cutting and soldering them.

Check out those shiny resistor-bridges!

Check out those shiny resistor-bridges!

Just adding some more resistors...

Voltage regulators

Voltage regulators

Voltage regulators in place. As you can see, the IC-sockets, headers, DIN-sockets and the power-switch also have been placed already.

April 18, 2009

8 pieces of the 6582 SID chip

8 pieces of the 6582 SID chip

Received my SID-chips! Hooray! Those chips will eventually actually synthesize the sound :)

I can't resist

Capacitors, the lot of 'em

Caps in all shapes and sizes :)

Caps soldered to the board :)

Caps soldered to the board :)

And there they are soldered :)

Great, enough backlogging for today. Expect more soon :)

27Jun/090

phpMyAdmin: Invalid hostname for server 1. (updated)

phpMyAdmin was complaining about "Invalid hostname for server 1. Please review your configuration."

The error is in /var/lib/phpmyadmin/config.inc.php and seems to be a security bug in Lenny.

$cfg['Servers'][$i]['host']=''; phpinfo();//'] = 'localhost';
should be:
$cfg['Servers'][$i]['host']= 'localhost';

After saving your file, no error occurs anymore :)
However, this error is due to a security leak in phpMyAdmin. Upgrade your Debian and you should be fine. However, just to be sure, you can do the following:

sudo nano /usr/share/phpmyadmin/.htaccess

and paste:

<Files "config.inc.php">
Order allow,deny
Deny from all
</Files>

Save and check whether http://www.yourdomain.nl/phpmyadmin/config.inc.php gives a 403-error. If it does, you're good :)

27Jun/091

Fixed it!

My blog was down for a few weeks. I tried to upgrade my WordPress installation while not having a lot of time. Bad idea. It somehow didn't work, and after reinstalling WordPress and importing the database today it works again. Woohoo :D

Filed under: Uncategorized 1 Comment
7May/090

Worklog Midibox #1

So, after collecting a lot of bits and pieces, reading a lot of documentation I finally started building my midibox.

You might think: "what on earth is a MidiBox?". Well, that's pretty well explained at the Wiki of midibox.org

I'm making a MidiBox SID.

To be precise the MB-6582, which is a MidiBox built around (up to) 8 SID-chips. A SID-chip is the built-in sound module in the Commodore 64 (amongst others).

Probably I won't use the standard black casing, but build my own from UV-reactive "plexiglass" (Acrylic glass or poly(methyl methacrylate)).

What it should do eventually:

MIDIbox SID V2 Bassline Demo #3 c64 from Thorsten Klose on Vimeo.

I've done quite a lot of it already, so I'll be backlogging real soon :)

27Apr/090

Make monit send less email

Today I found some nice extensions in the monit configuration file.

If you only want an alert message sent for certain events and just for some services, then append the alert-statement with the following lines.

check process apache2 with pidfile /var/run/apache2.pid
alert myemail@adress.ext only on { timeout, nonexist }

Only and on are so called "noise keywords", ignored by Monit to make it more readable.

You can also setup to send alerts for all events except some by putting the word "not" ahead of the list. For example, if you want to receive alerts for all events except Monit instance events, you can write (note that the noise words 'but' and 'on' are optional):

check system myserver
alert foo@bar but not on { instance }

instead of:

alert myemail@adress.ext on { action
checksum
content
data
exec
gid
icmp
invalid
fsflags
nonexist
permission
pid
ppid
size
timeout
timestamp }

Some parts of this are taken from the Monit Documentation

25Apr/092

Monitor your system, processes, daemons and remote hosts on Debian linux (lenny) with monit.

Since a while I am monitoring a few remote hosts, as well as my own server (serving you this page right now) with monit.

Their site says:

"Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations."

Time to get started!

The installation is very easy with aptitude:

# aptitude install monit

If for some reason you have to compile it yourself:

$ tar zxvf monit-x.y.z.tar.gz (were x.y.z denotes version numbers)
$ cd monit-x.y.z
$ ./configure (use ./configure --help to view available options)
$ make && make install

Now it's time to configure. Monit is highly customizable :)

The monit configuration file is found at /etc/monit/monitrc

The configuration below can be found at
http://www.t44.nl/wordpress/data/monitrc

Here is an example you can edit:

##### Global options #####
## Logging options
# Poll every minute
set daemon  60                          # polling time in seconds
set logfile syslog facility log_daemon  # Set syslog logging.

## Mail options
# Here you can setup your own mailserver
set mailserver smtp.yourisp.ext,        # primary mailserver
               localhost                # fallback relay

If you would like to use GMail (which requires TLS/SSL) use something like this instead:

# set mailserver smtp.gmail.com port 587 username "myemail@gmail.com" password "password" using tlsv1 with timeout 30 seconds

The eventqueue holds events if for some reason mails cannot be sent.

set eventqueue
     basedir /var/monit # set the base directory where events will be stored
     slots 100          # optionaly limit the queue size

You can define your mail-notification format. Use man monit for all options.

set mail-format {
## Just an example, feel free to edit
    from: monit@yourhost.com
    subject: (monit) $SERVICE $EVENT at $DATE
    message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
    Yours sincerely,
    monit
    Your system admin
}

All alert mail will be sent to below mail address.

# Set a default mail from-address for all alert messages emitted by monit.
set alert you@something.ext # fill in your e-mailaddress here

Let's setup the webinterface

# Web-server options
  set httpd port 80          # set httpd port for the web-interface,
                                 # default is 80, 443 is normally used for https
  allow my.home.ip.address     # Only these addresses can connect to the webinterface
  allow localhost                # All hosts can connect when omitted
  allow username:password      # set your users/passwds here
  allow foo:bar                  # Multiple users are allowed

If you wish (like me) to use SSL connections:

# Web-server options
  set httpd port 443           # set httpd port for the web-interface,
                                 # default is 80, 443 is normally used for https
  ssl enable                   # if you wish to enable ssl (i.e. https) connections
  PEMFILE /var/certs/monit.pem   # (only for SSL)
  allow my.home.ip.address     # Only these addresses can connect to the webinterface
  allow localhost                # All hosts can connect when omitted
  allow username:password      # set your users/passwds here
  allow foo:bar                  # Multiple users are allowed

This requires a certificate, and some more than basic knowledge. Much of it is very well explained in the Monit Wiki

Let's continue setting up services. First of all we check wheter our own system is running nicely. This is pretty straightforward.

##### Services #####
## System
  check system localhost
     if loadavg (5min) > 1 then alert
     if memory usage > 75% then alert
     if cpu usage (user) > 70% then alert
     if cpu usage (system) > 30% then alert
     if cpu usage (wait) > 20% then alert

Now we will monitor a few processes. The pid-files mostly are in /var/run/ (at least in Debian).

## Processes
# apache2
check process apache with pidfile /var/run/apache2.pid
   group www
   start program = "/etc/init.d/apache2 start"
   stop  program = "/etc/init.d/apache2 stop"
   if failed host 127.0.0.1 port 80 protocol http and request "/monit/token" with timeout 15 seconds then restart
   if cpu > 60% for 2 cycles then alert
   if cpu > 90% for 5 cycles then restart
   if totalmem > 200.0 MB for 5 cycles then restart
   if children > 250 then restart
   if failed host 127.0.0.1 port 50443 type tcpssl protocol http and request "/monit/token" with timeout 15 seconds then restart
   if 5 restarts within 5 cycles then timeout
   depends on apache_bin
   depends on apache_rc

 check file apache_bin with path /usr/sbin/apache2
   group www
   if failed checksum then unmonitor
   if failed permission 755 then unmonitor
   if failed uid root then unmonitor
   if failed gid root then unmonitor

 check file apache_rc with path /etc/init.d/apache2
   group www
   if failed checksum then unmonitor
   if failed permission 755 then unmonitor
   if failed uid root then unmonitor
   if failed gid root then unmonitor

Over to MySQL

# mysql
check process mysql with pidfile /var/run/mysqld/mysqld.pid
   group database
   start program = "/etc/init.d/mysql start"
   stop program = "/etc/init.d/mysql stop"
   if failed host localhost port 3306 protocol mysql then restart
   if 5 restarts within 5 cycles then timeout
   depends on mysql_bin
   depends on mysql_rc

 check file mysql_bin with path /usr/bin/mysql
   group database
   if failed checksum then unmonitor
   if failed permission 755 then unmonitor
   if failed uid root then unmonitor
   if failed gid root then unmonitor

 check file mysql_rc with path /etc/init.d/mysql
   group database
   if failed checksum then unmonitor
   if failed permission 755 then unmonitor
   if failed uid root then unmonitor
   if failed gid root then unmonitor

And syslogd:

# syslogd
check process syslogd with pidfile /var/run/syslogd.pid
   start program = "/etc/init.d/sysklogd start"
   stop program = "/etc/init.d/sysklogd stop"
   if 5 restarts within 5 cycles then timeout

 check file syslogd_file with path /var/log/syslog
   if timestamp > 65 minutes then alert

sshd and Samba:

# sshd
 check process sshd with pidfile /var/run/sshd.pid
   start program  "/etc/init.d/ssh start"
   stop program  "/etc/init.d/ssh stop"
   if failed host localhost port 50022 protocol ssh then restart
   if 5 restarts within 5 cycles then timeout

# Samba
 check process smbd with pidfile /var/run/samba/smbd.pid
   group samba
   start program = "/etc/init.d/samba start"
   stop  program = "/etc/init.d/samba stop"
   if failed host localhost port 139 type TCP  then restart
   if 5 restarts within 5 cycles then timeout
   depends on smbd_bin

 check file smbd_bin with path /etc/init.d/samba
   group samba
   if failed checksum then unmonitor
   if failed permission 755 then unmonitor
   if failed uid root then unmonitor
   if failed gid root then unmonitor

Finally we also check wheter some other hosts are still up and running.

## Check other hosts
  check host google.com with address google.com
    if failed icmp type echo count 3 with timeout 3 seconds then alert
    if failed port 80 protocol http then alert
  check host t44.nl with address t44.nl
    if failed icmp type echo count 3 with timeout 3 seconds then alert
    if failed port 80 protocol http then alert

It is also possible to include some other configuration files with the include keyword:

##############################################################################
## Includes
###############################################################################
##
## It is possible to include additional configuration parts from other files or
## directories.
#  For instance:
include /etc/monit.d/*
#
#

After modifying the configuration file you should check for the syntax to make sure they are correct. To do this run:

# monit -t

Now you can run monit standalone:

# monit

Now you should be able to check monit in your webbrowser, and probably you'll get a few alert mails :) If for some reason you cannot access the webbrowser, you can throw out all lines that say

allow *hostname*

This will make monit accept all IP-adresses and hosts. Also check that your host correctly has port 80/443 (or whatever you have setup) forwarded, and that your firewall and ip-tables are set up correctly.

In order to use the Debian init.d startup script you must enable the service by changing the file /etc/default/monit.

# You must set this variable to for monit to start
startup=1

# To change the intervals which monit should run uncomment
# and change this variable.
CHECK_INTERVALS=30

Now you can start monit by running /etc/init.d/monit start. Also it will automatically start on reboot.