Skip to content
T.J. Yang edited this page Apr 19, 2018 · 3 revisions

This is the okconfig user guide. Feel free to fill in any missing sections.

Example host and clients info.

-bash-4.2$ tree /etc/nagios/okconfig/
/etc/nagios/okconfig/
├── examples
├── groups
│   ├── default.cfg
│   └── miq.cfg
├── hosts
│   └── default
│       ├── awx.test.lan-host.cfg
│       ├── foreman.test.lan-host.cfg
│       ├── freenas.test.lan-host.cfg
│       ├── ipa01.test.lan-host.cfg
│       ├── ipa1.test.lan-host.cfg
│       ├── keycloak01.test.lan-host.cfg
│       ├── miqdb02.test.lan-host.cfg
│       ├── miqdb02.test.lan-linux.cfg
│       ├── nagios01.test.lan-host.cfg
│       ├── nagios01.test.lan-linux.cfg
│       ├── salt01.test.lan-host.cfg
│       ├── w530.test.lan-host.cfg
│       └── w530.test.lan-linux.cfg
└── templates

5 directories, 15 files
-bash-4.2$

Usage from --help output

-bash-4.2$ which okconfig
/bin/okconfig
-bash-4.2$

-bash-4.2$ okconfig --help
Usage: okconfig <command> [arguments]

Common okconfig commands:
  addhost       Add a new host
  addtemplate   Add a new template to existing host
  addgroup      Add a new host/contact/service group
  addcontact    Add a new contact
  addservice    Add a service check to host
  removehost    Delete a host
  listtemplates List all available templates
  listhosts     List all hosts
  listhost      List a single host
  init          Initilize nagios to use okconfig
  install       Install an agent on a remote server
  upgrade       Runs migration routines in case of okconfig upgrades
  verify        Verifies current okconfig installation

For help on specific command type:
 okconfig <command> --help

Examples:
 okconfig addgroup linuxservers --alias "Example Linux Servers"
 okconfig addhost <host_name> --template linux --address 127.0.0.1 --group linuxservers
 okconfig addtemplate <host_name> --template oracle


Options:
  -h, --help  show this help message and exit
  --debug     Print extra debugging information
-bash-4.2$

okconfig subcommands

addhost

add a new host

addtemplate

add a new template to existing host

addgroup

add a new host/contact/service group

addcontact

add a new contact

listtemplates

List all available templates

-bash-4.2$ okconfig listtemplates |head -10
apc-netbotz
ipa
drbd
mysql
nagios
apc-ups
counter-mssql
ironport
ciscoasa
linux
-bash-4.2$

listhosts

List all hosts

-bash-4.2$ okconfig listhosts
host name                               groups
----------------------------------------------
gateway.test.lan                        linux-servers
cdns01.comcast.net                      linux-servers
miqdb02.test.lan                        miq
keycloak01.test.lan                     default
w530.test.lan                           default
foreman.test.lan                        default
nagios01.test.lan                       default
awx.test.lan                            default
salt01.test.lan                         default
ipa1.test.lan                           default
ipa01.test.lan                          default
--- 11 hosts found ----------------------------
-bash-4.2$

init

Initilize nagios to use okconfig

install

Install an agent on a remote server

upgrade

runs migration routines in case of okconfig upgrades

verify

verifies current okconfig installation

-bash-4.2$ okconfig verify
Okconfig verification
---------------------
* destination_directory /etc/nagios/okconfig is writable                ...success
* Main configuration file /etc/nagios/nagios.cfg is readable            ...success
* template_directory /usr/share/okconfig/templates exists               ...success
-bash-4.2$

Examples