opinkerfi / okconfig

Ready made monitoring packs for Nagios
GNU General Public License v3.0
45 stars 28 forks source link

okconfig addservice issue #52

Closed richard-allen closed 10 years ago

richard-allen commented 10 years ago

I used okconfig to set up a quick monitoring setup of 100 hosts. I did it like this:

for i in $(seq 1 100); do printf "okconfig addhost --host knc%04i --group knc-miners\n" $i; done > doit for i in $(seq 1 100); do printf "okconfig addservice host_name=knc%04i use=okc-linux-check_ssh\n" $i; done > doit2

Sample from each file: first file:

okconfig addhost --host knc0008 --group knc-miners okconfig addhost --host knc0009 --group knc-miners okconfig addhost --host knc0010 --group knc-miners okconfig addhost --host knc0011 --group knc-miners okconfig addhost --host knc0012 --group knc-miners

second:

okconfig addservice host_name=knc0008 use=okc-linux-check_ssh okconfig addservice host_name=knc0009 use=okc-linux-check_ssh okconfig addservice host_name=knc0010 use=okc-linux-check_ssh okconfig addservice host_name=knc0011 use=okc-linux-check_ssh okconfig addservice host_name=knc0012 use=okc-linux-check_ssh

then I just ran doit1 and then doit2 and I had what I needed to monitor these systems. I do however see an issue with the resulting config:

root@ds-0998:~# cd /etc/nagios3/okconfig/services/ root@ds-0998:/etc/nagios3/okconfig/services# ll total 204 drwxr-xr-x 2 root root 4096 Nov 20 14:47 ./ drwxr-xr-x 5 root root 4096 Nov 6 18:33 ../ -rw-r--r-- 1 root root 197599 Nov 20 14:47 untitled.cfg

it contains:

Configuration file /etc/nagios3/okconfig/services/untitled.cfg

Edited by PyNag on Wed Nov 6 19:02:48 2013

define service { use okc-linux-check_ssh
}

Configuration file /etc/nagios3/okconfig/services/untitled.cfg

Edited by PyNag on Wed Nov 6 19:02:48 2013

Values from templates:

check_command check_ssh

active_checks_enabled 1

obsess_over_service 1

is_volatile 0

process_perf_data 1

check_period 24x7

notification_interval 0

notification_period 24x7

failure_prediction_enabled 1

retain_status_information 1

event_handler_enabled 1

flap_detection_enabled 1

notification_options w,u,c,r

retry_check_interval 1

retain_nonstatus_information 1

notifications_enabled 1

contact_groups admins

service_description SSH Connectivity

parallelize_check 1

passive_checks_enabled 1

normal_check_interval 5

max_check_attempts 4

check_freshness 0

define service { use okc-linux-check_ssh
host_name knc0001
}

This block is reapeated 99 more times, once for each host.

palli commented 10 years ago

Confirmed.

Until such a time when patch is provided you can use the following workaround:

# Remove all the duplicate services
pynag delete where use=okc-linux-check_ssh and host_name__exists=False 

# For future use, use this command to create your services:
pynag add service use= okc-linux-check_ssh host_name=knc$i
palli commented 10 years ago

commit 1bffc34 should fix the issue. Can you verify problem is gone ?