Bug 1478895

Summary: Tang should support the Nagios engine for event recording
Product: Red Hat Enterprise Linux 7 Reporter: Dmitri Pal <dpal>
Component: tangAssignee: Nathaniel McCallum <npmccallum>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Jaburek <jjaburek>
Severity: medium Docs Contact: Mirek Jahoda <mjahoda>
Priority: medium    
Version: 7.4CC: ebenes, herrold, jjaburek, mjahoda, rrajashe
Target Milestone: rcKeywords: TestOnly
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
_tang-nagios_ enables *Nagios* to monitor *Tang* The _tang-nagios_ subpackage provides the *Nagios* plugin for *Tang*. The plugin enables the *Nagios* program to monitor a *Tang* server. The subpackage is available in the Optional channel. See the `tang-nagios(1)` man page for more information.
Story Points: ---
Clone Of:
: 1490328 (view as bug list) Environment:
Last Closed: 2018-03-01 14:06:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1490328    

Description Dmitri Pal 2017-08-07 13:00:44 UTC
Tang should support the Nagios engine for event recording.
This functionality (tang-nagious) is available upstream (and Fedora) and needs to be productized.
https://www.mankier.com/1/tang-nagios

Comment 1 Nathaniel McCallum 2017-08-17 14:00:08 UTC
Testing instructions:

$ dnf -y install tang tang-nagios
...
$ systemctl start tangd.socket
...
$ /usr/lib64/nagios/plugins/tang -u http://localhost
OK|adv=27611 exc=46064 nkeys=2 nsigk=1 nexck=1
$ echo $?
0

This should output data according to this API: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/pluginapi.html

The specific data points we return are defined in the tang-nagios man page.

You can also test for the failure case:
$ sudo systemctl stop tangd.socket
...
$ /usr/lib64/nagios/plugins/tang -u http://localhost
Unable to connect to server!
$ echo $?
2

Full testing would involve actually setting up a nagios instance and attempting to use the plugin. I have not done this, but others have.

Comment 2 Jiri Jaburek 2017-08-18 10:51:06 UTC
Note that all other nagios plugins (RPMS) in EPEL and the non-tang one in RHEL are named like "nagios-plugins-$name", not "$name-nagios".

Comment 3 Jiri Jaburek 2017-08-18 11:43:31 UTC
Some more detailed notes how to properly test this:

 1) install nagios and ie. nagios-plugins-all RPMs from EPEL
 2) set selinux to permissive (or write policy module for nagios)
 3) enable and start httpd and nagios services
 4) htpasswd -c /etc/nagios/passwd nagiosadmin;  enter some password
 5) login via web browser on http://hostname/nagios, you should see "Daemon running with PID ..."
 6) install tang and tang-nagios
 7) edit /usr/lib/systemd/system/tangd.socket, change port to ie. 81
 8) rm -rf /var/db/tang/* /var/cache/tang/*
 9) /usr/libexec/tangd-keygen /var/db/tang
10) /usr/libexec/tangd-update /var/db/tang /var/cache/tang
11) /usr/lib64/nagios/plugins/tang -u http://localhost:81;  should return OK
12) edit /etc/nagios/objects/commands.cfg, add 'define command', see below
13) edit /etc/nagios/objects/localhost.cfg, add 'define service', see below
14) restart the nagios service
15) refresh nagios web ui, see Tang in localhost services list
16) wait a few minutes for PENDING to become OK

define command{
        command_name    check_tang
        command_line    /usr/lib64/nagios/plugins/tang -u $ARG1$
}

define service{
        use                             local-service
        host_name                       localhost
        service_description             Tang
        check_command                   check_tang!http://localhost:81
        notifications_enabled           0
        }


From there on, testing other cases (missing keys, tangd not enabled, etc.) is possible.

Comment 4 Nathaniel McCallum 2017-08-18 12:47:06 UTC
(In reply to Jiri Jaburek from comment #2)
> Note that all other nagios plugins (RPMS) in EPEL and the non-tang one in
> RHEL are named like "nagios-plugins-$name", not "$name-nagios".

I'm aware of this. When I last checked, all of the "nagios-plugins-$name" packages were subpackages of nagios. We can rename the package if we think it is important. Let me know what your opinion is.

Comment 5 Jiri Jaburek 2017-08-21 10:27:51 UTC
(In reply to Nathaniel McCallum from comment #4)
> (In reply to Jiri Jaburek from comment #2)
> > Note that all other nagios plugins (RPMS) in EPEL and the non-tang one in
> > RHEL are named like "nagios-plugins-$name", not "$name-nagios".
> 
> I'm aware of this. When I last checked, all of the "nagios-plugins-$name"
> packages were subpackages of nagios. We can rename the package if we think
> it is important. Let me know what your opinion is.

Since we already have one other nagios plugin in RHEL (optional channel):

Name        : nagios-plugins-bacula
Arch        : x86_64
Version     : 5.2.13
Release     : 23.1.el7
Size        : 26 k
Repo        : rhel-ks-opt
Summary     : Nagios Plugin - check_bacula
URL         : http://www.bacula.org
License     : AGPLv3 with exceptions
Description : Provides check_bacula support for Nagios.

I'd suggest we follow the naming scheme.