SlideShare a Scribd company logo
Layout
by
orngjce223,
CC-BY
ZabConf2015 – Sept 11 2015
---
Raymond Kuiper
Working the API like a Unix Pro
Layout
by
orngjce223,
CC-BY
Quick introduction
● @RaymondKuiper
● Zabbix user since 2006, never looked back
● q1x on Freenode (fnd me in #zabbix)
● Proud to work for these guys:
Layout
by
orngjce223,
CC-BY
Sysadmins <3 Automation
Layout
by
orngjce223,
CC-BY
Automation in Zabbix
Layout
by
orngjce223,
CC-BY
How to automate via the API?
Layout
by
orngjce223,
CC-BY
API bash script using Curl
Pros:
● Seems nice and easy at frst
● You can show of your mad curl skills
Layout
by
orngjce223,
CC-BY
API bash script using Curl
Cons:
● No object awareness
● Honestly, it's a PITA
Layout
by
orngjce223,
CC-BY
Develop an API based tool
Pros:
● Perfect solution to your problem
● Highly efcient code
Layout
by
orngjce223,
CC-BY
Develop an API based tool
Cons:
● Takes time and efort to develop (and
debug) a ftting solution
● Not very fexible unless you invest heavily
in development (monolithic)
● Gets very complex, very fast. You might
need a developer to maintain it
Layout
by
orngjce223,
CC-BY
Use a CLI tool
(Zabcon and friends)
Pros:
● Can be used in shell scripts
● Can be used quickly, no need for direct
API code
Layout
by
orngjce223,
CC-BY
Use a CLI tool
(Zabcon and friends)
Cons:
● Learning a new CLI language
● Limited to the functionality the developer
thought was useful
Layout
by
orngjce223,
CC-BY
My solution?
Layout
by
orngjce223,
CC-BY
*nix
The IT swiss army knife
Layout
by
orngjce223,
CC-BY
*nix
The IT swiss army knife
“The whole is greater than the sum of its
parts.”
― Aristotle
Layout
by
orngjce223,
CC-BY
Introducing:
the Zabbix Gnomes
Layout
by
orngjce223,
CC-BY
Zabbix Gnomes
https://github.com/q1x/zabbix-gnomes
Layout
by
orngjce223,
CC-BY
Zabbix Gnomes
~/.zbx.conf
[Zabbix API]
username=johndoe
password=verysecretpassword
api=https://zabbix.mycompany.com/path/to/zabbix/frontend/
no_verify=true
Layout
by
orngjce223,
CC-BY
Zabbix Gnomes
Making them work together
Layout
by
orngjce223,
CC-BY
Ex. 1: Hostgroup Templates
Scenario:
● Hosts in the host group 'App Servers' should
be linked to 'Template App Customapp'
● $someone keeps forgetting to link that
template to newly deployed App servers
● Post-it notes about this don't seem to work
Layout
by
orngjce223,
CC-BY
Ex. 1: Hostgroup Templates
user@localhost$ ./zghostfinder.py 'App Servers'
app-server-001
app-server-002
...
app-server-042
app-server-043
(Finds hosts in a host group)
Layout
by
orngjce223,
CC-BY
Ex. 1: Hostgroup Templates
user@localhost$ ./zhtmplfinder.py 'app-server-001'
Template OS Linux
Template App Customapp
user@localhost$ ./zhtmplfinder.py 'app-server-042'
Template OS Linux
(Finds templates linked to a host)
Layout
by
orngjce223,
CC-BY
Ex. 1: Hostgroup Templates
user@localhost$ ./zhtmpllinker.py
usage: zhtmpllinker.py [-h]
(-H HOSTNAMES [HOSTNAMES ...] | -G
HOSTGROUPS [HOSTGROUPS ...])
-t TEMPLATES [TEMPLATES ...]
user@localhost$ ./zhtmpllinker.py -G 'App Servers' 
-t 'Template App Customapp'
(Links templates to hosts)
Layout
by
orngjce223,
CC-BY
Ex. 1: Hostgroup Templates
user@localhost$ ./zhtmpllinker.py -G 'App Servers' 
-t 'Template App Customapp'
*Pro-tip: Stick it in a crontab!*
Layout
by
orngjce223,
CC-BY
Ex. 1: Hostgroup Templates
user@localhost$ for host in $(./zghostfinder.py 'Netco Test');
do echo "$host : $(./zhtmplfinder.py "$host" | tr 'n' ',')";
done
app-server-001 : Template OS Linux,Template App
app-server-002 : Template OS Linux,Template App
...
app-server-042 : Template OS Linux,Template App
app-server-043 : Template OS Linux,Template App
Layout
by
orngjce223,
CC-BY
Ex. 2: Host Inventory
Scenario:
● $bossman has negotiated a new hardware
support contract with $vendor
● Demands serial/os/type of all Cisco 800s
● Your template stores this info in the Inventory
● You are a happy user of network discovery
Layout
by
orngjce223,
CC-BY
Ex. 2: Host Inventory
user@localhost$ ./zhinvswitcher.py
usage: zhinvswitcher.py [-h] (-H HOSTNAMES [HOSTNAMES ...]
| -G HOSTGROUPS [HOSTGROUPS ...]
| --all-hosts) … [-m MODE] …
(Switches Inv. Mode on hosts)
user@localhost$ ./zhinvswitcher.py -G “Cisco Devices” -m auto
user@localhost$ ./zhinvswitcher.py -G “Cisco Devices” -m auto
(See also ZBXNEXT-1241)
Layout
by
orngjce223,
CC-BY
Ex. 2: Host Inventory
user@localhost$ ./zgetinventory.py
usage: zgetinventory.py [-h] (-H HOSTNAMES [HOSTNAMES ...]
| -G HOSTGROUPS [HOSTGROUPS …]) …
[-m] [-i] … (-A | -F FIELDS [FIELDS ...])
(Gets Zabbix inventory information)
Layout
by
orngjce223,
CC-BY
Ex. 2: Host Inventory
user@localhost$ ./zgetinventory.py -G 'Cisco Devices ' 
-e -m -i -F serialno_a type os | 
sed -n -e 1p -e '/C8../'p | 
cut -d ',' -f 2-
"host","serialno_a","type","os"
"RT01","FCZ999999A","C819G-4G-G-K9","15.4(3)M1, RELEASE SOFTWARE
(fc1)"
"RT02","FCZ999999B","C887VA-K9","15.4(1)T1, RELEASE SOFTWARE
(fc2)"
"RT03","FCZ999999C","C887VA-K9","15.4(3)M1, RELEASE SOFTWARE
(fc1)"
...
Layout
by
orngjce223,
CC-BY
Ex. 3: Emailing Graphs
Scenario:
● $colleague needs daily CPU graphs
● Can't be bothered with browsing the GUI
every morning before getting cofee
● You'd like to help him reach his mailbox quota
Layout
by
orngjce223,
CC-BY
Ex. 3: Emailing Graphs
user@localhost$ ./zghostfinder.py 'Linux Servers'
Wakizashi
Kodachi
Katana
Layout
by
orngjce223,
CC-BY
Ex. 3: Emailing Graphs
user@localhost$ ./zhgraphfinder.py -e Kodachi
568:Network traffic on eth0
555:CPU jumps
556:CPU load
557:CPU utilization
558:Swap usage
569:Disk space usage /
560:Memory usage
(Finds graphs confgured on a host)
Layout
by
orngjce223,
CC-BY
Ex. 3: Emailing Graphs
user@localhost$ ./zgetgraph.py -f graph.png 557
(Downloads a graph from the frontend)
Layout
by
orngjce223,
CC-BY
#!/bin/bash
graphs=""
filelist=""
# find graphs on hosts in group 'Linux Servers'
for host in $(zghostfinder.py "Linux Servers"); do
hgraphs=$(zhgraphfinder.py -e $host | grep "CPU utilization" 
| cut -d ':' -f 1 )
graphs="$graphs $hgraphs"
done
# download graphs
for graph in $graphs; do
file="/tmp/$graph.png"
filelist="$filelist -a $file"
zgetgraph.py -t 86400 -f "$file" "$graph"
done
# Mail the graphs and cleanup
echo "See attached." | mail $filelist -s "Daily graphs"
"user@some.tld"
rm -r $(echo "$filelist" | sed 's/-a //g')
Ex. 3: Emailing Graphs
Layout
by
orngjce223,
CC-BY
Things to think about
Layout
by
orngjce223,
CC-BY
Questions?

More Related Content

PDF
Rihards Olups - Zabbix 3.0: Excited for new features?
PDF
Aaron Mildenstein - Using Logstash with Zabbix
PDF
Volker Fröhlich - How to Debug Common Agent Issues
PPT
{{more}} Kibana4
PDF
Securing Prometheus exporters using HashiCorp Vault
PPT
ELK stack at weibo.com
PDF
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
PDF
Network Automation: Ansible 102
Rihards Olups - Zabbix 3.0: Excited for new features?
Aaron Mildenstein - Using Logstash with Zabbix
Volker Fröhlich - How to Debug Common Agent Issues
{{more}} Kibana4
Securing Prometheus exporters using HashiCorp Vault
ELK stack at weibo.com
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
Network Automation: Ansible 102

What's hot (20)

PPTX
Nomad + Flatcar: a harmonious marriage of lightweights
PDF
Introduction to Node.js: What, why and how?
PDF
Nodejs Explained with Examples
PDF
DevOps tools for everyone - Vagrant, Puppet and Webmin
PDF
Everything as a code
PPTX
All you need to know about the JavaScript event loop
PDF
Autoscaling with hashi_corp_nomad
PDF
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
PDF
Automation with Ansible and Containers
PDF
Nodejs - A quick tour (v4)
PDF
openstack源码分析(1)
PPTX
JavaScript Engines and Event Loop
PDF
About Node.js
PDF
Testing your infrastructure with litmus
PPTX
A complete guide to Node.js
PPTX
Zabbix 3.2 presentation June 2017
PDF
Regex Considered Harmful: Use Rosie Pattern Language Instead
PDF
Nodejs - Should Ruby Developers Care?
KEY
Introduction to node.js
PDF
I can't believe it's not a queue: Kafka and Spring
Nomad + Flatcar: a harmonious marriage of lightweights
Introduction to Node.js: What, why and how?
Nodejs Explained with Examples
DevOps tools for everyone - Vagrant, Puppet and Webmin
Everything as a code
All you need to know about the JavaScript event loop
Autoscaling with hashi_corp_nomad
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
Automation with Ansible and Containers
Nodejs - A quick tour (v4)
openstack源码分析(1)
JavaScript Engines and Event Loop
About Node.js
Testing your infrastructure with litmus
A complete guide to Node.js
Zabbix 3.2 presentation June 2017
Regex Considered Harmful: Use Rosie Pattern Language Instead
Nodejs - Should Ruby Developers Care?
Introduction to node.js
I can't believe it's not a queue: Kafka and Spring
Ad

Viewers also liked (20)

PDF
Vladimir Ulogov - Beyond the Loadable Module
PDF
Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016
PDF
Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016
PDF
"Graphite — как построить миллион графиков". Дмитрий Куликовский, Яндекс
PDF
Oleg Ivanivskyi - Lessons Learned While Being On-Site | ZabConf2016
PDF
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
PDF
Rafael Martinez Guerrero Zabbix CLI | ZabConf2016 Lightning Talk
PDF
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
PDF
Inaba Kazuhiko - Ahiruyaki Zabbix in Japan Part 2 | ZabConf2016 Lightning Talk
PDF
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
PDF
Zabbix Conference LatAm 2016 - Paulo Deolindo - Case Study_BBTS and Zabbix
PPTX
Zabbix visión general del sistema - 04.12.2013
PDF
Konstantin Yakovlev - Event Analysis Toolset | ZabConf2016
PDF
Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016
PDF
Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...
PDF
Alexei Vladishev - Opening Speech | ZabConf2016
PDF
Zabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMP
PDF
Zabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil Community
PDF
Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...
PDF
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Vladimir Ulogov - Beyond the Loadable Module
Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016
Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016
"Graphite — как построить миллион графиков". Дмитрий Куликовский, Яндекс
Oleg Ivanivskyi - Lessons Learned While Being On-Site | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Rafael Martinez Guerrero Zabbix CLI | ZabConf2016 Lightning Talk
Vladimir Ulogov - Large Scale Simulation | ZabConf2016 Lightning Talk
Inaba Kazuhiko - Ahiruyaki Zabbix in Japan Part 2 | ZabConf2016 Lightning Talk
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Zabbix Conference LatAm 2016 - Paulo Deolindo - Case Study_BBTS and Zabbix
Zabbix visión general del sistema - 04.12.2013
Konstantin Yakovlev - Event Analysis Toolset | ZabConf2016
Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016
Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...
Alexei Vladishev - Opening Speech | ZabConf2016
Zabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMP
Zabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil Community
Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Ad

Similar to Raymond Kuiper - Working the API like a Unix Pro (20)

PPTX
Toolbox of a Ruby Team
PDF
Designate Install and Operate Workshop
PDF
How to create your own hack environment
PDF
오픈 소스 프로그래밍 - NoSQL with Python
PDF
Securité des container
PDF
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
PDF
Pdf tech deep dive 42 paris
KEY
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
PDF
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
PDF
VSTS/ TFS automated Release Pipelines for Web Applications with Docker
PDF
Ansible101
PDF
Infrastructure as code
PDF
From development environments to production deployments with Docker, Compose,...
PDF
Easy Cloud Native Transformation using HashiCorp Nomad
PDF
NGINX Ingress Controller for Kubernetes
PPTX
Kubernetes - State of the Union (Q1-2016)
ZIP
Mojolicious
PPTX
TIAD 2016 : Migrating 100% of your production services to containers
PPTX
Scaling Docker Containers using Kubernetes and Azure Container Service
PPTX
Node.js - Advanced Basics
Toolbox of a Ruby Team
Designate Install and Operate Workshop
How to create your own hack environment
오픈 소스 프로그래밍 - NoSQL with Python
Securité des container
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Pdf tech deep dive 42 paris
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
VSTS/ TFS automated Release Pipelines for Web Applications with Docker
Ansible101
Infrastructure as code
From development environments to production deployments with Docker, Compose,...
Easy Cloud Native Transformation using HashiCorp Nomad
NGINX Ingress Controller for Kubernetes
Kubernetes - State of the Union (Q1-2016)
Mojolicious
TIAD 2016 : Migrating 100% of your production services to containers
Scaling Docker Containers using Kubernetes and Azure Container Service
Node.js - Advanced Basics

More from Zabbix (14)

PDF
Zabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with Zabbix
PDF
Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...
PDF
Zabbix Conference LatAm 2016 - Andre Deo - SNMP and Zabbix
PDF
Zabbix Conference LatAm 2016 - Rodrigo Mohr - Challenges on Large Env with Or...
PDF
Zabbix Conference LatAm 2016 - Marcio Prop - Monitoring Complex Environments ...
PDF
Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...
PDF
Rihards Olups - Zabbix at Nokia - Case Study
PDF
Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016
PDF
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
PDF
Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016
PDF
Ingus Vilnis - Benefits of Zabbix Training | ZabConf2016
PDF
Alexander Naydenko - Nagios to Zabbix Migration | ZabConf2016
PDF
Alain Ganuchaud - Trouble Ticket Integration with Zabbix in Large Environment...
PDF
Rihards Olups - Zabbix log management
Zabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with Zabbix
Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...
Zabbix Conference LatAm 2016 - Andre Deo - SNMP and Zabbix
Zabbix Conference LatAm 2016 - Rodrigo Mohr - Challenges on Large Env with Or...
Zabbix Conference LatAm 2016 - Marcio Prop - Monitoring Complex Environments ...
Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...
Rihards Olups - Zabbix at Nokia - Case Study
Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016
Ingus Vilnis - Benefits of Zabbix Training | ZabConf2016
Alexander Naydenko - Nagios to Zabbix Migration | ZabConf2016
Alain Ganuchaud - Trouble Ticket Integration with Zabbix in Large Environment...
Rihards Olups - Zabbix log management

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation theory and applications.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
KodekX | Application Modernization Development
MYSQL Presentation for SQL database connectivity
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Network Security Unit 5.pdf for BCA BBA.
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation theory and applications.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Machine learning based COVID-19 study performance prediction
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Per capita expenditure prediction using model stacking based on satellite ima...
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KodekX | Application Modernization Development

Raymond Kuiper - Working the API like a Unix Pro