- Open a DOS command prompt
- Change working directory to the Nagwin installation directory\bin
- Run the following command to update the password:
htpasswd2 -b /etc/lighttpd/htpasswd nagiosadmin new-password
htpasswd2 -b /etc/lighttpd/htpasswd nagiosadmin new-password
Nagwin has blat smtp mailer included. The first step is to let blat save your smtp server settings for later use:
bin/blat -SaveSettings -f from-address -server your.smtp.server -u login -pw password
define contact{ |
# 'notify-host-by-email' command definition # 'notify-service-by-email' command definition |
Replace smtp.server by name/ip of your smtp server (your Exchange server for example). Make sure that your smtp server is configured to accept smtp requests from Nagwin machine.
You can issue the command below to test if your mail notification works:
echo "Test message" | bin\blat - -to mail@address -f from@address -subject "Test mail" -server smtp.server
As you use Nagwin to monitor other hosts, you may wonder how the Nagwin itself can be monitored. This can be achieved by checking status.dat file age and existence of key processes. Here is a recipe to establish an out-of-band monitoring of Nagwin:
#!/bin/bash
# customize - start
from=from@email.address
server=smtp.server
# customize - end
instroot=$(cygpath -m /)
logdir=/var/log/check_nagwin
mkdir -p $logdir
logfile=$logdir/$(date +"%d").log
echo "***" `date` >> $logfile
# Function to report failure, message body as argument
CheckFail ()
{
printf "$1" | /bin/blat - -to $to -f $from -subject "Nagwin is not operational" -server $server >> $logfile
exit 1
}
# Function to check a process, process name and expected number of instances as arguments
CheckProcess ()
{
/plugins/check_winprocess --filter "imagename eq $1.exe" --compare lt --critical $2 >> $logfile
if (($? > 0)); then
CheckFail "Must be at least $2 $1 process(es) running."
fi
}
# check status.dat age
/plugins/check_winfile --target "$instroot/var/opt/nagios/status.dat" --filter "age lt -15 minutes" --critical 1 --compare eq >> $logfile
if (($? > 0)); then
CheckFail "Nagios status.dat getting old."
fi
# check processes CheckProcess nagios 4
CheckProcess lighttpd 1
printf "\n" >> $logfile
|
You need to customize mail configuration (red) according to your setup. The script above checks if status.dat is updated within the last 15 minutes and if key processes are running with an expected number of intances. It will send an e-mail if any of the criteria are not met. Results from checks will be logged in /var/log/check_nagwin directory in a rotating manner for days of a month.
schtasks /create /sc minute /mo 15 /tn check-nagwin /tr "nagwin-inst-dir\bin\bash.exe -c /bin/check_nagwin.sh"
This command will create the scheduled task check-nagwin running the script above each 15 minutes.