Troy_Lea_NWC-2012 Custom Wizards, Components and

advertisement
Custom Wizards,
Components and Dashlets
in Nagios XI
Troy Lea
troy@box293.com
Twitter: @Box293
http://exchange.nagios.org/directory/Owner/Box293/1
About Me
IT Consultant
Strategic Group
http://www.strategicgroup.net.au/
Cloud Computing Specialist
VAULT
http://www.my-vault.com.au/
One of Australia's most mature
cloud computing solutions
2012
2
Why
Why Nagios XI?
It’s a virtual appliance - ready to go
Why customize?
Improve functionality
To help others / share the knowledge
2012
3
Configuration Wizards - Current Portfolio
Wizard
Downloads
Box293 Demonstration Wizard
2,300+
Dell OpenManage
46,000+
Dell UPS Monitoring Wizard
42,000+
EMC CLARiiON Monitoring Wizard
Available for adoption
78,000+
Group Creation Tool
42,000+
Host Creation Tool
115,000+
Plugin Tool
40,000+
VMware ESX / vSphere / vCenter Monitoring Wizard
70,000+
2012
4
Configuration Wizards - My Documentation
Existing Documentation Created By Me
Tips For Customising Configuration Wizards
http://exchange.nagios.org/directory/Documentation/Nagios-XIDocumentation/Tips-For-Customising-Configuration-Wizards/details
NOTE: Outdated
Nagios XI Service Relationship Map
http://exchange.nagios.org/directory/Documentation/Nagios-XIDocumentation/Nagios-XI-Service-Relationship-Map/details
Box293 Demonstration Wizard
http://exchange.nagios.org/directory/Addons/Configuration/ConfigurationWizards/Box293-Demonstration-Wizard/details
This is the wizard I will focus on in this presentation
2012
5
Nagios XI Service Relationship Map
2012
6
Configuration Wizards - Official Documentation
Official Documentation
Writing Custom Wizards For Nagios XI
http://library.nagios.com/library/products/nagiosxi/documentation/480-writingcustom-wizards-for-nagios-xi
Box293 Demonstration Wizard was derived from this documentation
Nagios XI Component Development
http://library.nagios.com/library/products/nagiosxi/documentation/551nagios-xi-component-development
2012
7
Configuration Wizards - Customizing
Key Concepts
Provide help / documentation at the start
This can be in collapsible / expandable DIVs
The more help you provide, the less road blocks there are
Preserve existing data user has entered
No-one likes re-populating multiple fields
Automate the data collection process
Where possible
Good Example: Network Switch / Router wizard
Bad Example: VMware ESX / vSphere / vCenter Monitoring
Wizard (revamp planned)
2012
8
Configuration Wizards - Stages
Step 1
This is the list of all the available wizards
2012
9
Configuration Wizards - Stages
Step 1
The information that is presented here is taken from the $args
array defined at the beginning of the configuration wizard
Information also used on the Manage Config Wizards page
$args=array(
CONFIGWIZARD_NAME => $name,
CONFIGWIZARD_TYPE => CONFIGWIZARD_TYPE_MONITORING,
CONFIGWIZARD_DESCRIPTION => 'This wizard is an example of how to code ...',
CONFIGWIZARD_DISPLAYTITLE => 'Box293 Demonstration Wizard',
CONFIGWIZARD_FUNCTION => 'box293demo_configwizard_func',
CONFIGWIZARD_PREVIEWIMAGE => 'screen2.png',
CONFIGWIZARD_VERSION => '2012-08-05',
CONFIGWIZARD_DATE => '2012-08-05',
CONFIGWIZARD_AUTHOR => 'Troy Lea aka Box293',
);
2012
10
Configuration Wizards - Stages
Before Step 2
Fresh Wizard Run?
Define variables
User is returning from Step 3?
Check for existing Step 2 data and re-populate
Step 2 ← Step 3
User provided data on Step 2 failed error checking?
Check for Step 2 data and re-populate
Step 2 ← Step 2 Validation
2012
11
Configuration Wizards - Stages
2012
12
Configuration Wizards - Stages
Step 2
CONFIGWIZARD_MODE_GETSTAGE1HTML
This is the first step you can customise
Completely customisable except for the Back and Next
buttons
Put all of your overview, help and configuration steps here
This will educate the end user about how the wizard works
and also informs them of the requirements / pre-requisites
You'll need to get the IP Address or FQDN of the host you
want to monitor along with anything else you require
2012
13
Configuration Wizards - Stages
Between Step 2 and Step 3
CONFIGWIZARD_MODE_VALIDATESTAGE1DATA
Is the user returning from Step 3?
If so, no data validation required on Step 2 data
Reality checks on Step 2 data
If supplied data is not correct the wizard will go back to Step 2
Refer to the code in the Box293 Demonstration Wizard to see how
the error checking is performed
2012
14
Configuration Wizards - Stages
2012
15
Configuration Wizards - Stages
2012
16
Configuration Wizards - Stages
Step 3
CONFIGWIZARD_MODE_GETSTAGE2HTML
Completely customisable except for the Back and Next
buttons
You can use data gathered in Step 2 to query the device,
manipulate the results and present them to the user
Example: Network Switch/Router wizard
Alternatively you may have pre-defined options
Example: Dell OpenManage Wizard
2012
17
Configuration Wizards - Stages
User coming from Step 2?
Check for Step 2 data and populate/manipulate
Step 2 → Step 3
User is returning from Step 4?
Check for existing Step 3 data and re-populate
Step 3 ← Step 4
User provided data on Step 3 failed error checking?
Check for Step 3 user data and re-populate
Step 3 ← Step 3 Validation
2012
18
Configuration Wizards - Stages
Between Step 3 and Step 4
CONFIGWIZARD_MODE_VALIDATESTAGE2DATA
Is the user returning from Step 4?
If so, no data validation required on Step 3 data
Reality checks on Step 3 data
If supplied data is not correct the wizard will go back to Step 3
Things like:
Allowed characters
Specific options selected but their sub-options are not defined
Empty fields
Refer to the code in the Box293 Demonstration Wizard to see how
the error checking is performed
2012
19
Configuration Wizards - Stages
2012
20
Configuration Wizards - Stages
Between Step 3 and Step 4
CONFIGWIZARD_MODE_GETSTAGE3OPTS
Optional, does not need to exist
Allows you to hide the Monitoring Settings in Step 4
This was ideal for the Plugin Tool
2012
21
Configuration Wizards - Stages
Step 4
CONFIGWIZARD_MODE_GETSTAGE3HTML
Any additional html here will appear on the "Monitoring Settings"
step, "Notification Settings" step, "Host Groups/Service
Groups/Parent Host" step and the "Final" step
Options for how often you want to monitor the device
As per the previous slide these can be hidden
This step will always be titled "Monitoring Settings"
2012
22
Configuration Wizards - Stages
Between Step 4 and Step 5
CONFIGWIZARD_MODE_VALIDATESTAGE3DATA
Nothing you really need to put here unless you
gathered more data in Step 4
If so don't forget to do reality checks on Step 4
data
2012
23
Configuration Wizards - Stages
2012
24
Configuration Wizards - Stages
Between Step 4 and Step 5
CONFIGWIZARD_MODE_GETSTAGE4OPTS
Optional, does not need to exist
Allows you to hide the Notification Settings in Step 5
This was ideal for the Plugin Tool
2012
25
Configuration Wizards - Stages
Step 5
Options for Notification Settings
As per the previous slide these can be hidden
You CANNOT add additional code to this screen
It will always be titled "Notification Settings"
2012
26
Configuration Wizards - Stages
Step 6
Options for Groups
and Parents
This Step CANNOT
be modified
This Step CANNOT
be hidden
2012
27
Configuration Wizards - Stages
Final Step
CONFIGWIZARD_MODE_GETFINALSTAGEHTML
You can add additional code to this screen however it will
always be titled "Final Settings"
2012
28
Configuration Wizards - Stages
Creating the Host and Service Objects
CONFIGWIZARD_MODE_GETOBJECTS
Using all the data you have gathered you "create" all the
host and service objects and add them to an $objs array
If you didn't do reality checks on the data then it's possible
that an invalid configuration will be applied and fail
2012
29
Configuration Wizards - Templates
Adding a Command Definition
You've supplied a plugin with your wizard
Defining the command is done in a .cfg file referenced in
the config.xml
Other objects like Groups can also be defined
Refer to official documentation about the config.xml file
# 'check_dell_ups' command definition
define command{
command_name check_dell_ups
command_line $USER1$/check_dell_ups.pl -H $HOSTADDRESS$ -C $ARG1$ -T $ARG2$
$ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$
}
2012
30
Components - Current Portfolio
Component
Downloads
History Tab
37,000+
2012
31
Components
Official Documentation
Nagios XI Component Development
http://library.nagios.com/library/products/nagiosxi/documentation/551-nagios-xicomponent-development
2012
32
Dashlets and Dashboards - Overview
Extract from the user guide:
Dashboards are designed to provide individual users
with customized information they find useful
Dashboards are often used to display important,
relevant information where it is needed most
Dashboards are specific to individual Nagios XI
users. Each user can create their own unique set of
dashboards to customize Nagios XI to fit their needs
Dashboards can be deployed to multiple users and
can be kept synced with the original
Dashlets are added to Dashboards
2012
33
Dashboards Tab
2012
34
Dashlets - Current Portfolio
Dashlet
Downloads
Text Dashlet
24,000+
Status Info Dashlet
4,000+
2012
35
Dashlets - Modes
There are four parts to creating a Dashlet
DASHLET_MODE_PREVIEW
DASHLET_MODE_GETCONFIGHTML
DASHLET_MODE_INBOARD
DASHLET_MODE_OUTBOARD
2012
36
Dashlets - Modes
DASHLET_MODE_PREVIEW
This is for when you click the Available Dashlets link
2012
37
Dashlets - Modes
DASHLET_MODE_GETCONFIGHTML
When you click on the "Add This To A Dashboard"
icon, DASHLET_MODE_GETCONFIGHTML is used
2012
38
Dashlets - Modes
DASHLET_MODE_GETCONFIGHTML
Here you can specify the options you
require for your dashlet
There is no error checking when you click
the Add It button
2012
39
Dashlets - Modes
DASHLET_MODE_GETCONFIGHTML
In the Status Info Dashlet I
implement my own error
checking by providing a
preview function
Play around with the Status
Info Dashlet to see how this
can be achieved
2012
40
Dashlets - Modes
DASHLET_MODE_INBOARD
This is the section that makes the dashlet appear on any
dashboard you add it to
2012
41
Dashlets - Modes
DASHLET_MODE_OUTBOARD
This is for some dashlets that are built into the pages of Nagios XI
2012
42
Discount Offer
But wait, there's more ...
Get a 10% discount on your Nagios XI Unlimited
Nodes license when purchased through this link:
http://www.nagios.com/nagiosxi10?ref=box293
Don't miss out as stocks are limited*
*Stocks are not limited
2012
43
Questions
Questions ?
2012
44
Download