"The salty command line interface to your Naemon configuration."
NaCl is a command line tool for working with your Naemon configuration files. It allows you to create flexible filters for querying your object definitions, which can then be used as a basis for updates or analysis.
NaCl is written in Python and is (somewhat) tested to work with Python versions 3.6, 3.7, 3.8 and 3.9. Your experience with other versions may vary.
NaCl is currently not available on PyPI but can be installed directly from the Github repo:
pip install git+https://github.com/jimorie/nacl.git
(Make sure that is pip is updated if you run into problems: pip install --upgrade pip
)
Check out the command line help for usage information:
nacl --help
$ nacl etc/ --host confluence-dev.op5.com
# File: etc/hosts.cfg line 499
define host {
use default-host-template
host_name confluence-dev.op5.com
address 127.0.0.1
}
# Total: 1 / 1520 matching object definition(s)
$ nacl etc/ --filter 'type == "host" and "dev.op5.com" in host_name'
# File: etc/hosts.cfg line 492
define host {
use default-host-template
host_name ci-slave-el6-lvmtest.dev.op5.com
address 127.0.0.1
}
# File: etc/hosts.cfg line 499
define host {
use default-host-template
host_name confluence-dev.op5.com
address 127.0.0.1
}
# File: etc/hosts.cfg line 1291
define host {
use default-host-template
host_name w2008-ietest-01.dev.op5.com
address 127.0.0.1
}
# Total: 3 / 1520 matching object definition(s)
$ nacl etc/ --filter 'type == "host" and not host_name and register != 0'
# File: etc/hosts.cfg line 19
define host {
use default-host-template
alias Blanktesttemplate
hostgroups Inheritance
name Blanktesttemplate
}
# Total: 1 / 1520 matching object definition(s)
$ nacl etc/ --filter 'type == "host" and has_member(hostgroups, "pollergroup")'
# File: etc/hosts.cfg line 1146
define host {
use default-host-template
host_name pollerhost1
alias pollerhost1
address 127.0.0.1
hostgroups pollergroup,thunderbirds
contact_groups support-group
stalking_options d,u
}
# File: etc/hosts.cfg line 1157
define host {
use default-host-template
host_name pollerhost2
address 127.0.0.1
hostgroups pollergroup
stalking_options n
}
# Total: 2 / 1520 matching object definition(s)
$ nacl etc/ --update '_FOO_BAR = 1'
# File: etc/hostgroups.cfg line 9
define hostgroup {
hostgroup_name Apica WPM Responsetime
alias Apica WPM Responsetime
_FOO_BAR 1
}
# File: etc/hostgroups.cfg line 15
define hostgroup {
hostgroup_name apa
_FOO_BAR 1
}
...
# File: etc/serviceescalations.cfg line 34
define serviceescalation {
host_name 1111111111111
service_description All_Disk_Aix_withouthak2
contacts dblando,email_test,asjoholm
contact_groups nachosgroup,support-group
first_notification 1
last_notification 2
notification_interval 3
escalation_period 24x7
escalation_options c,r,u,w
_FOO_BAR 1
}
# Total: 1520 / 1520 matching object definition(s)
$ nacl etc/ --filter 'type == "host" and not host_name and register != 0' --update 'register = 0'
# File: etc/hosts.cfg line 19
define host {
use default-host-template
alias Blanktesttemplate
hostgroups Inheritance
name Blanktesttemplate
register 0
}
# Total: 1 / 1520 matching object definition(s)
$ nacl etc/ --filter 'type == "host" and has_member(hostgroups, "pollergroup")' --update 'hostgroups -= "pollergroup"; hostgroups += "mastergroup"'
# File: etc/hosts.cfg line 1146
define host {
use default-host-template
host_name pollerhost1
alias pollerhost1
address 127.0.0.1
hostgroups thunderbirds,mastergroup
contact_groups support-group
stalking_options d,u
}
# File: etc/hosts.cfg line 1157
define host {
use default-host-template
host_name pollerhost2
address 127.0.0.1
stalking_options n
hostgroups mastergroup
}
# Total: 2 / 1520 matching object definition(s)
$ nacl etc/ --count type
Count: type
===========
834 command
456 service
155 host
36 hostgroup
12 contact
8 timeperiod
6 servicegroup
3 contactgroup
3 servicedependency
3 serviceescalation
2 hostdependency
2 hostescalation
# Total: 1520 / 1520 matching object definition(s)
Find out what different values for notification_interval
are used in your hosts, services and escalations:
$ nacl etc/ --count notification_interval --filter 'type in ["host", "service", "hostescalation", "serviceescalation"]'
Count: notification_interval
============================
595 -
7 0
7 5
4 3
2 2
1 1
# Total: 616 / 1520 matching object definition(s)
- Tests
- Documentation
- Move to ITRS repo?
Copyright ITRS Group.