Nagios wrapper.vbs(0, 1) Microsoft VBScript runtime error: Path not found in check_files.vbs

I had this error message today and wasn’t able to easily fix it. It took me a while to find out that this was caused by spaces in the folder names. Although I had the whole path in double quotes (“E:\\MSQL Data\\SQLAPPS1\\MSSQL$SQLAPPS1\\BACKUP”) the script did not finish. To make it work you have to double quote the argument under [Wrapped Scripts] in the client ini file (….check_files.vbs “$ARG1$” $ARG2$ …..). Especially if you have Windows machines and Windows experts working on them you’ll find some strange folder/filenames like the one above. What is the f&^%ing ‘$’ doing in it? Another way to waste my time. If you have special characters in folder- or filenames you must mask those with a \. So the above path must be (“E:\\MSQL Data\\SQLAPPS1\\MSSQL\$SQLAPPS1\\BACKUP”) to get the script working.

Posted in Nagios, Windows | Leave a comment

Passwordless remote login using Putty

It is quite easy to configure Putty to login to a server using a public/private key pair.

  • Create the key pair
  • Open the Puttygen.exe file and create a 1024 bit RSA-SSH2 key. After the keys have been created save them in a save place. Optionally you can give your private key a passphrase.

    puttygen

    The PuttyGEN window


    The important part here is that you have to copy the key that is showing in the textbox in using the context menu in puttygen. Selecting the key with the mouse and copying to the clipboard using CTRL-keys will not work. So with the content of the public key in your clip board you can close puttygen.

  • Preparing the remote server
  • There are several examples on the internet in how to assign your public key to the remote server but some of them are rubbish. I followed one just to end up with this error message.

    Houston we got a problem

    Something went wrong here


    So to avoid an error message like the one above there are two ways to apply the key to the remote machine.

    1. Use the copy that you still have in your clipboard
    2. Login to the remote server as the user that you want to use for passwordless login. Execute
      echo "ssh-rsa the content of your clipboard" >> .ssh/authorized_keys
      The double quotes and the prefix “ssh-rsa ” are necessary.

    3. Make a new copy of the existing key
    4. Open the public key in an editor like notepad++.

      The public key

      The recently created key in notepad++


      Before we can echo the key into the authorized_keys file on the remote server we have to amend it slightly. The part that we are interested is starts with AAAA and ends with V7U=. That is your public key. Make sure that the whole key is not wrapped. So at the end you should have a long line starting with AAA and ending with 7U=. Now add the prefix ssh-rsa followed by a space to the beginning of that line. To make it easy to find the key in the file you can also add the comment at the end of the line. Key and comment must be separated by a space. So your final line is now starting with ‘ssh-rsa AA…’ and ending either with ‘…7U=’ or ‘…7U= myWorkstation’ or whatever comment you chose. Now surround the whole line with double or single quotes and copy it to the clipboard. Use the above command to add the key to the authorized_keys file.

        That is all you need to do on the remote server.

      1. Prepare Putty to use the new key pair.
        1. Open putty and either create a new connection or load an already existing one
        2. The putty window

        3. Set the user name to the name that you want to login as.
        4. Set your user name in here

        5. Amend the key settings.
        6. Putty key settings

        7. Save your settings
        8. Save settings

        9. Test the new connection
        10. After opening the connection to the remote server you should see an output that is similar to this one.

          Login successful without a password challenge

          Login successful without a password challenge

I hope that this will help.

Posted in Applications, Beginner, Linux, Windows | Leave a comment

Get rid of the Apache pass phrase request for a RSA certificate

Ever seen this when you try to start Apache with SSL support for the first time?
Apache/2.2.15 mod_ssl/2.2.15 (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.
Server this.is.your.web.page.url:443 (RSA)
Enter pass phrase:

It looks that you’ve given your private key a pass phrase when you’ve created it. Not the best idea if you plan to have your Apache web server starting automatically. Anyway, if you want to suppress this message and get Apache started without asking for the pass phrase you can enter this command.
[root@myserver]# openssl rsa -in protected.rsa.key -out unprotected.rsa.key
You have to change the key names accordingly.
P.S. I have to say that you need the pass phrase to un-protect the key.

Posted in Apache, Apps, Linux | Leave a comment

What process is using how much swap memory

I found this interesting script that prints out a list of processes that are using swap space. I changed the output to suppress the PIDs that aren’t using swap.

#!/bin/bash
# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
# Updated: 2013-11-13 Yuichiro Saito
# Updated: 2014-08-04 Juergen Caris
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do
        PID=`echo $DIR | cut -d / -f 3`
        PROGNAME=`ps -p $PID -o comm --no-headers`
        for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
        do
                let SUM=$SUM+$SWAP
        done
        if [ $SUM -gt 0 ]
        then
                echo "PID=$PID - Swap used: $SUM - (${PROGNAME})"
                let OVERALL=$OVERALL+$SUM
                SUM=0
        fi
done
echo "Overall swap used: $OVERALL"
Posted in Bash, Hardware, Linux, Uncategorized | Leave a comment