appuio / nagios-plugins-openshift

Nagios/Icinga 2 Plugins for monitoring OpenShift clusters
BSD 3-Clause "New" or "Revised" License
26 stars 16 forks source link

Installation brokes OC path #18

Open prometherion opened 6 years ago

prometherion commented 6 years ago

Trying to install using make install:

[root@HIDDEN nagios-plugins-openshift]# make install
mkdir -p /usr/lib/nagios-plugins-openshift
cp new-app-and-wait "/usr/lib/nagios-plugins-openshift/new-app-and-wait"
sed -r \
    -e 's#\b(OPENSHIFT_CLIENT_BINARY=)/usr/bin/oc\b#\1usr/lib/openshift-origin-client-tools/oc#' \
    < utils \
    > "/usr/lib/nagios-plugins-openshift/utils"
sed -r \
    -e 's#(^\. )/usr/lib(/nagios-plugins-openshift/utils)$#\1usr/lib\2#g' \
    < write-config \
    > "/usr/lib/nagios-plugins-openshift/write-config"
chmod +x /usr/lib/nagios-plugins-openshift/{utils,write-config,new-app-and-wait}
mkdir -p /usr/lib/nagios/plugins
set -e && for i in check_*; do \
    echo "Patching $i ..." >&2 && \
    sed -re 's#(^\. )/usr/lib(/nagios-plugins-openshift/utils)$#\1usr/lib\2#g' \
        < "$i" \
        > "/usr/lib/nagios/plugins/$(basename "$i")"; \
done
Patching check_hawkular_machine_timestamp ...
Patching check_openshift_cert_expiry_report ...
Patching check_openshift_endtoend_result ...
Patching check_openshift_es_stats ...
Patching check_openshift_node ...
Patching check_openshift_node_fluentd ...
Patching check_openshift_node_list ...
Patching check_openshift_node_resources ...
Patching check_openshift_pod_count ...
Patching check_openshift_pod_cpu_usage ...
Patching check_openshift_pod_memory ...
Patching check_openshift_pod_node_alloc ...
Patching check_openshift_pod_status_count ...
Patching check_openshift_project_phase ...
Patching check_openshift_project_pod_phase ...
Patching check_openshift_pv_avail ...
Patching check_openshift_pvc_phase ...
chmod +x /usr/lib/nagios/plugins/check_*
mkdir -p /usr/share/icinga2/include/plugins-contrib.d
cp -v openshift*.conf /usr/share/icinga2/include/plugins-contrib.d
'openshift.conf' -> '/usr/share/icinga2/include/plugins-contrib.d/openshift.conf'
'openshift-dns.conf' -> '/usr/share/icinga2/include/plugins-contrib.d/openshift-dns.conf'

But executions fails:

[root@HIDDEN nagios-plugins-openshift]# /usr/lib/nagios/plugins/check_openshift_node -f /path/to/kubeconfig -n ocp-node-01.domain.tld
/usr/lib/nagios/plugins/check_openshift_node: line 5: usr/lib/nagios-plugins-openshift/utils: No such file or directory
rahoa commented 6 years ago

Dirty fix.

In Makefile :

10c10
<       -e 's#\b(OPENSHIFT_CLIENT_BINARY=)/usr/bin/oc\b#\1$(LIBDIR)/openshift-origin-client-tools/oc#' \
---
>       -e 's#\b(OPENSHIFT_CLIENT_BINARY=)/usr/bin/oc\b#\1/$(LIBDIR)/openshift-origin-client-tools/oc#' \
14c14
<       -e 's#(^\. )/usr/lib(/nagios-plugins-openshift/utils)$$#\1$(LIBDIR)\2#g' \
---
>       -e 's#(^\. )/usr/lib(/nagios-plugins-openshift/utils)$$#\1/$(LIBDIR)\2#g' \
21c21
<       sed -re 's#(^\. )/usr/lib(/nagios-plugins-openshift/utils)$$#\1$(LIBDIR)\2#g' \
---
>       sed -re 's#(^\. )/usr/lib(/nagios-plugins-openshift/utils)$$#\1/$(LIBDIR)\2#g' \