Use these steps to setup Lenovo XClarity Integrator for Nagios.
Before you begin
Ensure that the software requirements are met (see
Software requirements).
Ensure that Nagios can connect
to the target Lenovo XClarity Administrator.
Ensure that ports to the SMTP server are open.
Ensure that XClarity Administrator manages one or more devices that have alerts so that you can verify
the setup.
By default, XClarity Integrator for Nagios uses Python sendmail function for sending emails.
You can use the default standard Nagios e-mail function or the standard
email plugin that you use for all other plugins by configuring the
email function in XClarity Integrator for Nagios script
Important: When copying code snippets from
this topic, pay special attention to the end-of-line characters, as
they are different in Windows and Linux.
Procedure
To set up XClarity Integrator for Nagios, complete the following steps.
- Download XClarity Integrator for Nagios (xclarity_integrator_check.py) to the /usr/local/nagios/libexec directory
- Optional: Edit the xclarity_integrator_check.py Python script, and modify the location where you want to store
the log_alerts, log_nodes, log_mail and certificate.pem files.
By default, the script creates and saves these files in the /home/nagios/logs directory.
- Run the /usr/local/nagios/libexec/xclarity_integrator_check.py
generate_credentials command to set up XClarity Integrator for Nagios for each appropriate XClarity Administrator instance.
Important: You must run this command as the user
that runs the XClarity Integrator for Nagios instance.
When prompted, specify the following data:
URL for the XClarity Administrator instance (for example, 192.0.2.0
)
User name and password to use to authenticate the XClarity Administrator instance
Name that you want to use to identify the XClarity Administrator instance
- Optional: Add the certificate for an XClarity Administrator that has a certificate that is signed by a root Certificate Authority
by copying the certificate file (in PEM format) to the Nagios log
directory.
Use the following format for the certificate file name: certificate.pem<XCLARITY_ADMINISTRATOR_NAME> (for example, certificate.pemLXCA_1).
- Update the Nagios configuration files in the /usr/local/nagios/etc/objects directory to add the new
plugin.
commands.cfg
Add the following definition to send emails.
Important: The options that are specified in the following definition
are appended with two dashes.
define command{
command_name notify-by-email
command_line $USER1$/xclarity_integrator_check.py --notificationtype '$NOTIFICATIONTYPE$'
--servicedesc '$SERVICEDESC$' --hostaddress '$HOSTADDRESS$' --servicestate '$SERVICESTATE$'
--longdatetime '$LONGDATETIME$' --longserviceoutput '$LONGSERVICEOUTPUT$'
--hostalias '$HOSTALIAS$' --contactemail '$CONTACTEMAIL$'
}
Add the following definition to verify the target XClarity Administrator instances. Add a separate definition for each XClarity Administrator instance.
Important: The options that are specified
in the following definition are appended with two dashes.
define command {
command_name <XCLARITY_ADMINISTRATOR_NAME>
command_line $USER1$/xclarity_integrator_check.py --lxca <XCLARITY_ADMINISTRATOR_NAME>
}
Where <XCLARITY_ADMINISTRATOR_NAME> is the name of the XClarity Administrator instance that you specified in step 3.
For example:
define command {
command_name LXCA_1
command_line $USER1$/xclarity_integrator_check.py --lxca LXCA_1
}
localhost.cfg
Add the following definition for
each XClarity Administrator instance.
define service{
use local-service
host_name localhost
service_description <XCLARITY_ADMINISTRATOR_NAME>
check_command <XCLARITY_ADMINISTRATOR_NAME>
notifications_enabled 1
}
Where <XCLARITY_ADMINISTRATOR_NAME> is the name of the XClarity Administrator instance that you specified in step 3.
For example:
define service{
use local-service
host_name localhost
service_description LXCA_1
check_command LXCA_1
notifications_enabled 1
}
contacts.cfg
Add the following definitions to
define the email address of the contact or contact group that is to
receive emails notifications.
define contact{
use generic-contact
contact_name <CONTACT_NAME>
alias <CONTACT_FULL_NAME>
email <CONTACT_EMAIL
service_notification_commands <SERVICE_COMMAND
}
Where:
<CONTACT_NAME>. Short name for
the contact
<CONTACT_FULL_NAME>. Full name
for the contact
<CONTACT_EMAIL. Contact email
address
<SERVICE_COMMAND. Command that
you want to use for sending and receiving emails, To use Mailx, specify notify-by-email.
To use the standard Nagios email plugin, do
not specify a value.
For example:
define contact{
use generic-contact
contact_name John
alias John Doe
email JOHN_D@company.com
service_notification_commands notify-by-email
}
- Restart Nagios for the changes to take effect.
- From the Nagios portal, verify that
xclarity_integrator_check
is listed as a service under localhost.
- Click xclarity_integrator_check to
display the current status, and verify the status is
OK.
- Create an alert condition in the target XClarity Administrator. Verify that an email is sent to the specified contacts, for example:
***** Nagios *****
Notification Type: PROBLEM
Service: xclarity_integrator_check
Host: localhost
Address: 192.0.2.0
State: CRITICAL
Date/Time: Wed Jul 25 08:15:54 EDT 2018
Additional Information:
-----------------------------------------------
Node: SR530 with IP: 192.0.2.10, 192.0.2.11, is in Critical state with the following alerts:
All CPUs have failed with ERROR.
-----------------------------------------------