SlideShare uma empresa Scribd logo
1 de 30
Developing Nagios XI
Components and Wizards
Jake Omann
Developer @ Nagios
jomann@nagios.com
2
Components & Wizards
A component can add functionality
Can access internal/external versions of API
A config wizard is supposed to make life easy
Many allow for auto-completion
Step-by-step process
3
Components & Wizards: Links to Docs
Component Development and API
http://assets.nagios.com/downloads/nagiosxi/docs/XI_Component_Development.pdf
Config Wizard Development
http://assets.nagios.com/downloads/nagiosxi/docs/Writing_Custom_Wizards_In_XI.pdf
Example Component & Wizard
There is an example component linked inside
each of the above pdf documents
4
Components
A basic component consists of optional parts
Config settings
Display page(s)
Callbacks
Some components only include a config section
Global Event Handlers
Allows user to set up events to be ran when an
action happens – there's no actual display page
except the config settings
A majority of components have a display page
that lets you interact with it
5
Components: Directory Structure
Component file system basics:
componentname/
componentname.inc.php
componentname.php
Images should be added into an images folder
in component directory
Included files, scripts, libraries should be added
into an include or lib folder inside your
component directory
Example: BirdsEye 3
6
Components: Init function
Must define an init function
Controls information about the component and
runs the component registration, sets up the
main component config function, and registers
callbacks
7
Components: Example Code - Initialization
8
Components: Config Settings
Creating a settings button next to the installed
component with config settings
COMPONENT_CONFIGFUNCTION defines
the config function to be used
Inside the function you've created for the
component is a switch with two cases:
COMPONENT_CONFIGMODE_GETSETTINGSHTML
COMPONENT_CONFIGMODE_SAVESETTINGS
9
Components: Register Callbacks
Inside the init function defined by you
register_callback(CALLBACK_NAME,
'compname_func_do_stuff');
The first variable, CALLBACK_NAME must be a
valid XI callback – some helpful ones are
shown later
The second variable is the name of the function
we want to run
function compname_func_do_stuff($cbtype,&$cbargs)
Can use grab_array_var – ex:
$service = grab_array_var($cbargs, 'service');
10
Components: Register Callbacks Example
Example of:
Menu item callback
Host/service action button
Host/service tab
11
Components: Add Quick Actions & Tabs
Quick action buttons
CALLBACK_HOST_DETAIL_ACTION_LINK
CALLBACK_SERVICE_DETAIL_ACTION_LINK
Tabs
CALLBACK_HOST_TABS_INIT
CALLBACK_SERVICE_TABS_INIT
12
Components: Creating a QA
Adding an item to the $cbargs['actions'] will
display that item in the QA section
This is an example of adding a popup window
13
Components: Creating a Tab
$content is a string of HTML
$newtab is an array of id, title, and content
which will be displayed on the page
Adding to $cbdata[“tabs”] creates a new tab
14
Components: Add a Display Page
Menu item
CALLBACK_MENUS_INITIALIZED
Adds a menu item that will take the user to the location we
want them to go, normally the non .inc.php file included
with the component
15
Config Wizards
Guidelines
Free from FATAL, SYNTAX, and NOTICE messages
Never run UPDATE or INSERT SQL query on nagios or
nagiosql databases
Avoid using $_POST, $_GET, $_GLOBALS since the
post variables are already located in $inargs
Use grab_array_var instead
$form_var = grab_array_var($inargs, $varname,
'default value')
Most newer wizards store data being passed between
steps inside session arrays instead of the old way of
passing using serialized arrays
16
Config Wizards: Directory Structure
Much larger structure than a basic component –
needs quite a few required files
Directory structure:
mongodb_server
logos/mongodb.png
plugins/check_mongodb.py
templates/mongodb_server.cfg
config.xml
install.sh (optional)
mongodb_server.inc.php
17
Config Wizards: Templates
Templates are required to add the command
the wizard will be using to Nagios
mongodb_server.cfg
18
Config Wizards: Config XML
config.xml has three nodes plugins, templates, logos
<plugins> - you have to add any plugins
<templates> - you need to add any commands here
<logos> (optional) - logo that is in your logos folder
19
Config Wizards: Example Code - Initialization
20
Config Wizards: Example Code – The Function
● This function was defined in the init function
● Everything from the switch statement up must be included
and edited for your config wizard
21
Config Wizards: Stages
Has a set of “steps” in Nagios XI and “stages”
in the code
Note: Config wizards start on step 2, step 2-4
are editable inside a config wizard's code
Steps are not Stages... step #n = stage #n-1
Inside the switch statement we have each step
of the config wizard
CONFIGWIZARD_MODE_GETSTAGE1HTML
(stage 1) in your config wizard code is actually
step 2 when using a config wizard
22
Config Wizards: Stage 1
Each stage has 2 sections, html and validate
CONFIGWIZARD_MODE_GETSTAGE1HTML
CONFIGWIZARD_MODE_VALIDATESTAGE1DATA
To return to a stage during validation:
$result is the return 0 = ok, 1 = error
This stage is for gathering information about the
host/service you want to configure
23
Config Wizards: Stage 1
Stage 1 running in Nagios XI
24
Config Wizards: Stage 2
CONFIGWIZARD_MODE_GETSTAGE2HTML
CONFIGWIZARD_MODE_VALIDATESTAGE2DATA
Stage 2 allows you to select what you want to
monitor and how you want to monitor it
Some wizards will auto-populate the
information in stage 2 by contacting the host
Note: Clicking forward OR back should save
data from this stage and all others – be sure to
pass data along data using a session
25
Config Wizards: Stage 2
26
Config Wizards: Stage 3 and Final
CONFIGWIZARD_MODE_GETSTAGE2HTML
CONFIGWIZARD_MODE_VALIDATESTAGE2DATA
Stage 3 is already populated with monitoring settings
you cannot change in the wizard
Stage 3 is mostly used for saving data and passing it
on to be used
CONFIGWIZARD_MODE_GETFINALSTAGEHTML
The Final stage is the same – you will have to
continue passing the data if required (not using
session method of passing data)
Example: MySQL Server Wizard
27
Config Wizards: Get Objects
The final case in the config wizard switch
statement that will be ran
CONFIGWIZARD_MODE_GETOBJECTS
28
Config Wizards: Get Objects
"check_command" =>
"check_mongodb_server!connect!$port!$warning!$critical!$username!$password”
29
Config Wizards: Get Objects
Before breaking out of this section, add the
objects to the outargs
Will set up your commands in the Nagios config
for you after this stage
30
Examples & Tips
Example/base wizards and components can be
downloaded via links in the corresponding
developer help docs
Tip: Check out the source of some of the
wizards and components that you use (except
the protected Nagios XI ones) to get more of a
feel for how they work

Mais conteúdo relacionado

Semelhante a Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wizards

Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento Ravi Mehrotra
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin GeneratorJohn Cleveley
 
Parallelminds.web partdemo
Parallelminds.web partdemoParallelminds.web partdemo
Parallelminds.web partdemoManishaChothe
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slidesDavid Barreto
 
Customizing oro crm webinar
Customizing oro crm webinarCustomizing oro crm webinar
Customizing oro crm webinarOro Inc.
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoIRJET Journal
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development Mage Guru
 
Aggregate persistence wizard
Aggregate persistence wizardAggregate persistence wizard
Aggregate persistence wizardreturnasap
 
05 b 01workflowcustomizing
05 b 01workflowcustomizing05 b 01workflowcustomizing
05 b 01workflowcustomizingtflung
 
Introduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceIntroduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceBartosz Górski
 
Introduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceIntroduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceBartosz Górski
 
Empowering users: modifying the admin experience
Empowering users: modifying the admin experienceEmpowering users: modifying the admin experience
Empowering users: modifying the admin experienceBeth Soderberg
 
Sap solution manager change request management
Sap solution manager change request managementSap solution manager change request management
Sap solution manager change request managementdryday sunny
 

Semelhante a Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wizards (20)

Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Mangento
MangentoMangento
Mangento
 
Hats tutorial custom widget
Hats tutorial   custom widgetHats tutorial   custom widget
Hats tutorial custom widget
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
 
Parallelminds.web partdemo
Parallelminds.web partdemoParallelminds.web partdemo
Parallelminds.web partdemo
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slides
 
Customizing oro crm webinar
Customizing oro crm webinarCustomizing oro crm webinar
Customizing oro crm webinar
 
Magento++
Magento++Magento++
Magento++
 
Architecture and Analytical Study of Magento
Architecture and Analytical Study of MagentoArchitecture and Analytical Study of Magento
Architecture and Analytical Study of Magento
 
Mageguru - magento custom module development
Mageguru -  magento custom module development Mageguru -  magento custom module development
Mageguru - magento custom module development
 
Readme
ReadmeReadme
Readme
 
Aggregate persistence wizard
Aggregate persistence wizardAggregate persistence wizard
Aggregate persistence wizard
 
Test
TestTest
Test
 
05 b 01workflowcustomizing
05 b 01workflowcustomizing05 b 01workflowcustomizing
05 b 01workflowcustomizing
 
Introduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceIntroduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe Commerce
 
Introduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceIntroduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe Commerce
 
Empowering users: modifying the admin experience
Empowering users: modifying the admin experienceEmpowering users: modifying the admin experience
Empowering users: modifying the admin experience
 
Sap solution manager change request management
Sap solution manager change request managementSap solution manager change request management
Sap solution manager change request management
 
12 Amazing Features of Magento 2
12 Amazing Features of Magento 212 Amazing Features of Magento 2
12 Amazing Features of Magento 2
 

Mais de Nagios

Nagios XI Best Practices
Nagios XI Best PracticesNagios XI Best Practices
Nagios XI Best PracticesNagios
 
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 OverviewNagios
 
Trevor McDonald - Nagios XI Under The Hood
Trevor McDonald  - Nagios XI Under The HoodTrevor McDonald  - Nagios XI Under The Hood
Trevor McDonald - Nagios XI Under The HoodNagios
 
Sean Falzon - Nagios - Resilient Notifications
Sean Falzon - Nagios - Resilient NotificationsSean Falzon - Nagios - Resilient Notifications
Sean Falzon - Nagios - Resilient NotificationsNagios
 
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise EditionMarcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise EditionNagios
 
Janice Singh - Writing Custom Nagios Plugins
Janice Singh - Writing Custom Nagios PluginsJanice Singh - Writing Custom Nagios Plugins
Janice Singh - Writing Custom Nagios PluginsNagios
 
Dave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceDave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceNagios
 
Mike Weber - Nagios and Group Deployment of Service Checks
Mike Weber - Nagios and Group Deployment of Service ChecksMike Weber - Nagios and Group Deployment of Service Checks
Mike Weber - Nagios and Group Deployment of Service ChecksNagios
 
Mike Guthrie - Revamping Your 10 Year Old Nagios Installation
Mike Guthrie - Revamping Your 10 Year Old Nagios InstallationMike Guthrie - Revamping Your 10 Year Old Nagios Installation
Mike Guthrie - Revamping Your 10 Year Old Nagios InstallationNagios
 
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...Nagios
 
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 NagiosNagios
 
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.Nagios
 
Eric Loyd - Fractal Nagios
Eric Loyd - Fractal NagiosEric Loyd - Fractal Nagios
Eric Loyd - Fractal NagiosNagios
 
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...Nagios
 
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...Nagios
 
Nagios World Conference 2015 - Scott Wilkerson Opening
Nagios World Conference 2015 - Scott Wilkerson OpeningNagios World Conference 2015 - Scott Wilkerson Opening
Nagios World Conference 2015 - Scott Wilkerson OpeningNagios
 
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios CoreNrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios CoreNagios
 
Nagios Log Server - Features
Nagios Log Server - FeaturesNagios Log Server - Features
Nagios Log Server - FeaturesNagios
 
Nagios Network Analyzer - Features
Nagios Network Analyzer - FeaturesNagios Network Analyzer - Features
Nagios Network Analyzer - FeaturesNagios
 
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing NagiosNagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing NagiosNagios
 

Mais de Nagios (20)

Nagios XI Best Practices
Nagios XI Best PracticesNagios XI Best Practices
Nagios XI Best Practices
 
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
 
Trevor McDonald - Nagios XI Under The Hood
Trevor McDonald  - Nagios XI Under The HoodTrevor McDonald  - Nagios XI Under The Hood
Trevor McDonald - Nagios XI Under The Hood
 
Sean Falzon - Nagios - Resilient Notifications
Sean Falzon - Nagios - Resilient NotificationsSean Falzon - Nagios - Resilient Notifications
Sean Falzon - Nagios - Resilient Notifications
 
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise EditionMarcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
 
Janice Singh - Writing Custom Nagios Plugins
Janice Singh - Writing Custom Nagios PluginsJanice Singh - Writing Custom Nagios Plugins
Janice Singh - Writing Custom Nagios Plugins
 
Dave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceDave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical Experience
 
Mike Weber - Nagios and Group Deployment of Service Checks
Mike Weber - Nagios and Group Deployment of Service ChecksMike Weber - Nagios and Group Deployment of Service Checks
Mike Weber - Nagios and Group Deployment of Service Checks
 
Mike Guthrie - Revamping Your 10 Year Old Nagios Installation
Mike Guthrie - Revamping Your 10 Year Old Nagios InstallationMike Guthrie - Revamping Your 10 Year Old Nagios Installation
Mike Guthrie - Revamping Your 10 Year Old Nagios Installation
 
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
 
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
 
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
 
Eric Loyd - Fractal Nagios
Eric Loyd - Fractal NagiosEric Loyd - Fractal Nagios
Eric Loyd - Fractal Nagios
 
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
 
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
 
Nagios World Conference 2015 - Scott Wilkerson Opening
Nagios World Conference 2015 - Scott Wilkerson OpeningNagios World Conference 2015 - Scott Wilkerson Opening
Nagios World Conference 2015 - Scott Wilkerson Opening
 
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios CoreNrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
 
Nagios Log Server - Features
Nagios Log Server - FeaturesNagios Log Server - Features
Nagios Log Server - Features
 
Nagios Network Analyzer - Features
Nagios Network Analyzer - FeaturesNagios Network Analyzer - Features
Nagios Network Analyzer - Features
 
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing NagiosNagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
 

Último

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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 WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 

Último (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 

Nagios Conference 2013 - Jake Omann - Developing Nagios XI Components and Wizards

  • 1. Developing Nagios XI Components and Wizards Jake Omann Developer @ Nagios jomann@nagios.com
  • 2. 2 Components & Wizards A component can add functionality Can access internal/external versions of API A config wizard is supposed to make life easy Many allow for auto-completion Step-by-step process
  • 3. 3 Components & Wizards: Links to Docs Component Development and API http://assets.nagios.com/downloads/nagiosxi/docs/XI_Component_Development.pdf Config Wizard Development http://assets.nagios.com/downloads/nagiosxi/docs/Writing_Custom_Wizards_In_XI.pdf Example Component & Wizard There is an example component linked inside each of the above pdf documents
  • 4. 4 Components A basic component consists of optional parts Config settings Display page(s) Callbacks Some components only include a config section Global Event Handlers Allows user to set up events to be ran when an action happens – there's no actual display page except the config settings A majority of components have a display page that lets you interact with it
  • 5. 5 Components: Directory Structure Component file system basics: componentname/ componentname.inc.php componentname.php Images should be added into an images folder in component directory Included files, scripts, libraries should be added into an include or lib folder inside your component directory Example: BirdsEye 3
  • 6. 6 Components: Init function Must define an init function Controls information about the component and runs the component registration, sets up the main component config function, and registers callbacks
  • 7. 7 Components: Example Code - Initialization
  • 8. 8 Components: Config Settings Creating a settings button next to the installed component with config settings COMPONENT_CONFIGFUNCTION defines the config function to be used Inside the function you've created for the component is a switch with two cases: COMPONENT_CONFIGMODE_GETSETTINGSHTML COMPONENT_CONFIGMODE_SAVESETTINGS
  • 9. 9 Components: Register Callbacks Inside the init function defined by you register_callback(CALLBACK_NAME, 'compname_func_do_stuff'); The first variable, CALLBACK_NAME must be a valid XI callback – some helpful ones are shown later The second variable is the name of the function we want to run function compname_func_do_stuff($cbtype,&$cbargs) Can use grab_array_var – ex: $service = grab_array_var($cbargs, 'service');
  • 10. 10 Components: Register Callbacks Example Example of: Menu item callback Host/service action button Host/service tab
  • 11. 11 Components: Add Quick Actions & Tabs Quick action buttons CALLBACK_HOST_DETAIL_ACTION_LINK CALLBACK_SERVICE_DETAIL_ACTION_LINK Tabs CALLBACK_HOST_TABS_INIT CALLBACK_SERVICE_TABS_INIT
  • 12. 12 Components: Creating a QA Adding an item to the $cbargs['actions'] will display that item in the QA section This is an example of adding a popup window
  • 13. 13 Components: Creating a Tab $content is a string of HTML $newtab is an array of id, title, and content which will be displayed on the page Adding to $cbdata[“tabs”] creates a new tab
  • 14. 14 Components: Add a Display Page Menu item CALLBACK_MENUS_INITIALIZED Adds a menu item that will take the user to the location we want them to go, normally the non .inc.php file included with the component
  • 15. 15 Config Wizards Guidelines Free from FATAL, SYNTAX, and NOTICE messages Never run UPDATE or INSERT SQL query on nagios or nagiosql databases Avoid using $_POST, $_GET, $_GLOBALS since the post variables are already located in $inargs Use grab_array_var instead $form_var = grab_array_var($inargs, $varname, 'default value') Most newer wizards store data being passed between steps inside session arrays instead of the old way of passing using serialized arrays
  • 16. 16 Config Wizards: Directory Structure Much larger structure than a basic component – needs quite a few required files Directory structure: mongodb_server logos/mongodb.png plugins/check_mongodb.py templates/mongodb_server.cfg config.xml install.sh (optional) mongodb_server.inc.php
  • 17. 17 Config Wizards: Templates Templates are required to add the command the wizard will be using to Nagios mongodb_server.cfg
  • 18. 18 Config Wizards: Config XML config.xml has three nodes plugins, templates, logos <plugins> - you have to add any plugins <templates> - you need to add any commands here <logos> (optional) - logo that is in your logos folder
  • 19. 19 Config Wizards: Example Code - Initialization
  • 20. 20 Config Wizards: Example Code – The Function ● This function was defined in the init function ● Everything from the switch statement up must be included and edited for your config wizard
  • 21. 21 Config Wizards: Stages Has a set of “steps” in Nagios XI and “stages” in the code Note: Config wizards start on step 2, step 2-4 are editable inside a config wizard's code Steps are not Stages... step #n = stage #n-1 Inside the switch statement we have each step of the config wizard CONFIGWIZARD_MODE_GETSTAGE1HTML (stage 1) in your config wizard code is actually step 2 when using a config wizard
  • 22. 22 Config Wizards: Stage 1 Each stage has 2 sections, html and validate CONFIGWIZARD_MODE_GETSTAGE1HTML CONFIGWIZARD_MODE_VALIDATESTAGE1DATA To return to a stage during validation: $result is the return 0 = ok, 1 = error This stage is for gathering information about the host/service you want to configure
  • 23. 23 Config Wizards: Stage 1 Stage 1 running in Nagios XI
  • 24. 24 Config Wizards: Stage 2 CONFIGWIZARD_MODE_GETSTAGE2HTML CONFIGWIZARD_MODE_VALIDATESTAGE2DATA Stage 2 allows you to select what you want to monitor and how you want to monitor it Some wizards will auto-populate the information in stage 2 by contacting the host Note: Clicking forward OR back should save data from this stage and all others – be sure to pass data along data using a session
  • 26. 26 Config Wizards: Stage 3 and Final CONFIGWIZARD_MODE_GETSTAGE2HTML CONFIGWIZARD_MODE_VALIDATESTAGE2DATA Stage 3 is already populated with monitoring settings you cannot change in the wizard Stage 3 is mostly used for saving data and passing it on to be used CONFIGWIZARD_MODE_GETFINALSTAGEHTML The Final stage is the same – you will have to continue passing the data if required (not using session method of passing data) Example: MySQL Server Wizard
  • 27. 27 Config Wizards: Get Objects The final case in the config wizard switch statement that will be ran CONFIGWIZARD_MODE_GETOBJECTS
  • 28. 28 Config Wizards: Get Objects "check_command" => "check_mongodb_server!connect!$port!$warning!$critical!$username!$password”
  • 29. 29 Config Wizards: Get Objects Before breaking out of this section, add the objects to the outargs Will set up your commands in the Nagios config for you after this stage
  • 30. 30 Examples & Tips Example/base wizards and components can be downloaded via links in the corresponding developer help docs Tip: Check out the source of some of the wizards and components that you use (except the protected Nagios XI ones) to get more of a feel for how they work