- The checks/plugins used are basic shell scripts that can be found on https://github.com/colebrooke/kubernetes-nagios/blob/master/README.md
- These scripts were downloaded to a server that has network access to our Demo Kubernetes cluster.
- These dependencies had to be installed on the server in order for the script to work:
- Kubectl ? used by the scripts to fetch metrics from the kubernetes cluster
- google-cloud-sdk ? used for authenticating and getting credentials. Gcloud also creates a kube_config file that is then passed on to the scripts.
- The scripts were copied to the /opt/plugins/custom and were given the appropriate rights.
- Once that is done, we need to configure the NRPE commands (the scripts can be used without NRPE directly on a poller or an OP5 server) on the server that will be used by our OP5 server. In this example, we are just executing the kube_scripts with no parameters. Using the default thresholds.
Add this block to your NRPE config. If you are not using NRPE, simply exclude everything before the "=" sign and use that as your command for the check.
-k <KUBE_CONFIG> # Path to kube config file, created when running gcloud.
command[check_kube_nodes]=/opt/plugins/custom/kubernetes-nagios/check_kube_nodes.sh -k /opt/plugins/custom/kubernetes-nagios/config
command[check_kube_deployments]=/opt/plugins/custom/kubernetes-nagios/check_kube_deployments.sh -k /opt/plugins/custom/kubernetes-nagios/config
command[check_kube_pods]=/opt/plugins/custom/kubernetes-nagios/check_kube_pods.sh -k /opt/plugins/custom/kubernetes-nagios/config
command[check_kubernetes_api]=/opt/plugins/custom/kubernetes-nagios/check_kubernetes_api.sh -k /opt/plugins/custom/kubernetes-nagios/config
Once that is configured on the server, we need to connect our OP5 server to our server with the kubernetes scripts.
Once we have configured the checks to execute the script, the service check (get pods) should look like this.