Implement nrpe config parser to easily hook into Puppet managed checks
Closed, ResolvedPublic


Puppet already configures a number of nrpe Icinga checks in /etc/nagios/nrpe.d. Scap3 configurations should be able to reuse these checks by name.

dduvall created this task.Sep 30 2015, 6:18 PM
dduvall updated the task description. (Show Details)
dduvall raised the priority of this task from to Normal.
dduvall assigned this task to mmodell.
dduvall added projects: Scap, Deployments.
dduvall moved this task from Needs triage to Services MVP on the Scap board.
dduvall added subscribers: gerritbot, bd808, Joe and 7 others.

1import ConfigParser, os
2from os import listdir
3from os.path import isfile, join
4import re
6def load_checks_from_nrpe_d(nrpe_d = "/etc/nagios/nrpe.d"):
7check_commands = {}
9for path in listdir(nrpe_d):
10cfgfile = join(nrpe_d,path)
11if not isfile(cfgfile):
14with open(cfgfile, 'r') as cfg:
15for line in cfg:
16line = line.lstrip()
17if line.startswith('#'):
19(cmd_name, cmd_line) = line.split( "=", 1 )
20match = re.match('command\[(.*)\]', cmd_name.lstrip())
21if match:
22cmd_name =
25check_commands[cmd_name] = {
26"type": "shell_command",
27"name": cmd_name,
28"cmdline": cmd_line
30return check_commands


  "check_raid": {
    "cmdline": "/usr/bin/sudo /usr/local/bin/", 
    "type": "shell_command", 
    "name": "check_raid"
  "check_puppet_checkpuppetrun": {
    "cmdline": "/usr/bin/sudo /usr/local/lib/nagios/plugins/check_puppetrun -w 10800 -c 21600", 
    "type": "shell_command", 
    "name": "check_puppet_checkpuppetrun"
  "check_cassandra": {
    "cmdline": "/usr/lib/nagios/plugins/check_procs -c 1:1 -u cassandra -C java -a CassandraDaemon", 
    "type": "shell_command", 
    "name": "check_cassandra"
  "check_disk_space": {
    "cmdline": "/usr/lib/nagios/plugins/check_disk -w 6% -c 3% -l -e -A -i \"/srv/sd[a-b][1-3]\"", 
    "type": "shell_command", 
    "name": "check_disk_space"
  "check_check_salt_minion": {
    "cmdline": "/usr/lib/nagios/plugins/check_procs -w 1: -c 1:4 --ereg-argument-array '^/usr/bin/python /usr/bin/salt-minion'", 
    "type": "shell_command", 
    "name": "check_check_salt_minion"
  "check_root_disk_space": {
    "cmdline": "/usr/lib/nagios/plugins/check_disk -w 5% -c 2% -l -e -p /", 
    "type": "shell_command", 
    "name": "check_root_disk_space"
  "check_check_dhclient": {
    "cmdline": "/usr/lib/nagios/plugins/check_procs -w 0:0 -c 0:0 -C dhclient", 
    "type": "shell_command", 
    "name": "check_check_dhclient"
  "check_dpkg": {
    "cmdline": "/usr/local/lib/nagios/plugins/check_dpkg", 
    "type": "shell_command", 
    "name": "check_dpkg"
  "check_check_eth": {
    "cmdline": "/usr/local/lib/nagios/plugins/check_eth", 
    "type": "shell_command", 
    "name": "check_check_eth"
  "check_endpoints_restbase": {
    "cmdline": "/usr/local/lib/nagios/plugins/service_checker -t 5", 
    "type": "shell_command", 
    "name": "check_endpoints_restbase"
mmodell closed this task as Resolved.Oct 7 2015, 9:56 PM
mmodell moved this task from Services MVP to Done on the Scap board.Oct 8 2015, 10:04 AM