Nagios Monitor Confluence Jira

Recently had to start monitoring a confluence installation on a virtual server using Nagios. Nagios’s built-in check_http looked like it could solve my woes. Unfortunately this was a slight pain due to the fact that confluence uses a non-standard port. So I had to relearn the commands.

I edited the service check first
nano /usr/local/nagios/etc/objects/commands.cfg
I copied the check_http command into a new one:

define command {
command_name check_http_port
command_line $USER1$/check_http -I $ARG1$ -u $ARG2$ -p $ARG3$ -s $ARG4$
}

So the command would be ./check_http -I (IP/Hostname) -u (URL Full Address) -p (Port) -s (String to look for). Technically this will already warn if there is a 400 or 500 error, but I also wanted to verify that the string could be found.

Now we edit the configuration of the system itself
nano /usr/local/nagios/etc/objects/confluence.cfg

define host{
use linux-server
host_name confluence
alias confluence
address 10.555.555.555
parents parent1, switch1, mfer1
hostgroups linux-production-servers, datacenter2
}

define service{
use generic-service
host_name confluence
service_description HTTP
check_command check_http_port!confluence!http://confluence:8090/login.action?os_destination=%2Fhomepage.action!8090!”Remember me”
}

Using the above check_command, you’re able to connect to the server and port listed above and check for the familiar login “remember me” string.

.Net 4.0 Server 2008 R2

I was having an issue installing .net 4.0 on my WSUS server. I was receiving an 8024800c error. Reboot solved nothing.

I ended up stopping the automatic updates, deleting the SoftwareDistribution folder, restarting the updates service, and then I was able to install.

Open a command prompt
net stop "Windows Update"
del C:\Windows\softwareDistribution
y
net start "windows update"
Re-run your installation

Systeminfo Error Provider Failure

I’m a huge fan of remotely diagnosing computer issues. If I tell a remote VPN user to bring in their equipment that means there is something terribly wrong with their system.

I was attempting to use systeminfo /s IPOFCOMPUTER to check the hotfixes that had been applied and verify the network wasn’t causing issues.

Loading Network Card Information …ERROR: Provider failure

Awesome.
Another site told me to delete the wbem/repository files as they were probably corrupt. WMI requires these files.
In order to delete them, you must turn off the WMI Service (Windows Management Instrumentation), but I was having difficulty stopping the service remotely via my services.msc connected to their system.

So I fired up psexec and ran the command lines:
psexec -s \\computerIP cmd.exe
net stop "windows management instrumentation"

I then deleted the files located in:
C:\windows\system32\wbem\Repository

Then start up the WMI:
net start "windows management instrumentation"

Now I could re-run the systeminfo /s systemnameorip and it worked like magic.

SFTP Email When New File Uploaded

I had setup vsftp for SSL (FTPES), but needed a way to send an alert to customer support whenever a file had been uploaded. Otherwise the support staff would need to manually check each customer’s folders to see if anything new had arrived.

Install Dnotify
apt-get install dnotify

Create your startup script
nano /dnotify.sh

dnotify -b -p 1 -r -C /home/ -e /email.sh {}

This will run dnotify in the -b background, no more than one -p process, -r recursive folder (subfolders), -C for file creations only, -e execute the following script.

Create your email script
nano /email.sh

#!/bin/bash
DIR=”$1″
rm /upload.txt
echo “Dear User,”>>/upload.txt
echo “A new file has been uploaded to the $DIR directory”>>/upload.txt
cat /upload.txt | mailx -s “New FTP File Upload” customersupport@domain.tld

Make both scripts run-able
chmod +x email.sh
chmod +x dnotify.sh

Run the script and test
./dnotify.sh
Upload a file using FTP/WinSCP/WGET or another method to any of the folders you’re searching (my script searches all of /home and subfolders).

I added this as a startup script.

I got most of my help from nixcraft

Upgrade NAS4Free Firmware

I had NAS4Free server version x64_9.0.0.1.188 installed on a server and wanted to upgrade it to the latest version before moving into production.

I’m assuming you already have a ZFS (or other filesystem) share mounted on the server. And that SSH is enabled.

Copy the file to your share – I used WinSCP as it 1.) works and 2.) is free and 3.) I’m used to it.
SSH to the NAS and run the following:
/etc/rc.firmware enable
/etc/rc.firmware upgrade /path/to/img/file.img

The server will then reboot and you’ll be running the newest version.

ZFS tuning on freenas nas4free – I’ll split this out eventually.
http://forums.nas4free.org/viewtopic.php?f=55&t=26
# mkdir /mnt/data/zfskerntune
# cd /mnt/data/zfskerntune
# fetch http://www.kav91.com/nas4free/zfskerntune-20111022-nas4freeKav91.tar.gz
# tar xvf zfskerntune-20111022-nas4freeKav91.tar.gz
# cd zfskerntune
# ./zfskerntune-install.php

C$ From Domain Computer to Non-Domain Errors

I had a user with administrative permissions added onto a server 2008 system (on a workgroup) that could not map out the c$ admin share. I’m not sure of the exact error now since I’m writing this up about a month after the fact, but I found the fix.

Win7 client on domain connecting to win2k8 server on workgroup. Did the \username with password, still no dice. Registry fix fixed issue.

Download File
EnableCShare.reg

Install File

Wait about 30 seconds

Attempt C$ again

Obviously check ALL registry files BEFORE importing onto your system. Just in case someone tries to pull your leg.

Ubuntu BIND Webmin NXDOMAIN

I had setup two BIND9 servers on ubuntu to service all VPN connected users. They were both linked just fine. I managed BIND via webmin installed.

A linux user and a Mac user were connecting to the VPN and then finding they could no longer connect to any web sites outside of the DNS domain.

nslookup google.com
;; Got recursion not available from 10.10.5.60, trying next server
Server: 10.10.5.61
Address: 10.10.5.61#53
** server can’t find google.com: NXDOMAIN

Well that’s no good. First server isn’t allowing recursive connections and the second one is not forwarding properly. I checked webmin and saw in the forwarding and transfers section that I had, indeed, already added 8.8.8.8, 8.8.4.4, 4.2.2.2, and 10.10.5.70 (internal DNS). So why was it not working?

Fired up putty and SSH’d in
nano /etc/bind/named.conf.options
Under the options { area add the following:
allow-query { any; };
allow-recursion { any; };
Save and quit

Reload Bind
/etc/init.d/bind9 reload

Profit

Ramblings Of An IT Person