Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Monitoring
netbox-icinga-config-generator
Commits
a7f8c252
Verified
Commit
a7f8c252
authored
Mar 14, 2022
by
Adrian Schollmeyer
Browse files
generator/hosts: Add support for generic remote and partition checks
parent
5f6efd8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
generate-icinga-generic-host.py
View file @
a7f8c252
...
...
@@ -61,11 +61,13 @@ class Icinga2Host:
self
.
ip6s
=
[]
self
.
additional_ssh_ports
=
[]
self
.
remote_checks
=
[]
self
.
nrpe_checks
=
[]
self
.
nrpe_disks
=
[]
self
.
procs
=
[]
self
.
local_checks
=
[]
self
.
network_checks
=
[]
self
.
partitions
=
[]
self
.
smart
=
[]
self
.
smart_sectors
=
[]
self
.
disk_io
=
[]
...
...
@@ -104,6 +106,10 @@ class Icinga2Host:
self
.
apt
=
"passive"
def
add_partition
(
self
,
partition
):
self
.
partitions
.
append
(
partition
)
def
add_smart
(
self
,
disk
):
self
.
smart
.
append
(
disk
)
...
...
@@ -128,6 +134,10 @@ class Icinga2Host:
self
.
nrpe_disks
.
append
(
name
)
def
add_remote_check
(
self
,
name
):
self
.
remote_checks
.
append
(
name
)
def
enable_nrpe
(
self
):
self
.
nrpe
=
True
...
...
@@ -521,6 +531,18 @@ class NetBoxParser:
except
KeyError
:
pass
try
:
for
remote_check
in
monitoring_config_context
[
"remote_checks"
]:
self
.
host
.
add_remote_check
(
remote_check
)
except
KeyError
:
pass
try
:
for
partition
in
monitoring_config_context
[
"partitions"
]:
self
.
host
.
add_partition
(
partition
)
except
KeyError
:
pass
try
:
if
monitoring_config_context
[
"procs"
]:
for
proc
in
monitoring_config_context
[
"procs"
]:
...
...
netbox_icinga_generator/templates/generic-host.j2
View file @
a7f8c252
...
...
@@ -50,6 +50,8 @@ object Host "{{ vars.name }}" {
vars.procs["{{ check }}"] = {}{% endfor %}
// disk checks
{%- for partition in vars.partitions %}
vars.partition["{{ partition }}"] = {}{% endfor %}
{%- for disk in vars.smart %}
vars.smart["{{ disk }}"] = {}{% endfor %}
{%- for disk in vars.smart_sectors %}
...
...
@@ -59,13 +61,15 @@ object Host "{{ vars.name }}" {
{%- for disk in vars.disk_temp %}
vars.disk_temp["{{ disk }}"] = {}{% endfor %}
//
NRPE
checks
//
Remote
checks
{%- if vars.nrpe is defined and vars.nrpe %}
vars.nrpe = true{% endif %}
{%- for check in vars.nrpe_checks %}
vars.nrpe_check["check_{{ check }}"] = {}{% endfor %}
{%- for check in vars.nrpe_disks %}
vars.nrpe_disk["check_{{ check }}_disk"] = {}{% endfor %}
{%- for check in vars.remote_checks %}
vars.remote_check["{{ check }}"] = {}{% endfor %}
import "netbox-generated-host-post"
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment