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
1a0a75d6
Verified
Commit
1a0a75d6
authored
Feb 19, 2022
by
Adrian Schollmeyer
Browse files
generator/host: Refactor OS detection
parent
246c1ff0
Changes
1
Hide whitespace changes
Inline
Side-by-side
generate-icinga-generic-host.py
View file @
1a0a75d6
...
...
@@ -219,33 +219,23 @@ def create_icinga2_host_object_from_netbox(netbox, device_name):
continue
ssh_ports
.
append
(
p
)
device_is_linux
=
Fals
e
os
=
Non
e
if
device
.
platform
:
device_platform
=
device
.
platform
.
slug
for
linux_platform
in
LINUX_PLATFORMS
:
if
device_platform
==
linux_platform
:
device_is_linux
=
True
os
=
"Linux"
break
if
device_is_linux
:
host
=
Icinga2Host
(
device_name
,
"server"
,
parent
,
primary_ip4
,
primary_ip6
,
ssh_port
,
"Linux"
)
else
:
host
=
Icinga2Host
(
device_name
,
"server"
,
parent
,
primary_ip4
,
primary_ip6
,
ssh_port
)
host
=
Icinga2Host
(
device_name
,
"server"
,
parent
,
primary_ip4
,
primary_ip6
,
ssh_port
,
os
)
if
device
.
device_role
.
slug
==
"vm-host"
:
host
.
host_class
=
"vm-host"
...
...
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