Installation instructions for NAN. ---------------------------------------- Requirements: ---------------------------------------- NAN requires a DBM driver of some sort so that it can keep track of sending times. DB_File GDBM_File NDBM_File SDBM_File ODBM_File are known to work. As long as you have one of those you should be fine. ---------------------------------------- Installation: ---------------------------------------- These instructions assume that you will me installing NAN into the directory /usr/local/nan. 1. Unpack the tarball tar -zxvf nan-x.xx.tar.gz 2. Move the resulting directory to the place you want to install it to. mv nan-x.xx /usr/local/nan 3. Create a user and group for nan to run as. It will refuse to run as root. groupadd nan useradd nan 4. Set permissions on the main directory and the queue directory so that nand can write to them. chown nan:nan /usr/local/nan chmod 755 /usr/local/nan chown nan:nan /usr/local/nan/queue chmod 755 /usr/local/nan/queue 5. If you install NAN into a directory other than /usr/local/nan, then you must edit the files "nanc" and "nand" and change the 'use lib' line and the @config_path setting. There are also a couple config options that might need to be changed in the next step. 6. Edit nanc.conf and nand.conf. Documentation for each setting is included in the conf file. See the README for a lot of information on how NAN works... it can be confusing. 7. Optionally copy the provided RC style init script, "init-script" to your init directory. cp init-script /etc/init.d/nand 8. Start nand with the init script (/etc/init.d/nand start), or by running /usr/local/nan/nand. 9. Try sending a test notification. Should write "NAN Test command - successful" in /tmp/nan_test echo "TESTVARIABLE:successful" | /usr/local/nan/nanc -t TEST -m test -d test 10. if the test file doesn't show up, check the log file (/var/log/nand.log by default). You may need to increase the log level in the conf file to see the error. 11. Set up Nagios to use NAN. These instructions assume that Nagios is set up according to the sample config files that Nagios installs. If you have modified their location or anything, then you must translate these instructions to match your installation. a. Migrate your existing notification commands to nand.conf, following the instructions in the README and the samples given. b. Edit misccommands.cfg. Change all of your notification commands to look like the following: # 'notify-by-email' command definition define command { command_name notify-by-email command_line /usr/bin/printf "%b" "CONTACTNAME:$CONTACTNAME$\nCONTACTALIAS:$CONTACTALIAS$\nCONTACTEMAIL:$CONTACTEMAIL$\nCONTACTPAGER:$CONTACTPAGER$\nHOSTNAME:$HOSTNAME$\nHOSTALIAS:$HOSTALIAS$\nHOSTADDRESS:$HOSTADDRESS$\nHOSTSTATE:$HOSTSTATE$\nSERVICEDESC:$SERVICEDESC$\nSERVICESTATE:$SERVICESTATE$\nSERVICEOUTPUT:$SERVICEOUTPUT$\nSERVICEPERFDATA:$SERVICEPERFDATA$\nSERVICEEXECUTIONTIME:$SERVICEEXECUTIONTIME$\nSERVICELATENCY:$SERVICELATENCY$\nNOTIFICATIONTYPE:$NOTIFICATIONTYPE$\nNOTIFICATIONNUMBER:$NOTIFICATIONNUMBER$\nLONGDATETIME:$LONGDATETIME$\nSHORTDATETIME:$SHORTDATETIME$\nDATE:$DATE$\nTIME:$TIME$\nTIMET:$TIMET$\nLASTSERVICECHECK:$LASTSERVICECHECK$\nLASTSERVICESTATECHANGE:$LASTSERVICESTATECHANGE$\nADMINEMAIL:$ADMINEMAIL$\nADMINPAGER:$ADMINPAGER$\nSERVICEACKAUTHOR:$SERVICEACKAUTHOR$\nSERVICEACKCOMMENT:$SERVICEACKCOMMENT$" | /usr/local/nan/nanc -t $NOTIFICATIONTYPE$ -m service_email -d $CONTACTEMAIL$ } # 'notify-by-epager' command definition define command { command_name notify-by-epager command_line /usr/bin/printf "%b" "CONTACTNAME:$CONTACTNAME$\nCONTACTALIAS:$CONTACTALIAS$\nCONTACTEMAIL:$CONTACTEMAIL$\nCONTACTPAGER:$CONTACTPAGER$\nHOSTNAME:$HOSTNAME$\nHOSTALIAS:$HOSTALIAS$\nHOSTADDRESS:$HOSTADDRESS$\nHOSTSTATE:$HOSTSTATE$\nSERVICEDESC:$SERVICEDESC$\nSERVICESTATE:$SERVICESTATE$\nSERVICEOUTPUT:$SERVICEOUTPUT$\nSERVICEPERFDATA:$SERVICEPERFDATA$\nSERVICEEXECUTIONTIME:$SERVICEEXECUTIONTIME$\nSERVICELATENCY:$SERVICELATENCY$\nNOTIFICATIONTYPE:$NOTIFICATIONTYPE$\nNOTIFICATIONNUMBER:$NOTIFICATIONNUMBER$\nLONGDATETIME:$LONGDATETIME$\nSHORTDATETIME:$SHORTDATETIME$\nDATE:$DATE$\nTIME:$TIME$\nTIMET:$TIMET$\nLASTSERVICECHECK:$LASTSERVICECHECK$\nLASTSERVICESTATECHANGE:$LASTSERVICESTATECHANGE$\nADMINEMAIL:$ADMINEMAIL$\nADMINPAGER:$ADMINPAGER$\nSERVICEACKAUTHOR:$SERVICEACKAUTHOR$\nSERVICEACKCOMMENT:$SERVICEACKCOMMENT$" | /usr/local/nan/nanc -t $NOTIFICATIONTYPE$ -m service_page -d $CONTACTPAGER$ } # 'host-notify-by-email' command definition define command { command_name host-notify-by-email command_line /usr/bin/printf "%b" "CONTACTNAME:$CONTACTNAME$\nCONTACTALIAS:$CONTACTALIAS$\nCONTACTEMAIL:$CONTACTEMAIL$\nCONTACTPAGER:$CONTACTPAGER$\nHOSTNAME:$HOSTNAME$\nHOSTALIAS:$HOSTALIAS$\nHOSTADDRESS:$HOSTADDRESS$\nHOSTSTATE:$HOSTSTATE$\nHOSTOUTPUT:$HOSTOUTPUT$\nHOSTPERFDATA:$HOSTPERFDATA$\nHOSTEXECUTIONTIME:$HOSTEXECUTIONTIME$\nNOTIFICATIONTYPE:$NOTIFICATIONTYPE$\nNOTIFICATIONNUMBER:$NOTIFICATIONNUMBER$\nLONGDATETIME:$LONGDATETIME$\nSHORTDATETIME:$SHORTDATETIME$\nDATE:$DATE$\nTIME:$TIME$\nTIMET:$TIMET$\nLASTHOSTCHECK:$LASTHOSTCHECK$\nLASTHOSTSTATECHANGE:$LASTHOSTSTATECHANGE$\nADMINEMAIL:$ADMINEMAIL$\nADMINPAGER:$ADMINPAGER$\nHOSTACKAUTHOR:$HOSTACKAUTHOR$\nHOSTACKCOMMENT:$HOSTACKCOMMENT$" | /usr/local/nan/nanc -t $NOTIFICATIONTYPE$ -m host_email -d $CONTACTEMAIL$ } # 'host-notify-by-epager' command definition define command { command_name host-notify-by-epager command_line /usr/bin/printf "%b" "CONTACTNAME:$CONTACTNAME$\nCONTACTALIAS:$CONTACTALIAS$\nCONTACTEMAIL:$CONTACTEMAIL$\nCONTACTPAGER:$CONTACTPAGER$\nHOSTNAME:$HOSTNAME$\nHOSTALIAS:$HOSTALIAS$\nHOSTADDRESS:$HOSTADDRESS$\nHOSTSTATE:$HOSTSTATE$\nHOSTOUTPUT:$HOSTOUTPUT$\nHOSTPERFDATA:$HOSTPERFDATA$\nHOSTEXECUTIONTIME:$HOSTEXECUTIONTIME$\nNOTIFICATIONTYPE:$NOTIFICATIONTYPE$\nNOTIFICATIONNUMBER:$NOTIFICATIONNUMBER$\nLONGDATETIME:$LONGDATETIME$\nSHORTDATETIME:$SHORTDATETIME$\nDATE:$DATE$\nTIME:$TIME$\nTIMET:$TIMET$\nLASTHOSTCHECK:$LASTHOSTCHECK$\nLASTHOSTSTATECHANGE:$LASTHOSTSTATECHANGE$\nADMINEMAIL:$ADMINEMAIL$\nADMINPAGER:$ADMINPAGER$\nHOSTACKAUTHOR:$HOSTACKAUTHOR$\nHOSTACKCOMMENT:$HOSTACKCOMMENT$" | /usr/local/nan/nanc -t $NOTIFICATIONTYPE$ -m host_page -d $CONTACTPAGER$ } c. Restart Nagios. Done!