More Related Content Similar to OSMC 2023 | Extending Icinga Web with Modules: powerful, smart and easily created by Nicolas Schneider (20) OSMC 2023 | Extending Icinga Web with Modules: powerful, smart and easily created by Nicolas Schneider2. 2
Agenda
1 About me
2 About Rise
3 How?
4 Checkreports
5 Impersonate
6 Teamdashboard
7 Customdashboard
8 Monitoringbackports
9 PluginDocBuilder
10 Scaffoldbuilder
11 Enhancement of Map
12 Demo
13 Links
© RISE
3. 3
▪ Nicolas Schneider aka moreamazingnick
▪ Work in monitoring since 2021
▪ Studied Medical Computer Science (B.Sc.)
▪ AmazingNick was already in use on GitHub
About me
© RISE
4. 4
Research Industrial Systems Engineering (RISE)
at a quick glance
Key figures
• Created as a spin-off of the TU Vienna in 1988
• Active in architecture, safety engineering &
software development
• Developed services needs to be monitored
Locations
• Company headquarter in Austria (Vienna & Schwechat)
• Offices in several countries
RISE Konnektor
© RISE
www.rise-world.com
6. 6
▪ Modules with own functionality
▪ Inherit from existing classes or “reuse” the code
▪ Change behavior
▪ IcingaWeb2 provides Hook
▪ HostActionsHook
▪ Modules can provide Hooks too
▪ DataTypeHook (Icinga Director)
▪ ReportHook (Reporting)
▪ CLI actions
▪ Themes
How is IcingaWeb2 extensible?
© RISE
8. 8
▪ CheckResult
▪ Update-Report
▪ Regularly
▪ Scheduler
▪ Portable format
▪ Pdf
▪ These are already features of the
reporting module
▪ Using ReportHook
Checkreports
© RISE
9. 9
▪ Why can’t I use a Notification plugin
▪ Triggered by state change
▪ Or external scheduling needed
▪ No pdf
Checkreports
© RISE
10. 10
▪ Path
▪ Smooth as it is based on idoreports
▪ IDO implementation first
▪ Access the check result instead of the SLA
▪ Challenges
▪ IcingaDB
▪ Plugin Output was sometimes not the same?
▪ Added the last Execution Time
▪ Plugin Output was outdated
▪ $query->
▪ setResultSetClass(VolatileStateResults::class);
Checkreports
© RISE
12. 12
▪ Other Applications have that too
▪ Debugging
▪ Disabled Dashboards
▪ Restrictions
▪ Icinga Community Call
Impersonate
© RISE
13. 13
▪ Path
▪ Copy LoginController
▪ Copy LoginForm
▪ Copy views
▪ Remove password field
▪ Remove some styles
▪ Remove every check ☺
▪ Open Questions
▪ Domain awareness
▪ Open a ticket if it doesn’t work
Impersonate
© RISE
15. 15
▪ Icinga is working on something
▪ Enhanced Dashboards #3809
▪ You can use this till it’s ready
▪ It shows how extensible IcingaWeb2 is
Dashboards
© RISE
17. 17
▪ Inspired by enforceddashboards
▪ by Thomas Gelf
▪ Community issue
▪ Sharing Dashboards create an overflow
▪ Global Dashboards using configuration.php causes overflow too
▪ Having a “virtual” or real user
▪ Map Dashboard to other users
▪ Keep your own Dashboards
▪ Manage via Roles
▪ Rename “users” in the menu
▪ Pro Tipp
▪ Use Impersonate module to change the
other Dashboard
Teamdashboards
© RISE
18. 18
▪ Path
▪ Using Scaffoldbuilder (Ini-Repository)
▪ Copy Dashboard.php
▪ Copy DashboardController.php
▪ Copy views
▪ Allow to set a user
▪ Adapt some urls
▪ Remove unused code
▪ Using Roles / Permissions
▪ Open Questions
▪ Do you need Current Incidents too?
▪ Current Incidents
▪ Muted
▪ Overdue
Teamdashboards
© RISE
20. 20
▪ Inspired by teamdashboards
▪ It’s a community issue, post in the forum
▪ Community issue
▪ Sharing Dashboards create an overflow
▪ Global Dashboards using configuration.php causes overflow too
▪ Create Dashboards manually
▪ Pane name
▪ URL
▪ Map it to other users
▪ Keep your own Dashboards
▪ Manage via Roles
▪ Change the name in the menu
▪ Change the icon
▪ Change the position
▪ Add entries via CLI
Customdashboards
© RISE
22. 22
▪ I will show you who to change behavior of other modules
▪ Without actually changing their code
▪ Changing behavior this way make it difficult for the original authors to debug
problems.
▪ Be careful what you create this way…
DISCLAIMER
© RISE
23. 23
▪ Inspired by a post in the Icinga Community Forum
▪ I did not remember that this was there in icingaweb2 2.9
▪ First idea: backport this back into the monitoring module
▪ Some queries where removed
▪ Not a big problem
▪ Why did Icinga remove it?
▪ Implement this a module
▪ “Hook” into the monitoring module
▪ It’s not “Monkey patching”
▪ Super close to it..
Monitoringbackports
© RISE
24. 24
▪ MVC-Pattern
▪ URL => /list/hosts
▪ Inherit from ListController
▪ Overwrite the hostsAction()
▪ Get the missing data
▪ Some magic
▪ addHelpersPath()
▪ addScriptsPath()
▪ Not now
▪ We need to use our view
Monitoringbackports – Inheritance
© RISE
25. 25
▪ ListController
▪ Different module name (monitoringbackports)
▪ Problem with the monitoring css
▪ Solved with this:
Monitoringbackports – Inheritance
© RISE
26. 26
▪ View script
▪ views/scripts/list/hosts.phtml
▪ Copy from the monitoring
module
▪ Backport this from 2.9
▪ Problem with the other views
▪ hostsummary.phtml
▪ sectioninfo.phtml
▪ Copy them too?
Monitoringbackports – view
© RISE
27. 27
▪ View script
▪ At the end it wants to load something from the monitoring module
▪ We don’t want to duplicate that
▪ addScriptPath()
Monitoringbackports – how?
© RISE
28. 28
▪ A module named monitoringbackports
▪ It provides a host list
▪ With our minimal changes
▪ Not integrated into icingaweb2-module-monitoring
▪ But reachable via /icingaweb2/monitoringbackports/list/hosts
▪ We need more magic…
Monitoringbackports – What do we have till now?
© RISE
29. 29
▪ run.php
▪ Rewrite the route
▪ idea from the cube module
Monitoringbackports – replace the Controller
© RISE
31. 31
▪ Build a documentation module based on your check plugins
▪ Use a Template
▪ Use Icinga Director information
▪ Include good Documentation like
▪ icinga-powershell-plugins
▪ icinga-powershell-mssql
▪ icinga-itl
▪ Combine everything
PluginDocBuilder
© RISE
32. 32
▪ Path
▪ Using Scaffoldbuilder (Ini-Repository)
▪ Download releases from GitHub
▪ Extract & combine
▪ Already amazing
▪ Access Icinga Director Command Fields
▪ Extract information
▪ Fill out my documentation template
▪ Key Questions
▪ Is it ready yet?
▪ No
▪ Is it on GitHub yet?
▪ No
▪ Can you show it to us?
▪ YES
PluginDocBuilder
© RISE
34. 34
▪ Create module based on almost any name
▪ Get all directories ready
▪ Having a basic IndexController
▪ Blank Page Syndrome
▪ Having a first menu item
▪ Get the Namespaces right for reference implementation
▪ Get all the important config files
▪ Get multiple IniRepositories
▪ Get a ModuleConfig (ini file)
▪ Get a generic documentation
▪ Fill it out
▪ Don’t start from scratch
Scaffoldbuilder
© RISE
36. 36
▪ By Nicolai Buchwitz
▪ Based on latest master
▪ So there is a IcingaDb integration
▪ Adapted search
▪ Updated mapDatatype
▪ Add the Ini-Repository for other
“default maps”
▪ Provide permissions for these maps
icingaweb2-module-map
Confidential © RISE
38. 38
Where to get it? => GitHub
▪ RISE-GMBH
▪ Everything else
© RISE
▪ Moreamazingnick
▪ Scaffoldbuilder
▪ monitoringbackports