Skip to content

Commit

Permalink
Merge pull request #186 from ccztux/185-add-support-to-transfer-check…
Browse files Browse the repository at this point in the history
…-results-to-icinga2-via-api

185 add support to transfer check results to icinga2 via api
  • Loading branch information
ccztux committed Oct 3, 2023
2 parents 6f544f3 + 971ba25 commit 85feecf
Show file tree
Hide file tree
Showing 19 changed files with 811 additions and 66 deletions.
1 change: 1 addition & 0 deletions .github/workflows/shellcheck-devel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ jobs:
- name: ShellCheck our scripts
run: |
docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always --check-sourced --external-sources /scripts/usr/bin/modpd
docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always --check-sourced --external-sources /scripts/usr/libexec/modpd/send_icinga2_api.sh
1 change: 1 addition & 0 deletions .github/workflows/shellcheck-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ jobs:
- name: ShellCheck our scripts
run: |
docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always --check-sourced --external-sources /scripts/usr/bin/modpd
docker run -v $(pwd):/scripts koalaman/shellcheck:stable --color=always --check-sourced --external-sources /scripts/usr/libexec/modpd/send_icinga2_api.sh
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2023-07-10
#
# Version 3.0.0
# Version 3.1.0
#
# Description: Makefile for the modpd NEB module
#
Expand Down
57 changes: 41 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
* [Registered trademarks](#registered-trademarks)
* [Known Issues](#known-issues)
* [Supported monitoring engines](#supported-monitoring-engines)
* [modpd >= 3.x.x](#modpd--3xx)
* [modpd < 3.x.x](#modpd--3xx-1)
* [modpd >= 3.1.x](#modpd--31x)
* [modpd == 3.0.x](#modpd--30x)
* [modpd < 3.0.0](#modpd--300)
* [Requirements](#requirements)
* [Required for building, compiling and installing the NEB modules and modpd](#required-for-building-compiling-and-installing-the-neb-modules-and-modpd)
* [Required binaries for the installation of NRDP](#required-binaries-for-the-installation-of-nrdp)
Expand Down Expand Up @@ -76,7 +77,7 @@

modpd consists of a NEB module and a daemon written in bash. The NEB module collects data and writes
it to a named pipe. The daemon part reads the data from the named pipe and sends the check results
via NRDP or NSCA to another monitoring server.
via NRDP, NSCA or Icinga2 API to another monitoring server.


# What was the motivation to develop modpd?
Expand Down Expand Up @@ -111,12 +112,19 @@ something in the configuration, because in case of a restart more than one datas


# Supported monitoring engines
## modpd >= 3.x.x
## modpd >= 3.1.x
* Nagios® 3.4.x
* Naemon 1.3.x
* Icinga2 via Icinga2 API (Only on the passive checks site!)


## modpd < 3.x.x

## modpd == 3.0.x
* Nagios® 3.4.x
* Naemon 1.3.x


## modpd < 3.0.0
* Nagios® 3.4.x


Expand Down Expand Up @@ -156,6 +164,7 @@ something in the configuration, because in case of a restart more than one datas
- **bash** (version >= 3)
- **whoami** to check the user who has started modpd
- **pgrep** to check if an instance of modpd is already running
- **grep** for common purposes
- **date** for logging purposes (Only required if bash version < 4.2, else bash's printf builtin will be used.)
- **rm** to delete the named_pipe_filename
- **mkdir** to create directories
Expand Down Expand Up @@ -276,7 +285,7 @@ systemctl status nagios
Check if the modpd NEB module was loaded by nagios:
```bash
[root@lab01]:~# grep -i modpd /usr/local/nagios/var/nagios.log
[1582272717] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.0
[1582272717] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.1.0
[1582272717] modpd: Starting...
[1582272717] Event broker module '/usr/lib64/modpd/modpd_nagios3.o' initialized successfully.
```
Expand Down Expand Up @@ -315,7 +324,7 @@ systemctl status naemon
Check if the modpd NEB module was loaded by naemon:
```bash
[root@lab01]:~# grep -i modpd /var/log/naemon/naemon.log
[1582272717] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.0
[1582272717] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.1.0
[1582272717] modpd: Starting...
[1582272717] Event broker module '/usr/lib64/modpd/modpd_naemon.o' initialized successfully.
```
Expand Down Expand Up @@ -443,7 +452,7 @@ systemctl status nagios
Check if the modpd NEB module was loaded by nagios:
```bash
[root@lab01]:~# grep -i modpd /usr/local/nagios/var/nagios.log
[1582272717] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.0
[1582272717] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.1.0
[1582272717] modpd: Starting...
[1582272717] Event broker module '/usr/lib64/modpd/modpd_nagios3.o' initialized successfully.
```
Expand All @@ -466,7 +475,7 @@ systemctl status naemon
Check if the modpd NEB module was loaded by naemon:
```bash
[root@lab01]:~# grep -i modpd /var/log/naemon/naemon.log
[1582272717] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.0
[1582272717] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.1.0
[1582272717] modpd: Starting...
[1582272717] Event broker module '/usr/lib64/modpd/modpd_naemon.o' initialized successfully.
```
Expand Down Expand Up @@ -502,8 +511,8 @@ tail -f /var/log/modpd/modpd.log
Usage: modpd OPTIONS
Author: Christian Zettel (ccztux)
Last modification: 2023-01-09
Version: 3.0.0
# 2023-07-10
Version: 3.1.0
Description: modpd (Monitoring Obsessing Data Processor Daemon)
Expand Down Expand Up @@ -558,9 +567,9 @@ OPTIONS:
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2023-07-10
#
# Version 3.0.0
# Version 3.1.0
#
# Description: Config file for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down Expand Up @@ -606,7 +615,7 @@ fi
#-------------------

# define the obsessing interface
# (valid values: nrdp|nsca)
# (valid values: nrdp|nsca|icinga)
c_obsessing_interface="nrdp"

# define the host, where check results should be sent to
Expand Down Expand Up @@ -642,6 +651,22 @@ c_nrdp_password="mySecret"



#--------------------------------------------------------------------------------
# Icinga2 API specific settings (Needed in case c_obsessing_interface is icinga2)
#--------------------------------------------------------------------------------

# define the connection protocol
# (valid values: http|https)
c_icinga_protocol="https"

# define the username to connect as with Icinga2 API
c_icinga_username="icingauser"

# define the password of the user you have defined in variable: c_icinga_username with which we sould connect
c_icinga_password="mySecret"



#----------------------------------------------------------------------
# NSCA specific settings (Needed in case c_obsessing_interface is nsca)
#----------------------------------------------------------------------
Expand Down Expand Up @@ -783,7 +808,7 @@ c_stats_enabled="1"
## Example log snippets
### modpd daemon log snippet
```
2021-01-07 16:10:01 | 7084 | checkLogHandlerRequirements | modpd 3.0.0 starting... (PID=7084)
2021-01-07 16:10:01 | 7084 | checkLogHandlerRequirements | modpd 3.1.0 starting... (PID=7084)
2021-01-07 16:10:01 | 7084 | checkLogHandlerRequirements | We are using the config file: '/etc/modpd/modpd.conf'
2021-01-07 16:10:01 | 7084 | getExecUser | Get user which starts the daemon...
2021-01-07 16:10:01 | 7084 | getExecUser | modpd was started as user: 'nagios'
Expand Down Expand Up @@ -866,7 +891,7 @@ c_stats_enabled="1"

### modpd NEB module log snippet
```
[1607849563] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.0.0
[1607849563] modpd: Copyright © 2017-NOW Christian Zettel (ccztux), all rights reserved, Version: 3.1.0
[1607849563] modpd: Starting...
[1607849563] Event broker module '/usr/lib64/modpd/modpd_naemon.o' initialized successfully.
[1607849863] modpd: The modpd NEB module is running 0d 0h 5m 0s
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.1.0
4 changes: 2 additions & 2 deletions etc/logrotate.d/modpd
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2023-07-10
#
# Version 3.0.0
# Version 3.1.0
#
# Description: logrotate config file for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down
22 changes: 19 additions & 3 deletions etc/modpd/modpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2023-07-10
#
# Version 3.0.0
# Version 3.1.0
#
# Description: Config file for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down Expand Up @@ -59,7 +59,7 @@ fi
#-------------------

# define the obsessing interface
# (valid values: nrdp|nsca)
# (valid values: nrdp|nsca|icinga)
c_obsessing_interface="nrdp"

# define the host, where check results should be sent to
Expand Down Expand Up @@ -95,6 +95,22 @@ c_nrdp_password="mySecret"



#--------------------------------------------------------------------------------
# Icinga2 API specific settings (Needed in case c_obsessing_interface is icinga2)
#--------------------------------------------------------------------------------

# define the connection protocol
# (valid values: http|https)
c_icinga_protocol="https"

# define the username to connect as with Icinga2 API
c_icinga_username="icingauser"

# define the password of the user you have defined in variable: c_icinga_username with which we sould connect
c_icinga_password="mySecret"



#----------------------------------------------------------------------
# NSCA specific settings (Needed in case c_obsessing_interface is nsca)
#----------------------------------------------------------------------
Expand Down
22 changes: 19 additions & 3 deletions etc/modpd/modpd.sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2023-07-10
#
# Version 3.0.0
# Version 3.1.0
#
# Description: Config file for modpd (Monitoring Obsessing Data Processor Daemon)
#
Expand Down Expand Up @@ -59,7 +59,7 @@ fi
#-------------------

# define the obsessing interface
# (valid values: nrdp|nsca)
# (valid values: nrdp|nsca|icinga)
c_obsessing_interface="nrdp"

# define the host, where check results should be sent to
Expand Down Expand Up @@ -95,6 +95,22 @@ c_nrdp_password="mySecret"



#--------------------------------------------------------------------------------
# Icinga2 API specific settings (Needed in case c_obsessing_interface is icinga2)
#--------------------------------------------------------------------------------

# define the connection protocol
# (valid values: http|https)
c_icinga_protocol="https"

# define the username to connect as with Icinga2 API
c_icinga_username="icingauser"

# define the password of the user you have defined in variable: c_icinga_username with which we sould connect
c_icinga_password="mySecret"



#----------------------------------------------------------------------
# NSCA specific settings (Needed in case c_obsessing_interface is nsca)
#----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions etc/sysconfig/modpd
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Project website: https://github.com/ccztux/modpd
#
# Last Modification: Christian Zettel (ccztux)
# 2023-01-09
# 2023-07-10
#
# Version 3.0.0
# Version 3.1.0
#
# Description: Config parameters for the init script of the modpd daemon
# (Monitoring Obsessing Data Processor Daemon)
Expand Down
Loading

0 comments on commit 85feecf

Please sign in to comment.