Jun 052013
 

Recently had a problem where awstats stopped processing log entries from one of my sites while the others worked fine. While some of these items don’t make sense to check in this instance, you may want to give them a look if you are having problems.

Check a few things first:

  1. Do you have enough disk space? – Yes
  2. Is the log file getting updated? (I was shipping logs from one server to another for processing) – Yes
  3. Has the log format changed? (Take a look at historical logs if available to make sure. Also check your /etc/awstats/awstats.config.conf file to make sure it is the same here) – All good
  4. Files still getting written to your data dir? Do you have any contents in any missing files? (/var/lib/awstats/awstats{month}{year}{day}.txt) – New files are there for working sites, nothing present for the failing site.
  5. Turn on showing dropped records and what did it say? – Dropped record (method/protocol ‘rtmp’ not qualified when LogType=S):
  6. Have you made any changes to the awstats application recently? – Yep….wait what?

It seems at some point we upgraded awstats to the 7.0 branch, and had previously made customizations to the /usr/local/awstats/wwwroot/cgi-bin/awstats.pl to handle our FMS logs. We did it according to the instructions here: http://www.wowza.com/forums/showthread.php?163-Log-Analysis

When we did the upgrade, we overwrote our changes, an this one log stopped processing.

So, I made the following change to /usr/local/awstats/wwwroot/cgi-bin/awstats.pl around line 18158 to make this block:

                        ( $LogType eq 'W' || $LogType eq 'S' )
                        && (   uc($field[$pos_method]) eq 'GET'
                                || uc($field[$pos_method]) eq 'MMS'
                                || uc($field[$pos_method]) eq 'RTSP'
                                || uc($field[$pos_method]) eq 'HTTP'
                                || uc($field[$pos_method]) eq 'RTP' )

look like this:

                        ( $LogType eq 'W' || $LogType eq 'S' )
                        && (   uc($field[$pos_method]) eq 'GET'
                                || uc($field[$pos_method]) eq 'MMS'
                                || uc($field[$pos_method]) eq 'RTSP'
                                || uc($field[$pos_method]) eq 'RTMP'
                                || uc($field[$pos_method]) eq 'RTMPT'
                                || uc($field[$pos_method]) eq 'HTTP'
                                || uc($field[$pos_method]) eq 'RTP' )

I then started reprocessing old logs like this:

/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=fms -LogFile=/oldlogs/access.30.log -showdropped -showcorrupted

And all is good in the world again.

May 052010
 

Here are some neat database commands I recently came across while I was trying to get statistics and status information on some mysql and postgres databases.

Postgres

This will give you a list of all of the databases in the server.*
select datname from pg_database;

* If you don’t know how to connect to postgres from the command line, don’t fear (well fear a little). What I had to do was su to the user that is a DB user, and then run /usr/local/pgsql/bin/psql This launched a command line client (without needing a password), that let me query the server. I can’t provide a better understanding then that, as this is the first time I’ve ever interacted with a postgres server.

This tells you how big a particular database is.
SELECT pg_size_pretty(pg_database_size('xythosdocs'));
The output is like this:
pg_size_pretty
----------------
2834 MB
(1 row)

Mysql

Get all database sizes:
SELECT table_schema "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema;
Produces output like this on the command line:


+--------------------+----------------------+------------------+
| Data Base Name     | Data Base Size in MB | Free Space in MB |
+--------------------+----------------------+------------------+
| blogadmin          |           0.35750008 |       0.00098896 | 
| blogs              |          90.60342026 |      27.73141003 | 
| information_schema |           0.00781250 |       0.00000000 | 
| musicschedule      |           0.00548172 |       0.00020599 | 
| mysql              |           0.54032421 |       0.00000000 | 
| phpflash           |           0.77745819 |       0.00000000 | 
+--------------------+----------------------+------------------+

Get some status information on the sever. Run this from the command line:
mysqladmin -uroot -p status
Phpmyadmin also provides a lot of process status information if you have that installed.

Apr 052010
 

In one of my many Linux Game RSS feeds, I ran across an announcement for L++. This is a multiplayer version of the old Lemmings game. Lemmings is a puzzle game where you have to guide your no-brain lemmings from the entrance, to the exit.

L++ has all of the original single player content, plus a lot of extra player created content. It has a built in level editor (which I found wasn’t super easy to use) and 8 player network multiplayer.

It is quite surprising how fun multiplayer lemmings could be. If you are a lemmings fan, and have a friend or two, I’d highly recommend giving this a try.

Update: I just went to the site, and they currently have taken the download off as they remove some of the copyrighted content that was in the game. You can read more here: http://lplusplus.co.cc/topic.php?topic=16. Oddly enough, I only downloaded the windows version as that was the machine I was on when I decided to try this. I guess I’ll have to wait with you to give it a try.

Mar 122009
 

I recently updated my server and I store a good number of passwords in my pwman database. It is a great little command line program for storing passwords in a secure manner. I do this so that I can log into my machine from anywhere in the world to retrieve passwords if needed, and I’m not tied to a thumb drive that I could lose/break, or a computer that may not have the necessary OS/ports for me to use.

If you need to migrate your database, you can follow these steps:

  1. Grab a copy of your old database. It is usually called pwman.db and is stored in your /home/yourname/.pwman/ If you can’t find it, there is a config file in this directory that will tell you where it is.
  2. Install pwman3 on your new server. (command for Debian based Linux OSes)
    apt-get install pwman3
  3. Run pwman3 and configure the same master password as your old database. (Not sure if this is required, but I thought it was a good idea)
  4. Make a copy of your database, and then put your old one in your new /home/yourname/.pwman/ folder.

The next time you run pwman3, you will have all your old passwords!

Feb 192009
 

In my last few attempts at configuring my mythtv installation (my most recent being today when I replaced the hard drive), I’ve gotten this error when I log into my box through SSH:

MythTV status for localhost
===========================
Status...........: Wed Feb 18 2009, 8:30 PM
Total Disk Space.: Total space is 548,770 MB, with 158,049 MB used (28.8%)
Next Recording In: 2 Hours, 59 Minutes
 
Encoders:
mythbox (1) - Idle
 
Scheduled Recordings:
2009-02-18 23:30:00 - CSI: NY (WBZ)
2009-02-19 00:30:00 - Stargate SG-1 (Space: The Imagination Station)
2009-02-19 10:30:00 - Stargate SG-1 (Space: The Imagination Station)
2009-02-19 12:30:00 - First Wave (Space: The Imagination Station)
2009-02-19 19:30:00 - Coronation Street (CBNT CBC St. John's)
2009-02-19 22:30:00 - CSI: Crime Scene Investigation (WBZ)
 
Schedule Conflicts:
Unable to access MythTV Perl API. Try with --verbose to find out why.

I get most of the status for the server, but I don’t get the read outs of the conflicts because of the error.

What happens (as far as I understand it) is that when the cronjob generates the motd, it runs as root, and root does not have a link to the mythtv config, so it can’t get the data from the database.  So, to get around this, we need to create a link in /root/.mythtv/ to the config.xml file for the server.  For me, this runs from my home directory /home/thomas/.mythtv/config.xml so:

sudo ln -s /home/thomas/.mythtv/config.xml /root/config.xml

Once you make this change, the next time the cronjob runs it should populate the motd correctly.

Notes: I’m running this server on Ubuntu 8.04.02 64-bit.

You can find more information on this issue here.

Oct 032008
 

ASCII Sector is a space trading game written completely using ASCII graphics. It is available from www.asciisector.net. There are Windows and Linux versions. This is a post I made on the forum over there explaining how I got this to run in a 64bit environment.

Hello All, I thought I would tell you a story of how I got this running on my 64bit Ubuntu (since I didn’t at a glance see anything tho help me out with this).

First, I’m running a 64bit install of Mythbuntu that I converted to a regular Ubuntu desktop a few months after the install.

I downloaded and installed ASCII Sector as described in the instructions. When I ran the file, I would get the error:
bash: ./asciisec: No such file or directory

Of course, this made no sense since I was at the location of the file. I made sure I had libsdl and libsdl mixer installed, but that didn’t help. So I went browsing around, and found a post that said that this error was common when running 32bit apps on a 64bit install, and than installing the 32bit libraries would help. So I ran this command:
sudo apt-get install ia32-libs

This installed the libraries for me, and when I ran it, I no longer got that error (Yah!) I got this one instead (boo):
./asciisec: error while loading shared libraries: libsmpeg-0.4.so.0: cannot open shared object file: No such file or directory

So, I used Synaptic to ensure that I had libsmpeg installed and I did. So, I did an strace on the process to see where it was looking for the file. Then I ran the find command to see where it was:
sudo find / -name "libsmpeg*"
And it wasn’t looking where it was located. So I tried to create a symlink to a path it was looking in, but that didn’t work either. I got this error:
./asciisec: error while loading shared libraries: libsmpeg-0.4.so.0: wrong ELF class: ELFCLASS64

So I was back to the drawing board.

I did more searching, and came across a ubuntu 64bit gaming post referring to the getlibs application that installs 32bit compatible libs on 64 bit system. Here is that post: http://ubuntuforums.org/showthread.php?t=662770&page=6 I downloaded getlibs from here: http://ubuntuforums.org/showthread.php?t=474790 installed it, and then ran this command:
getlibs -l libsmpeg-0.4.so.0
The program works similar to apt-get and downloaded the library and installed it. Then I ran asciisec and I was in the game. (real Yah!) I didn’t actually get to play it yet, but I imagine it will work fine now that it is all loaded up.

I’ve played a little bit, and it is a pretty fun game. I hope to make some quests for it in the future.