Bug 1328148

Summary: local checks not working anymore
Product: [Fedora] Fedora EPEL Reporter: Dan <danilo.speck>
Component: check-mkAssignee: Andrea Veri <andrea.veri>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: andrea.veri, danilo.speck
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-18 15:23:29 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:

Description Dan 2016-04-18 15:05:03 UTC
Description of problem:
After updating the installed "check-mk-agent-1.2.6p16-1" which comes from my check_mk server (latest stable version) to the epel version "check-mk-agent-1.2.6p16-3" the local checks aren't working anymore.
Also the directory "/usr/lib/check_mk_agent" is not created on a fresh system.


Version-Release number of selected component (if applicable):
check-mk-agent-1.2.6p16-3.el7.x86_64

How reproducible:
Update to actual version or install a fresh system with epel version of check-mk-agent.

Steps to Reproduce:
1. install check-mk-agent-1.2.6p16-1 
2. put script in /usr/lib/check_mk_agent/local folder 
3. check that it's working with "check_mk_agent"
4. upgrade to epel version "check-mk-agent-1.2.6p16-3"
5. check that local scripts aren't working with "check_mk_agent"

Alternate:
1. install fresh centos 7
2. install epel repo
3. install check-mk-agent

Actual results:
Old Scripts in this folder aren't working.
The folder is not created on new systems: "/usr/lib/check_mk_agent" 

Expected results:
Scripts in local Folder should work with command "check_mk_agent"

Additional info:

Comment 1 Andrea Veri 2016-04-18 15:23:29 UTC
The "/usr/lib/check_mk_agent" path has never worked unless you patched your local copy to make use of it. The correct path is "/usr/share/check-mk-agent/local", which is created and sourced correctly when the package is installed:

from "/usr/bin/check_mk_agent":
export MK_LIBDIR="/usr/share/check-mk-agent"
LOCALDIR=$MK_LIBDIR/local

from ls -l:

ls -l /usr/share/check-mk-agent/     
totale 12
drwxr-xr-x. 2 root root 4096  2 apr 11.28 available-plugins
drwxr-xr-x. 2 root root 4096  9 mar 14.55 local
drwxr-xr-x. 2 root root 4096  2 apr 11.28 plugins

Comment 2 Dan 2016-04-18 15:30:35 UTC
Sorry but on the offical page this is written:
"Writing local checks is done by putting executable programs (usually shell scripts or similar) into a specific directory which is scanned by the agent. The default directory for such local checks is /usr/lib/check_mk_agent/local for Linux/UNIX agents - on your target hosts."

The official package works like this for years!
But your package is marked as newer and breaks the official agent.

I can confirm that your path is working but why don't you use the original paths?

Comment 3 Andrea Veri 2016-04-18 20:03:55 UTC
What I define as being the "official package" is the one we maintain here in Fedora / EPEL and I can tell you for sure that the path outlined above has never changed since the package was originally introduced on the repositories. About the path itself Fedora and EPEL have a set of guidelines when it comes to where files and directories owned by a certain package should be installed. These guidelines inherited from the FHS [1] canonical locations for files and directories having a specific scope within the fs in general. Please check what /usr/lib is for at [2] and you'll understand why Check-MK upstream packaging is not compliant to Fedora's packaging guidelines.

[1] http://www.pathname.com/fhs/pub/fhs-2.3.html 
[2] http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLIBLIBRARIESFORPROGRAMMINGANDPA