Skip to content
This repository has been archived by the owner on Jul 5, 2018. It is now read-only.
/ pods_on_node.py Public archive

nagios plugin to show quantity of pods on openshift/kubernetes node

Notifications You must be signed in to change notification settings

mrGrab/pods_on_node.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Nagios plugin for openshift

This is simple python script which sends api request to openshift (or kubernetes) master server: /api/v1/pods and parse json response.

usage:
	 pods_on_node.py --ulr openshift_master --node node_name --token bearer_token 
	                  --warn int_of_pods --crit int_of_pods

Nagios plugin to get number of pods in node

optional arguments:
  -h, --help               show this help message and exit
  -u URL, --url URL        url:[port] of openshfit or kubernetes master server
  -n NODE, --node NODE     node name for which you need info
  -t TOKEN,--token TOKEN  token for connection to openshift master
  -w WARN, --warn WARN     warning level of quantity pods
  -c CRIT, --crit CRIT     critical level of quantity pods

to use it you have to get token from secret for service account with cluster-reader permissions. If you have configured origin-metrics you can use heapster token:

$ oc describe serviceaccount heapster -n openshift-infra

$ oc describe secret heapster-token-vs065
Name:		heapster-token-vs065
Namespace:	openshift-infra
Labels:		
Annotations:	.....

Type:	kubernetes.io/service-account-token

Data
====
token:		HERE IS TOKEN

....

but also you can create new one for nagios:

$ oc create -f - << API
apiVersion: v1
kind: ServiceAccount
metadata:
  name: nagios
secrets:
- name: nagios
API

$ oc describe serviceaccount nagios
$ oc describe secret nagios-token-zzzzz

oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:openshift-infra:nagios

That's it. Enjoy.

About

nagios plugin to show quantity of pods on openshift/kubernetes node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages