When nagios is installed in the source code, the following Error occurs: Couldnotopencommandfile '/usr/local/nagios/var/rw/nagios. cmd' forupdate! Thenitmeansthatthepermissionsonthefolderaremessedup. Don't 'tbotherse
1. an error occurred while installing nagios in the source code
1 Error: cocould not open command file '/usr/local/nagios/var/rw/nagios. cmd' for update!
Then it means that the permissions on the folder aremessed up. Don't bother setting up the permissions on the fileitself, nagios. cmd, since that file
Gets recreated very often, so
Chown nagios. nagcmd/usr/local/nagios/var/rw
Chmod g + rwx/usr/local/nagios/var/rw
Chmod g + s/usr/local/nagios/var/rw
2. restart apache and nagios, and the premise is that the nagios and apache users are in the nagcmd group.
II. special configurations of nagios warning emails
By default, nagios uses the local machine to send mail alerts.SendmailThe server sends an email. You do not need to use this machine when sending mail alertsSendmailThe email server uses the email server in the network. This requires a third party.
Software sendEmail
1 First Download sendEmail Software official website: http://caspian.dotconf.net/menu/Software/SendEmail/
2 # tar-xvf sendEmail-v1.55.tar.gz
# Cd sendEmail-v1.55
# Cp sendEmail/usr/local/bin
# Chmod a + x/usr/local/bin/sendEmail
3 sendEmail command details
-F indicates the sender's email address.
-T indicates the recipient's email address.
-S indicates the domain name or ip address of the SMTP server
-U indicates the subject of the email.
-Xu indicates the SMTP authentication User name
-Xp indicates the password for SMTP verification. (Note that this password seems to be restricted. for example, I use d! 5neyland cannot be correctly identified)
-M indicates the Mail content
4. configure the nagios mail sending command. the configuration file defines the mail command in commands. cfg.
Define notify-host-by-email, notify-service-by-email
Define command {
Command_name sort Y-host-by-email
Command_line/usr/bin/printf "% B" "****** Frank ****** nnNotification Type: $ icationicationtype
$ NHost: $ HOSTNAME $ nState: $ HOSTSTATE $ nAddress: $ HOSTADDRESS $ nInfo: $ HOSTOUTPUT $ nnDate/Time: $ LONG
DATETIME $ n "|/usr/local/bin/sendEmail-f monitor@frank.org-t $ CONTACTEMAIL $-s smtp.frank.org
-U "** $ icationicationtype $ Host Alert: $ HOSTNAME $ is $ HOSTSTATE $ **"
}