SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
SNMP, for those times you can't
install the Zabbix agent.
Andrew Nelson
Senior Linux Consultant
Sep 10, 2015
Zabconf 2015, Riga, Latvia
RED HAT | Andrew Nelson2/27
Overview
● Introduction
● What is SNMP
● Extending the Net-SNMP agent
● My first MIB
● A sub-agent for your MIB
RED HAT | Andrew Nelson3/27
$ whoami
● Andrew Nelson
● anelson@redhat.com
● Senior Linux Consultant with Red Hat North America
● Active in the Zabbix community for approximately 10
years
● Known as “nelsonab” in
forums and IRC
● Author of the Zabbix API
Ruby library zbxapi
SNMP
a “Simple” Introduction
RED HAT | Andrew Nelson5/27
Topics
● SNMP Overview
● OIDs
● Units
● Tables
● Using SNMP With Zabbix
● Extending SNMP
RED HAT | Andrew Nelson6/27
What is SNMP
● Simple Network Monitoring Protocol
● Like all standards, it's not simple!
● Defined by numerous RFCs
● Uses a hierarchical data model
● Employs an Agent – Manager design
● Agents can be nested
● Is extensible
RED HAT | Andrew Nelson7/27
What is SNMP
● SNMP uses OIDs to identify each item
● OIDs are numeric with text translations provided by
MIB files.
Using SNMP with Zabbix
RED HAT | Andrew Nelson9/27
Zabbix And SNMP
● Available since version 1.1
● One request per network connection before 2.2.3
● Dynamic index lookups available since version 1.5
● Item[“index”,”base item”,”row”]
● ifInOctets["index","ifDescr","GigabitEthernet0/1"]
RED HAT | Andrew Nelson10/27
Zabbix and SNMP
● Configure a global macro for {$SNMP_COMMUNITY}
then override locally for each host as needed.
● Templates make use of this macro
● Some parameters require some “massaging” before
they are useful.
● Disk space is often in the form of N Allocation Units,
not bytes.
● Calculated value: alocation_units[disk]*free_space[disk]
RED HAT | Andrew Nelson11/27
Zabbix and SNMP
● Because calculated items are needed timelines may
become very skewed.
● Free disk space is checked every 10 minutes
● Space calculation is performed every 10 minutes
● Graphed value could be time skwed by 20 minutes!
● Zabbix needs the ability for inbound value calculation.
● If only there were a scripting interface for this…..
RED HAT | Andrew Nelson12/27
Zabbix and SNMP
● It is possible to derive percent utilization from
accumulated time items.
● Set the item to Delta per second
● Convert the time scale to “centi-seconds” and store as
a float with a unit of “%”.
● Resultant value will be an approximation of the percent
utilization.
● However, it is skewed by the number of threads (CPU's)
available to process the item being counted.
RED HAT | Andrew Nelson13/27
Zabbix and SNMP
RED HAT | Andrew Nelson14/27
Zabbix and SNMP
RED HAT | Andrew Nelson15/27
Zabbix and SNMP
● When using SNMP for host discovery be careful when
using SNMPv2-MIB::sysDescr.0
● It will change with kernel updates
● Zabbix will then detect the updated machine as a new
system
● Best to override this parameter in snmpd.conf, or
perhaps use an extend script to return the dmi item uuid
# dmidecode -s system-uuid
93737AE6-8A60-2B41-BEA4-B61C7ACD8063
RED HAT | Andrew Nelson16/27
Zabbix and SNMP
● When using direct OID numbers be careful.
● OID number may remap over time, especially if the
value in question is part of a table.
● OID table members are not guaranteed to have the
same OID numbers across restarts of the SNMP agent
(or host reboot)
● If MIB text is not translating correctly ensure the MIB
file is in /usr/share/snmp/mibs (for RHEL systems).
● Ensure the OID in question translates correctly using
snmptranslate.
RED HAT | Andrew Nelson17/27
Zabbix and SNMP
● The snmp tools are your friends
● net-snmp-utils rpm on RHEL
● snmpwalk will allow you to peak at all of the items
available.
● Adding the parameter -On is useful when MIB translations or
namespaces are hampering things.
● snmptranslate can help ensure MIB files are loading
correctly
$ snmptranslate -IR myCustomOID
Unknown object identifier: myCustomOID
Going beyond the basic SNMP
Agent
RED HAT | Andrew Nelson19/27
Extending Net-SNMP
● Common mechanisms available
● Extend – Raw Shell Scripts
● Perl – Call perl scripts directly
● Pass – Start a subprocess to handle a given OID
subtree
● PassPersist – Similar to pass but keep running
● AgentX – A form of sub-agent where a process listens
for requests on a socket.
● Plus a few more not mentioned above
RED HAT | Andrew Nelson20/27
Extending Net-SNMP
● A simple extend: (/usr/local/bin/check_proc.sh)
#!/bin/sh
PATTERN=$1
NUMPIDS=`pgrep $PATTERN | wc -l`
echo "There are $NUMPIDS $PATTERN processes."
echo "$NUMPIDS"
exit $NUMPIDS
● The statement in the snmpd.conf file
extend httpd_pids /bin/sh /usr/local/bin/check_proc.sh httpd
RED HAT | Andrew Nelson21/27
Extending Net SNMP
● Snmpwalk of the extend script
RED HAT | Andrew Nelson22/27
Extending Net SNMP
● Adding the item is as simple as adding an snmp item
and assigning it to a key
● No need to worry about OID's changing
RED HAT | Andrew Nelson23/27
● Note when using the exit value from a script, it's
maximum value is 256, any value over will roll over.
● Ex: An exit value of 5000 will result in an actual value of
136 5000-(256*19) = 136
● Place the value in question on a separate line and use
NET SNMP EXTEND MIB::nsExtendOutLine."ITEM".‑ ‑ ‑
n
● Where n is the line in question and ITEM is the extend
item.
Extending Net SNMP
RED HAT | Andrew Nelson24/27
Extending Net SNMP
● Adding uuid information to snmp via extend
extend host_uuid /usr/sbin/dmidecode -s system-uuid
● In discovery use the item:
NET SNMP EXTEND MIB::nsExtendOutLine."host_uuid".1‑ ‑ ‑
Conclusion
RED HAT | Andrew Nelson26/27
Conclusion
RED HAT | Andrew Nelson27/27
Questions
Fragen
jautājumi
質問pytania
vragen
kysymykset
питання
вопросы
spørgsmål domande
preguntas
otázky

Contenu connexe

Tendances

Tendances (20)

What is new in icinga2
What is new in icinga2What is new in icinga2
What is new in icinga2
 
Automating Zabbix with Puppet (Werner Dijkerman / 26-11-2015)
Automating Zabbix with Puppet (Werner Dijkerman / 26-11-2015)Automating Zabbix with Puppet (Werner Dijkerman / 26-11-2015)
Automating Zabbix with Puppet (Werner Dijkerman / 26-11-2015)
 
Grafana and MySQL - Benefits and Challenges
Grafana and MySQL - Benefits and ChallengesGrafana and MySQL - Benefits and Challenges
Grafana and MySQL - Benefits and Challenges
 
Nagios Conference 2014 - Jack Chu - How to Think With Nagios to Solve Monitor...
Nagios Conference 2014 - Jack Chu - How to Think With Nagios to Solve Monitor...Nagios Conference 2014 - Jack Chu - How to Think With Nagios to Solve Monitor...
Nagios Conference 2014 - Jack Chu - How to Think With Nagios to Solve Monitor...
 
Jesse Olson - Nagios Log Server Architecture Overview
Jesse Olson - Nagios Log Server Architecture OverviewJesse Olson - Nagios Log Server Architecture Overview
Jesse Olson - Nagios Log Server Architecture Overview
 
Matt Bruzek - Monitoring Your Public Cloud With Nagios
Matt Bruzek - Monitoring Your Public Cloud With NagiosMatt Bruzek - Monitoring Your Public Cloud With Nagios
Matt Bruzek - Monitoring Your Public Cloud With Nagios
 
Monitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with ZabbixMonitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with Zabbix
 
Alexander Naydenko - Nagios to Zabbix Migration | ZabConf2016
Alexander Naydenko - Nagios to Zabbix Migration | ZabConf2016Alexander Naydenko - Nagios to Zabbix Migration | ZabConf2016
Alexander Naydenko - Nagios to Zabbix Migration | ZabConf2016
 
Nagios Conference 2013 - John Sellens - Monitoring Remote Locations with Nagios
Nagios Conference 2013 - John Sellens - Monitoring Remote Locations with NagiosNagios Conference 2013 - John Sellens - Monitoring Remote Locations with Nagios
Nagios Conference 2013 - John Sellens - Monitoring Remote Locations with Nagios
 
Toshaan Bharvani – Icinga2 and Ansible, how to manage and migrate
Toshaan Bharvani – Icinga2 and Ansible, how to manage and migrateToshaan Bharvani – Icinga2 and Ansible, how to manage and migrate
Toshaan Bharvani – Icinga2 and Ansible, how to manage and migrate
 
Nagios Conference 2012 - Mike Weber - Failover
Nagios Conference 2012 - Mike Weber - FailoverNagios Conference 2012 - Mike Weber - Failover
Nagios Conference 2012 - Mike Weber - Failover
 
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
Monitoring a billion kilometers of monthly ride sharing at BlaBlaCar - Zabbix...
 
Icinga Web 2 is more - Module magic at Icinga Camp San Francisco
Icinga Web 2 is more - Module magic at Icinga Camp San FranciscoIcinga Web 2 is more - Module magic at Icinga Camp San Francisco
Icinga Web 2 is more - Module magic at Icinga Camp San Francisco
 
Nrpe
NrpeNrpe
Nrpe
 
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
Mikhail Serkov - Zabbix for HPC Cluster Support | ZabConf2016
 
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a MonthUSENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
 
Icinga2 Hacking Session 2014-10-10
Icinga2 Hacking Session 2014-10-10Icinga2 Hacking Session 2014-10-10
Icinga2 Hacking Session 2014-10-10
 
Icinga 2010 at Nagios Workshop
Icinga 2010 at Nagios WorkshopIcinga 2010 at Nagios Workshop
Icinga 2010 at Nagios Workshop
 
OSMC 2014: Interesting use cases of Zabbix improvements in latest versions | ...
OSMC 2014: Interesting use cases of Zabbix improvements in latest versions | ...OSMC 2014: Interesting use cases of Zabbix improvements in latest versions | ...
OSMC 2014: Interesting use cases of Zabbix improvements in latest versions | ...
 
Why favour Icinga over Nagios @ FrOSCon 2015
Why favour Icinga over Nagios @ FrOSCon 2015Why favour Icinga over Nagios @ FrOSCon 2015
Why favour Icinga over Nagios @ FrOSCon 2015
 

Similaire à Andrew Nelson - Zabbix and SNMP on Linux

Automation@Brainly - Polish Linux Autumn 2014
Automation@Brainly - Polish Linux Autumn 2014Automation@Brainly - Polish Linux Autumn 2014
Automation@Brainly - Polish Linux Autumn 2014
vespian_256
 
OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...
OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...
OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...
NETWAYS
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
 

Similaire à Andrew Nelson - Zabbix and SNMP on Linux (20)

SNMP, for those times you can't install the Zabbix agent. - Zabbix Conference...
SNMP, for those times you can't install the Zabbix agent. - Zabbix Conference...SNMP, for those times you can't install the Zabbix agent. - Zabbix Conference...
SNMP, for those times you can't install the Zabbix agent. - Zabbix Conference...
 
Neutron Network Namespaces and IPtables--A Technical Deep Dive
Neutron Network Namespaces and IPtables--A Technical Deep DiveNeutron Network Namespaces and IPtables--A Technical Deep Dive
Neutron Network Namespaces and IPtables--A Technical Deep Dive
 
Automation of Hadoop cluster operations in Arm Treasure Data
Automation of Hadoop cluster operations in Arm Treasure DataAutomation of Hadoop cluster operations in Arm Treasure Data
Automation of Hadoop cluster operations in Arm Treasure Data
 
Pdf c1t tlawaxb
Pdf c1t tlawaxbPdf c1t tlawaxb
Pdf c1t tlawaxb
 
NetFlow Data processing using Hadoop and Vertica
NetFlow Data processing using Hadoop and VerticaNetFlow Data processing using Hadoop and Vertica
NetFlow Data processing using Hadoop and Vertica
 
Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2Netflix Open Source Meetup Season 4 Episode 2
Netflix Open Source Meetup Season 4 Episode 2
 
Terraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCPTerraforming your Infrastructure on GCP
Terraforming your Infrastructure on GCP
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
 
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...
 
OSMC 2009 | net-snmp: The forgotten classic by Dr. Michael Schwartzkopff
OSMC 2009 | net-snmp: The forgotten classic by Dr. Michael SchwartzkopffOSMC 2009 | net-snmp: The forgotten classic by Dr. Michael Schwartzkopff
OSMC 2009 | net-snmp: The forgotten classic by Dr. Michael Schwartzkopff
 
Building a Small DC
Building a Small DCBuilding a Small DC
Building a Small DC
 
Automation@Brainly - Polish Linux Autumn 2014
Automation@Brainly - Polish Linux Autumn 2014Automation@Brainly - Polish Linux Autumn 2014
Automation@Brainly - Polish Linux Autumn 2014
 
Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)
 
Building a Small Datacenter
Building a Small DatacenterBuilding a Small Datacenter
Building a Small Datacenter
 
OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...
OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...
OSDC 2015: Roland Kammerer | DRBD9: Managing High-Available Storage in Many-N...
 
OSMC 2014: Naemon 1, 2, 3, N | Andreas Ericsson
OSMC 2014: Naemon 1, 2, 3, N | Andreas EricssonOSMC 2014: Naemon 1, 2, 3, N | Andreas Ericsson
OSMC 2014: Naemon 1, 2, 3, N | Andreas Ericsson
 
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo..."Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
 
Truemotion Adventures in Containerization
Truemotion Adventures in ContainerizationTruemotion Adventures in Containerization
Truemotion Adventures in Containerization
 

Plus de Zabbix

Plus de Zabbix (20)

Zabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with Zabbix
Zabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with ZabbixZabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with Zabbix
Zabbix Conference LatAm 2016 - Jessian Ferreira - Wireless with Zabbix
 
Zabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil Community
Zabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil CommunityZabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil Community
Zabbix Conference LatAm 2016 - Andre Deo - Zabbix Brazil Community
 
Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...
Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...Zabbix Conference LatAm 2016 - Jorge Pretel - Low Level Discovery for ODBC an...
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 - Andre Deo - SNMP and ZabbixZabbix Conference LatAm 2016 - Andre Deo - SNMP and Zabbix
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 - Rodrigo Mohr - Challenges on Large Env with Or...Zabbix Conference LatAm 2016 - Rodrigo Mohr - Challenges on Large Env with Or...
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 - Marcio Prop - Monitoring Complex Environments ...Zabbix Conference LatAm 2016 - Marcio Prop - Monitoring Complex Environments ...
Zabbix Conference LatAm 2016 - Marcio Prop - Monitoring Complex Environments ...
 
Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...
Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...
Zabbix Conference LatAm 2016 - Daniel Nasiloski - Extending Zabbix - Interact...
 
Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...
Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...
Zabbix Conference LatAm 2016 - Filipe Paternot - Zbx@Globo Automation+Integra...
 
Zabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMP
Zabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMPZabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMP
Zabbix Conference LatAm 2016 - Douglas Esteves - Zabbix at UNICAMP
 
Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016
Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016
Ryan Armstrong - Monitoring More Than 6000 Devices in Zabbix | ZabConf2016
 
Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016
Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016
Rafael Martinez Guerrero - Zabbix at the University of Oslo | ZabConf2016
 
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
 
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
Wolfgang Alper - Zabbix Meets OPS Control / Rundeck | ZabConf2016
 
Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016
Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016
Sumit Goel - Monitoring Cloud Applications Using Zabbix | ZabConf2016
 
Rihards Olups - Zabbix at Nokia - Case Study
Rihards Olups - Zabbix at Nokia - Case StudyRihards Olups - Zabbix at Nokia - Case Study
Rihards Olups - Zabbix at Nokia - Case Study
 
Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016
Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016
Raymond Kuiper - Zen and The Art of Zabbix Template Design | ZabConf2016
 
Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...
Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...
Dimitri Bellini and Pietro Antonacci - Manage Zabbix Proxies in Remote Networ...
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
 
Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016
Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016
Lukáš Malý - Log management ELISA controlled by Zabbix | ZabConf2016
 
Konstantin Yakovlev - Event Analysis Toolset | ZabConf2016
Konstantin Yakovlev - Event Analysis Toolset | ZabConf2016Konstantin Yakovlev - Event Analysis Toolset | ZabConf2016
Konstantin Yakovlev - Event Analysis Toolset | ZabConf2016
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 

Andrew Nelson - Zabbix and SNMP on Linux

  • 1. SNMP, for those times you can't install the Zabbix agent. Andrew Nelson Senior Linux Consultant Sep 10, 2015 Zabconf 2015, Riga, Latvia
  • 2. RED HAT | Andrew Nelson2/27 Overview ● Introduction ● What is SNMP ● Extending the Net-SNMP agent ● My first MIB ● A sub-agent for your MIB
  • 3. RED HAT | Andrew Nelson3/27 $ whoami ● Andrew Nelson ● anelson@redhat.com ● Senior Linux Consultant with Red Hat North America ● Active in the Zabbix community for approximately 10 years ● Known as “nelsonab” in forums and IRC ● Author of the Zabbix API Ruby library zbxapi
  • 5. RED HAT | Andrew Nelson5/27 Topics ● SNMP Overview ● OIDs ● Units ● Tables ● Using SNMP With Zabbix ● Extending SNMP
  • 6. RED HAT | Andrew Nelson6/27 What is SNMP ● Simple Network Monitoring Protocol ● Like all standards, it's not simple! ● Defined by numerous RFCs ● Uses a hierarchical data model ● Employs an Agent – Manager design ● Agents can be nested ● Is extensible
  • 7. RED HAT | Andrew Nelson7/27 What is SNMP ● SNMP uses OIDs to identify each item ● OIDs are numeric with text translations provided by MIB files.
  • 9. RED HAT | Andrew Nelson9/27 Zabbix And SNMP ● Available since version 1.1 ● One request per network connection before 2.2.3 ● Dynamic index lookups available since version 1.5 ● Item[“index”,”base item”,”row”] ● ifInOctets["index","ifDescr","GigabitEthernet0/1"]
  • 10. RED HAT | Andrew Nelson10/27 Zabbix and SNMP ● Configure a global macro for {$SNMP_COMMUNITY} then override locally for each host as needed. ● Templates make use of this macro ● Some parameters require some “massaging” before they are useful. ● Disk space is often in the form of N Allocation Units, not bytes. ● Calculated value: alocation_units[disk]*free_space[disk]
  • 11. RED HAT | Andrew Nelson11/27 Zabbix and SNMP ● Because calculated items are needed timelines may become very skewed. ● Free disk space is checked every 10 minutes ● Space calculation is performed every 10 minutes ● Graphed value could be time skwed by 20 minutes! ● Zabbix needs the ability for inbound value calculation. ● If only there were a scripting interface for this…..
  • 12. RED HAT | Andrew Nelson12/27 Zabbix and SNMP ● It is possible to derive percent utilization from accumulated time items. ● Set the item to Delta per second ● Convert the time scale to “centi-seconds” and store as a float with a unit of “%”. ● Resultant value will be an approximation of the percent utilization. ● However, it is skewed by the number of threads (CPU's) available to process the item being counted.
  • 13. RED HAT | Andrew Nelson13/27 Zabbix and SNMP
  • 14. RED HAT | Andrew Nelson14/27 Zabbix and SNMP
  • 15. RED HAT | Andrew Nelson15/27 Zabbix and SNMP ● When using SNMP for host discovery be careful when using SNMPv2-MIB::sysDescr.0 ● It will change with kernel updates ● Zabbix will then detect the updated machine as a new system ● Best to override this parameter in snmpd.conf, or perhaps use an extend script to return the dmi item uuid # dmidecode -s system-uuid 93737AE6-8A60-2B41-BEA4-B61C7ACD8063
  • 16. RED HAT | Andrew Nelson16/27 Zabbix and SNMP ● When using direct OID numbers be careful. ● OID number may remap over time, especially if the value in question is part of a table. ● OID table members are not guaranteed to have the same OID numbers across restarts of the SNMP agent (or host reboot) ● If MIB text is not translating correctly ensure the MIB file is in /usr/share/snmp/mibs (for RHEL systems). ● Ensure the OID in question translates correctly using snmptranslate.
  • 17. RED HAT | Andrew Nelson17/27 Zabbix and SNMP ● The snmp tools are your friends ● net-snmp-utils rpm on RHEL ● snmpwalk will allow you to peak at all of the items available. ● Adding the parameter -On is useful when MIB translations or namespaces are hampering things. ● snmptranslate can help ensure MIB files are loading correctly $ snmptranslate -IR myCustomOID Unknown object identifier: myCustomOID
  • 18. Going beyond the basic SNMP Agent
  • 19. RED HAT | Andrew Nelson19/27 Extending Net-SNMP ● Common mechanisms available ● Extend – Raw Shell Scripts ● Perl – Call perl scripts directly ● Pass – Start a subprocess to handle a given OID subtree ● PassPersist – Similar to pass but keep running ● AgentX – A form of sub-agent where a process listens for requests on a socket. ● Plus a few more not mentioned above
  • 20. RED HAT | Andrew Nelson20/27 Extending Net-SNMP ● A simple extend: (/usr/local/bin/check_proc.sh) #!/bin/sh PATTERN=$1 NUMPIDS=`pgrep $PATTERN | wc -l` echo "There are $NUMPIDS $PATTERN processes." echo "$NUMPIDS" exit $NUMPIDS ● The statement in the snmpd.conf file extend httpd_pids /bin/sh /usr/local/bin/check_proc.sh httpd
  • 21. RED HAT | Andrew Nelson21/27 Extending Net SNMP ● Snmpwalk of the extend script
  • 22. RED HAT | Andrew Nelson22/27 Extending Net SNMP ● Adding the item is as simple as adding an snmp item and assigning it to a key ● No need to worry about OID's changing
  • 23. RED HAT | Andrew Nelson23/27 ● Note when using the exit value from a script, it's maximum value is 256, any value over will roll over. ● Ex: An exit value of 5000 will result in an actual value of 136 5000-(256*19) = 136 ● Place the value in question on a separate line and use NET SNMP EXTEND MIB::nsExtendOutLine."ITEM".‑ ‑ ‑ n ● Where n is the line in question and ITEM is the extend item. Extending Net SNMP
  • 24. RED HAT | Andrew Nelson24/27 Extending Net SNMP ● Adding uuid information to snmp via extend extend host_uuid /usr/sbin/dmidecode -s system-uuid ● In discovery use the item: NET SNMP EXTEND MIB::nsExtendOutLine."host_uuid".1‑ ‑ ‑
  • 26. RED HAT | Andrew Nelson26/27 Conclusion
  • 27. RED HAT | Andrew Nelson27/27 Questions Fragen jautājumi 質問pytania vragen kysymykset питання вопросы spørgsmål domande preguntas otázky