Archive for October 2006

If your Mozilla Thunderbird is slow to open the inbox, or any other folder for that matter, there are two things that you can do to try to fix this problem.

Step #1: The first thing is to try to compact the folder. This should help if you have a large inbox. If you can’t even get to this step, or if it is just too slow, try step #2.

Step #2: The .msf “index” file is corrupted. If this file gets corrupted, you could see a slow initial loading of your inbox, messages will not open, you can not delete messages, etc. You may also see a message in the status windows when you open Thunderbird that says something about rebuilting index. The solution to this is to first close out of Thunderbird, then delete the inbox.msf file. If this is for a different folder name, you will see “folder name.msf” file corresponding to that folder. This file is located in your profile directory. For me this was: “C:\Documents and Settings\Dave\Application Data\Thunderbird\Profiles\default\svxnp81c.slt\Mail\systembash.com”
But this varies because of the random profile string and your account profile name.
Delete this file. Make sure you leave the real inbox file alone - this is a file that is named “inbox” (or your folder name) without a file extension.

Re-open Thunderbird - the index will automatically be rebuilt and you should now have normal access to your inbox!

Problem: Checking the apache server status with the command “apachectl status”, “service httpd fullstatus” or by viewing http://server/server-status I get the message: “The requested URL /server-status was not found on this server” or your alternative 404 page not found error.

Answer: Assuming you have the module loaded and set up per the documentation of mod_status, this is this most likely a VirtualHost problem.

If you use NameVirtualHost *:80 directive, or any *:port, to run multiple name based virtual hosts, this configuration does not allow server-status on any of the publicly accessible addresses. This is because the first Virtual Host in the directive is considered the “Default Virtual Host”, any unknown entries on the NameVirtualHost space - in this example anything accessing port 80 on any IP address, will default go to this virtual host and hence you will get a 404 page not found error. Furthermore you can not place the server-status configuration inside of a VirtualHost directive to be read from a full domain name.

Solution: There are two basic ways to solve this. The first is to make the server listen on an alternative port (such as port 8080). Adding “Listen 8080″ to the configuration will allow you to access the server status from http://yourip:8080/server-status.

The second will allow the command ‘apachectl status’ or ’service httpd fullstatus’ to work properly but it will not allow external access. If you switch each * to the actual IP address to work from, then accessing from localhost (127.0.0.1) will work. So, you would need to change:
NameVirtualHost *:80
<VirtualHost *:80>

to
NameVirtualHost 10.0.0.3:80
<VirtualHost 10.0.0.3:80>

And then restart your server.

By that way, unless you need it, make sure to turn ExtendedStatus Off. This directive collects a lot of data from the site visitors and can slow down a busy server.

Technorati Tags:

I recently had a problem where my Spamassassin install started thinking that a lot of spam messages were really ham (non-spam). Since these were getting BAYES_00 scores of -2.5 they were almost all getting through my spam filter. These particular messages all were regarding STOCK quotes and were pretty obviously spam just by looking at the text of the messages. Somehow my Spamassassin install thought that they were not spam because the messages were being passed as ham by the Bayesian filter. Since they kept getting past, the bayesian filter kept learning them as HAM.

In order to break this vicious cycle, you just need to clear out the bayesian tokens. It’s very easy to do. As root user, type:
sa-learn --clear
This starts you fresh. By default, Spamassassin won’t use the bayes filter until it has 200 spam and ham messages, so until you get to that level it will continue to learn based the other Spamassassin detection settings.

Ideally, I would have sa-learn train using these spam messages. But since I use Outlook, and there is no “easy” way to have it interface with sa-learn, I find it easier to clean out the bayes tokens every once in a while. SpamAssassin Coach is a plugin for outlook which should connect to your spamd server and “learn” a message as ham or spam. But in practice, it did not work for me. It looks like the project has a lot of potential.

For more information on how Bayesian filtering works, check out this wikipedia article.

Technorati Tags: , ,

Firefox 2

Hey, Firefox 2.0 is out! Get it here. Improved tabbed browsing, additional customization, feed enhancements, and security improvements. If you haven’t tried Firefox before, there is no better time than now!

Technorati Tags:

If you or your client is using an old-DOS based program to do work (for example, Wordperfect for DOS) - and you need to print to a printer which is shared on the network, you first need to map the printer to an LPT port. You do this by using the following command in a dos prompt (Start -> Run -> cmd):

net use lpt3 \\SERVER_NAME\PRINTER_NAME

You can then set up your dos program to print to lpt3 and it will be sent to that printer. To print right from the command line, you could use the following syntax:

copy c:\test.txt lpt3

Technorati Tags: , , ,

This one is neat - you can control those APC PDU Power Poles over the network via SNMP. This works for the APC Switched Rack Unit PDU, but it may work for others.

I use this on a PDU with Network Management Card AOS version v2.6.4 and Rack PDU APP v2.6.5, so of course this is not guaranteed for any other versions.

First, set up the PDU on the network. Then, you need to configure the SNMP write string. You do this by navigating the menu (default username password is apc/apc):
Control Console->Network->SNMP

Change one of the strings to Write+ and preferable change it from public/private to your own string. You can also limit access from certain hosts for extra security. I always keep the APC PDUs on a private network since the APC telnet/web interface is so insecure.

Once you have that set up, your PDU is read to accept SNMP commands from your script of choice. I use PHP, so my examples use PHP code.

The APC MIB which controls the status of the power ports is: .1.3.6.1.4.1.318.1.1.12.3.3.1.1.4., where is the power port you wish to control.

I created a function that controls the port, it is as follows:

In config.php:
// translates APC IDs into their IP addresses
$apcids = array(
"APC01" => "10.0.1.2",
"APC02" => "10.0.1.6",
"APC03" => "10.0.1.10",
"APC04" => "10.0.1.14",
"APC05" => "10.0.1.18",
"APC06" => "10.0.1.22",
);

// This APC MIB is incomplete - must add the port number of the PDU at the end
$apcportcontrolmib = ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.";

// This is your SNMP Write+ String
$apcsnmp = "rwstring";

In functions.php:
//
// string function displayPowerStatus
// $apcid = ID of the APC unit as defined in config.php
// $apcport = Port of the outlet on the APC Switch
// returns STRING On, Off, Rebooting, or Error
function displayPowerStatus($apcid, $apcport) {
include('config.php');
$ip = $apcids[$apcid];
$mib = $apcportcontrolmib.$apcport;
$a = trim(snmpget($ip, $apcsnmp, $mib, 20000), "INTEGER: ");
switch ($a) {
case 1:
return "On";
case 2:
return "Off";
case 3:
return "Rebooting";
default:
return "Error";
}
}

// bool function manageAPCPort
// $apcid = ID of the APC unit as defined in config.php
// $apcport = Port of the outlet on the APC Switch
// $apcpass = APC Pass (SNMP Community String)
// $action {
// immediateOn (1),
// immediateOff (2),
// immediateReboot (3),
// delayedOn (4),
// delayedOff (5),
// delayedReboot (6),
// cancelPendingCommand (7)
// }
// returns TRUE or FALSE
function manageAPCPort($apcid, $apcport, $apcpass, $action) {
include('config.php');
$ip = $apcids[$apcid];
$mib = $apcportcontrolmib.$apcport;
$VERIFY = snmpset($ip, $apcpass, $mib, i, $action);
return $VERIFY;
}

Note that this code required the php snmpset function, which is not compiled into php by default. If you receive some error about snmpset or snmpget function not found, this is why.

Technorati Tags: , , , ,

Changing your cpan mirror.

Although it seems like it would be easy task to accomplish, it seems there is no easy way to change the perl CPAN module mirror list. I have only found two ways to do this.

The first way I found is to modify your Config.pm in the CPAN module. In my install, it is located at /usr/lib/perl5/5.8.5/CPAN/Config.pm. Look for ‘urllist’ and you will see the list of mirrors. Modify this variable to change where CPAN looks for its modules.

The second way is to re-run the CPAN configuration. You do this by running the cpan command line:
perl -MCPAN -e shell

and then running o conf init

cpan> o conf init

This will run the initial configuration of CPAN again.

It seems like there should be an easier way to do this - if anyone knows please post a comment!

Technorati Tags: , ,

SMSSend is a program used to send SMS messages over the network via command line in linux. It is licensed unto the GNU General License.

I recently aimed to integrate this into Zabbix remote monitoring software. I had a hell of a time finding the software because its original page, here, has some sort of apache configuration error and does not load. Thankfully, I found the source files needed on a mirror. For the sake of anyone else looking for this file, you can download it locally here:

http://systembash.com/source/smssend-3.5.tar.gz
http://systembash.com/source/skyutils-2.9.tar.gz

You will need to install that particular version of skyutils first, before compiling smssend.

Also, since the site is down, you can not grab the versions of the .sms that you need for certain providers. However, I used google cache to grab the one for clickatell and re-formatted the file to look right. Since it was not so obvious how to do this, I will paste clickatell.sms for you:

## SkySMS provider file - http://www.clickatell.com
## # Version 0.1
# by Steve Herrell
# Error codes :
# 1 -> General failure

NbParams 6
%Login : Your Login
%Password Hidden : Your Password
%ApiID Hidden : Your API ID
%Sender : The API Name
%Tel : Where it's going to
%Message Size=160 Convert : Your message

GetURL https://api.clickatell.com/http/sendmsg
Params from=\%Sender%&user=\%Login%&password=\%Password%&api_id=\%ApiID%&to=\%Tel%&text=\%Message%
Search ID:
PrintMsg message sent
Else
ErrorMsg 1 error sending message
GO

You then use this file (you can place in /usr/local/share/smssend/ which is the default location of the rest of the scripts) and then call this file using this syntax:

smssend clickatell.sms <Username> <Password> <API_ID> <API NAME> <Your Cell Phone Number> "Hello World"

If all goes well, you now have a text message that says “hello world”.

Note: Some of you, like me, may think that using your phones email address is a better (free) way to send alerts. You may be right. But my opinion is that adding e-mail into the mix adds an extra layer of uncertainty in actually receiving the message. I have had messages delayed for days that were sent via e-mail. Sending via SMS should be a more direct way to receive your urgent alerts.

Note 2: Don’t forget that you need to have internet connectivity to send SMS messages this way. The only way to have your server send an SMS message while being offline is by having a GSM Modem attached to it. Zabbix can talk directly with this modem to send your page.

Network Solutions worldnic.com nameservers both appear down. Pings get through occasionally, this may be an indication that they are being DOSed. I used to think that their DNS hosting services would be stable since they were “the” original registrar. But this is the second time in a few months that they’ve been down for a sustained period.

I just switched DNS nameservers so I no longer have to deal with them. Now when the domain comes up for renewal (not this one, by the way) I will use GoDaddy instead. They seem to be really great, and any dns changes (including nameserver changes) propagate really fast.

You know how it goes - you are surfing along when all of a sudden you can’t view web pages and your IM client disconnects. Then you see that the wireless connection has reconnected, and everything works again. Annoying, isn’t it?

Windows XP users know this all too well if you use a static Wifi 802.11 connection. You are in range constantly, but occasionally wireless randomly loses the connection.

The culprit? Windows Wireless Zero Configuration service. To fix this, disable the service! You only need this service if you will have your PC use different wireless networks (for example, you use a portable laptop).

To disable the service, go to Start->Control Panel->Administrative Tools->Services. Scroll down to Wireless Zero Configuration, right click and Properties. Press STOP, then go to Startup Type and change to Manual, then Apply. Click OK and you are done, WZC will no longer start up at boot time.

  • Welcome to systemBash, a technology and system administration blog by David Drager. If you enjoy this sort of content, can can subscribe to the RSS using the link to the right.