Skip to content

objectiveit/zabbix-kubernetes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

zabbix-kubernetes is "plugin" used for Kubernetes monitoring. Easy to deploy and configure. Addition of all metrics for pods, deployments, services, etc are done automatically. Script designed to make addition of new metrics easy w/o interaction with scripting or console.

Installation

  1. Install required Perl modules with cpan
    • LWP::UserAgent
    • JSON
  2. Copy scripts to zabbix external scripts path
  3. Import Zabbix template
  4. Configure zabbix macros in template with correct path to kubernetes config file (which can be used by kubectl)
  5. Check other macros related to triger thresholds
  6. Create Zabbix API user and assign appropriate permissions. User must have "Admin Role" and has access to host groups with monitored hosts
  7. Check "CONFIG" section in both scripts and set appropriate values for variables

Creating new items

Plugin has its own syntax for key. You dont need to change anything in scripts or creating cronjobs, etc. All you need to do is to create item with appropriate key. Items has the following syntax: trap.k8s.<kind>[<namespace>,<name>,<jsonpath>]

  • trap.k8s. - prefix used to filter items via Zabbix API, for 99.9% needs just write it as is.
  • <kind> - can be pods,deployments,services,nodes
  • <namespace> - namespace or none for deployments
  • <name> - name from metadata (any kind)
  • <jsonpath> - path inside of kubectl JSON output. For arrays additional expression must be set. E.g. for getting status of nodes in "conditoins":
    trap.k8s.nodes[default,minikube,status.conditions(type=DiskPressure).status]

Zabbix Marcos used:

  • {$NAMESPACE} - per namespace separation (one zabbix host = one namespace). Multiple namespaces supported (separate with comma)
  • {$K8SCONFIG} - path to kubernetes config (should be readable by zabbix server). Multiple configs supported.
  • {$CONTAINER_RESTART_THRESH} - threshold for container restart count
  • {$DISCOVERY_NODATA_PERIOD} - no data from discovery period for trigger

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages