Sorry , the output is : ls -lR /usr/local/var/lib/icinga2/api/packages /usr/local/var/lib/icinga2/api/packages: total 4 drwx------ 3 icinga icinga 4096 Nov 15 10:24 _api
/usr/local/var/lib/icinga2/api/packages/_api: total 4 drwx------ 4 icinga icinga 4096 Nov 15 10:29 conf.d /usr/local/var/lib/icinga2/api/packages/_api/conf.d: total 8 drwx------ 2 icinga icinga 4096 Nov 15 14:09 downtimes drwx------ 2 icinga icinga 4096 Nov 15 14:03 hosts /usr/local/var/lib/icinga2/api/packages/_api/conf.d/downtimes: total 16 -rw-r--r-- 1 icinga icinga 504 Nov 15 10:24 icinga-cluster-2.englab.juniper.net!load!icinga-cluster-2-1447611851-0.conf -rw-r--r-- 1 icinga icinga 504 Nov 15 10:29 icinga-cluster-2.englab.juniper.net!load!icinga-cluster-2-1447612154-0.conf -rw-r--r-- 1 icinga icinga 504 Nov 15 10:29 icinga-cluster-2.englab.juniper.net!load!icinga-cluster-2-1447612195-0.conf -rw-r--r-- 1 icinga icinga 504 Nov 15 14:09 icinga-cluster-2.englab.juniper.net!load!icinga-cluster-2-1447625369-0.conf /usr/local/var/lib/icinga2/api/packages/_api/conf.d/hosts: total 8 -rw-r--r-- 1 icinga icinga 110 Nov 15 10:29 10.102.58.77.conf -rw-r--r-- 1 icinga icinga 110 Nov 15 14:03 10.102.58.78.conf > > >---------------------------------------------------------------------- > >Message: 1 >Date: Sun, 15 Nov 2015 22:13:30 +0000 >From: Gunnar Beutner <[email protected]> >To: "[email protected]" <[email protected]> >Subject: Re: [icinga-users] Question about icinga2 api dynamically > added hosts and hostgroups >Message-ID: <[email protected]> >Content-Type: text/plain; charset="utf-8" > > > > > > >On 15/11/15 23:10, "icinga-users on behalf of Madhusmita Gochhait" ><[email protected] on behalf of [email protected]> >wrote: > >> >>Here is the output of the config file : >> >>3) root@icinga-cluster-2:~# ls -ltr >>/usr/local/var/lib/icinga2/api/packages/_api/conf.d/hosts/10.102.58.77.conf >>-rw-r--r-- 1 icinga icinga 110 Nov 15 14:03 >>/usr/local/var/lib/icinga2/api/packages/_api/conf.d/hosts/10.102.58.77.conf > >Sorry, that?s not what I asked for. > >> >>4 ) root@icinga-cluster-2:~# cat >>/usr/local/var/lib/icinga2/api/packages/_api/conf.d/hosts/10.102.58.77.conf >>object Host "10.102.58.77" { >>import "generic-host" >> >>address = "10.102.58.77" >>version = 1447625037.471167 >>} >> >>---------------------------------------------------------------------- >> >>Message: 1 >>Date: Sun, 15 Nov 2015 19:04:51 +0000 >>From: Gunnar Beutner <[email protected]> >>To: "[email protected]" <[email protected]> >>Subject: Re: [icinga-users] Question about icinga2 api dynamically >> added hosts and hostgroups >>Message-ID: <[email protected]> >>Content-Type: text/plain; charset="utf-8" >> >>Can you attach the output of ?ls -lR /usr/local/var/lib/icinga2/api/packages? >>and the contents of that config file? >> >>FWIW the path is somewhat odd, it _should_ be >>/usr/local/var/lib/icinga2/api/packages/_api/<unique-id>/conf.d/hosts/. >> >> >> >> >>On 15/11/15 19:44, "icinga-users on behalf of Madhusmita Gochhait" >><[email protected] on behalf of [email protected]> >>wrote: >> >>>The host config file was created . >>> >>>ls -ltr /usr/local/var/lib/icinga2/api/packages/_api/conf.d/hosts/ >>>total 4 >>>-rw-r--r-- 1 icinga icinga 110 Nov 15 10:29 10.102.58.77.conf >>> >>>But not able to query , after restart of icinga process. >>> >>>curl -k -s -u icingaadmin:icinga >>>'https://localhost:5665/v1/objects/hosts/10.102.58.77' >>>Error: Object does not exist. >>> >>>Please note that i am using the latest snapshot build of icinag2 . >>> >>>Regards, >>>mgochhait >>>---------------------------------------------------------------------- >>> >>>Message: 1 >>>Date: Sun, 15 Nov 2015 08:55:40 +0000 >>>From: Gunnar Beutner <[email protected]> >>>To: "[email protected]" <[email protected]> >>>Subject: Re: [icinga-users] Question about icinga2 api dynamically >>> added hosts and hostgroups >>>Message-ID: <[email protected]> >>>Content-Type: text/plain; charset="utf-8" >>> >>> >>> >>> >>> >>> >>>On 13/11/15 23:02, "icinga-users on behalf of Madhusmita Gochhait" >>><[email protected] on behalf of [email protected]> >>>wrote: >>> >>>>After restart of icinga process , Icinga unable to query the hosts/groups >>>>objects through api . Icinga http returns object does not exist >>>> >>>> >>>>Here are the steps to simulate the issue (Single Node) >>>> >>>> >>>>Step 1: curl -k -s -u icingaadmin:icinga >>>>'https://localhost:5665/v1/objects/hosts/10.102.58.77' -H "Accept: >>>>application/json" -X PUT -d '{ "templates": [ "generic-host" ], "attrs": { >>>>"address": "10.102.58.77?}} >>>> {"results":[{"code":200.0,"status":"Object was created"}]} >>>>Step 2 : query to icinga - curl -k -s -u icingaadmin:icinga >>>>'https://localhost:5665/v1/objects/hosts/10.102.58.77' will result with >>>>detailed host output >>>> >>>>Step 3: Restart Icinga >>>> service icinga2 reload >>> >>>Works for me. Can you check whether the host?s config file was created?: >>> >>>acheron:icinga2 gunnar$ ls -l >>>../i2/var/lib/icinga2/api/packages/_api/acheron-1445924979-1/conf.d/hosts/ >>>total 8 >>>-rw-r--r-- 1 gunnar staff 110 Nov 15 09:53 10.102.58.77.conf >>>acheron:icinga2 gunnar$ cat >>>../i2/var/lib/icinga2/api/packages/_api/acheron-1445924979-1/conf.d/hosts/10.102.58.77.conf >>>object Host "10.102.58.77" { >>>import "generic-host" >>> >>> >>>address = "10.102.58.77" >>>version = 1447577614.982893 >>>} >>>acheron:icinga2 gunnar$ >>> >>> >>> >>>> >>>> >>>>Step 4: Host Query as detailed in Step 2 >>>>curl -k -s -u icingaadmin:icinga >>>>'https://localhost:5665/v1/objects/hosts/10.102.58.77' >>>>Error: Object does not exist >>>> >>>> >>>> >>>> >>>> >>>>Similar behavior with host groups also . >>>> >>>> >>>>Thanks, >>>>mgochhait >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>>From: Madhusmita Gochhait <[email protected]> >>>>Date: Tuesday, November 10, 2015 at 3:21 PM >>>>To: "[email protected]" <[email protected]> >>>>Subject: Question about icinga2 api dynamically added hosts and hostgroups >>>> >>>> >>>> >>>>I am using the snapshot version of icinga2 for the api feature . >>>>Dynamically add hosts and host groups. >>>>Here is what i am doing : >>>>To add hostgroup : curl -k -s -u icingaadmin:icinga >>>>'https://localhost:5665/v1/objects/hostgroups/testgrp' -X PUT -d '{ >>>>"attrs": { "name" : "testgrp" ,"display_name" : "testgrp" >>>> , "state_loaded" :true }}' >>>>To add host : >>>>curl -k -s -u icingaadmin:icinga 'https://localhost:5665/v1/objects/hosts/ >>>><https://localhost:5665/v1/objects/hosts/8.8.8.8>testhost' -X PUT -d '{ >>>>"templates": [ "generic-host" ], "attrs": { "address": "8.8.8.8" , "groups" >>>>: [ >>>> "testgrp" ]} }' >>>>It gets successfully added and I am also able to query them through the >>>>api . >>>>But in UI , I am seeing only the host and no hostgroup . >>>>The host group gets displayed once I restart/reload icinga . >>>>Since , we have a large setup (>1000 hosts ) , we don?t want to reload >>>>/restart everytime we add hostgroups . >>>>Is there any way it can be done in same way as the host , so that both host >>>>and host groups shows in UI without restart everytime ? >>>> >>>> >>>>Thanks, >>>>mgochhait >>>> >>>> >>>> >>>> <http://stackoverflow.com/questions/tagged/icinga> >>>> >>>> >>>> >>>> >>> >>>--? >>>Gunnar Beutner >>>Senior Developer >>> >>>NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg >>>Tel: +49 911 92885-0 | Fax: +49 911 92885-77 >>>GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 >>>http://www.netways.de | [email protected] >>> >>>** OSMC 2015 - November - netways.de/osmc ** >>>** OSDC 2016 - April ? netways.de/osdc ** >>> >>>------------------------------ >>> >>>Subject: Digest Footer >>> >>>_______________________________________________ >>>icinga-users mailing list >>>[email protected] >>>https://lists.icinga.org/mailman/listinfo/icinga-users >>> >>> >>>------------------------------ >>> >>>End of icinga-users Digest, Vol 23, Issue 24 >>>******************************************** >>>_______________________________________________ >>>icinga-users mailing list >>>[email protected] >>>https://lists.icinga.org/mailman/listinfo/icinga-users >> >>--? >>Gunnar Beutner >>Senior Developer >> >>NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg >>Tel: +49 911 92885-0 | Fax: +49 911 92885-77 >>GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 >>http://www.netways.de | [email protected] >> >>** OSMC 2015 - November - netways.de/osmc ** >>** OSDC 2016 - April ? netways.de/osdc ** >> >>------------------------------ >> >>Message: 2 >>Date: Sun, 15 Nov 2015 19:06:43 +0000 >>From: Michael Friedrich <[email protected]> >>To: "[email protected]" <[email protected]> >>Subject: Re: [icinga-users] Question about icinga2 api dynamically >> added hosts and hostgroups >>Message-ID: <[email protected]> >>Content-Type: text/plain; charset="utf-8" >> >> >>> On 15 Nov 2015, at 19:44, Madhusmita Gochhait <[email protected]> wrote: >>> >>> The host config file was created . >>> >>> ls -ltr /usr/local/var/lib/icinga2/api/packages/_api/conf.d/hosts/ >>> total 4 >>> -rw-r--r-- 1 icinga icinga 110 Nov 15 10:29 10.102.58.77.conf >> >>That path is not coming from the package repositories, what kind of build is >>that? >> >>> >>> But not able to query , after restart of icinga process. >>> >>> curl -k -s -u icingaadmin:icinga >>> 'https://localhost:5665/v1/objects/hosts/10.102.58.77' >>> Error: Object does not exist. >>> >>> Please note that i am using the latest snapshot build of icing . >> >>Please post the output of >> >>icinga2 --version >> >>Kind regards, >>Michael >> >>> >>> Regards, >>> mgochhait >>> ---------------------------------------------------------------------- >>> >>> Message: 1 >>> Date: Sun, 15 Nov 2015 08:55:40 +0000 >>> From: Gunnar Beutner <[email protected]> >>> To: "[email protected]" <[email protected]> >>> Subject: Re: [icinga-users] Question about icinga2 api dynamically >>> added hosts and hostgroups >>> Message-ID: <[email protected]> >>> Content-Type: text/plain; charset="utf-8" >>> >>> >>> >>> >>> >>> >>> On 13/11/15 23:02, "icinga-users on behalf of Madhusmita Gochhait" >>> <[email protected] on behalf of [email protected]> >>> wrote: >>> >>>> After restart of icinga process , Icinga unable to query the hosts/groups >>>> objects through api . Icinga http returns object does not exist >>>> >>>> >>>> Here are the steps to simulate the issue (Single Node) >>>> >>>> >>>> Step 1: curl -k -s -u icingaadmin:icinga >>>> 'https://localhost:5665/v1/objects/hosts/10.102.58.77' -H "Accept: >>>> application/json" -X PUT -d '{ "templates": [ "generic-host" ], "attrs": { >>>> "address": "10.102.58.77?}} >>>> {"results":[{"code":200.0,"status":"Object was created"}]} >>>> Step 2 : query to icinga - curl -k -s -u icingaadmin:icinga >>>> 'https://localhost:5665/v1/objects/hosts/10.102.58.77' will result with >>>> detailed host output >>>> >>>> Step 3: Restart Icinga >>>> service icinga2 reload >>> >>> Works for me. Can you check whether the host?s config file was created?: >>> >>> acheron:icinga2 gunnar$ ls -l >>> ../i2/var/lib/icinga2/api/packages/_api/acheron-1445924979-1/conf.d/hosts/ >>> total 8 >>> -rw-r--r-- 1 gunnar staff 110 Nov 15 09:53 10.102.58.77.conf >>> acheron:icinga2 gunnar$ cat >>> ../i2/var/lib/icinga2/api/packages/_api/acheron-1445924979-1/conf.d/hosts/10.102.58.77.conf >>> object Host "10.102.58.77" { >>> import "generic-host" >>> >>> >>> address = "10.102.58.77" >>> version = 1447577614.982893 >>> } >>> acheron:icinga2 gunnar$ >>> >>> >>> >>>> >>>> >>>> Step 4: Host Query as detailed in Step 2 >>>> curl -k -s -u icingaadmin:icinga >>>> 'https://localhost:5665/v1/objects/hosts/10.102.58.77' >>>> Error: Object does not exist >>>> >>>> >>>> >>>> >>>> >>>> Similar behavior with host groups also . >>>> >>>> >>>> Thanks, >>>> mgochhait >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> From: Madhusmita Gochhait <[email protected]> >>>> Date: Tuesday, November 10, 2015 at 3:21 PM >>>> To: "[email protected]" <[email protected]> >>>> Subject: Question about icinga2 api dynamically added hosts and hostgroups >>>> >>>> >>>> >>>> I am using the snapshot version of icinga2 for the api feature . >>>> Dynamically add hosts and host groups. >>>> Here is what i am doing : >>>> To add hostgroup : curl -k -s -u icingaadmin:icinga >>>> 'https://localhost:5665/v1/objects/hostgroups/testgrp' -X PUT -d '{ >>>> "attrs": { "name" : "testgrp" ,"display_name" : "testgrp" >>>> , "state_loaded" :true }}' >>>> To add host : >>>> curl -k -s -u icingaadmin:icinga 'https://localhost:5665/v1/objects/hosts/ >>>> <https://localhost:5665/v1/objects/hosts/8.8.8.8>testhost' -X PUT -d '{ >>>> "templates": [ "generic-host" ], "attrs": { "address": "8.8.8.8" , >>>> "groups" : [ >>>> "testgrp" ]} }' >>>> It gets successfully added and I am also able to query them through the >>>> api . >>>> But in UI , I am seeing only the host and no hostgroup . >>>> The host group gets displayed once I restart/reload icinga . >>>> Since , we have a large setup (>1000 hosts ) , we don?t want to reload >>>> /restart everytime we add hostgroups . >>>> Is there any way it can be done in same way as the host , so that both >>>> host and host groups shows in UI without restart everytime ? >>>> >>>> >>>> Thanks, >>>> mgochhait >>>> >>>> >>>> >>>> <http://stackoverflow.com/questions/tagged/icinga> >>>> >>>> >>>> >>>> >>> >>> --? >>> Gunnar Beutner >>> Senior Developer >>> >>> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg >>> Tel: +49 911 92885-0 | Fax: +49 911 92885-77 >>> GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 >>> http://www.netways.de | [email protected] >>> >>> ** OSMC 2015 - November - netways.de/osmc ** >>> ** OSDC 2016 - April ? netways.de/osdc ** >>> >>> ------------------------------ >>> >>> Subject: Digest Footer >>> >>> _______________________________________________ >>> icinga-users mailing list >>> [email protected] >>> https://lists.icinga.org/mailman/listinfo/icinga-users >>> >>> >>> ------------------------------ >>> >>> End of icinga-users Digest, Vol 23, Issue 24 >>> ******************************************** >>> _______________________________________________ >>> icinga-users mailing list >>> [email protected] >>> https://lists.icinga.org/mailman/listinfo/icinga-users >> >> >>--? >>Michael Friedrich, DI (FH) >>Senior Developer >> >>NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg >>Tel: +49 911 92885-0 | Fax: +49 911 92885-77 >>GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 >>http://www.netways.de | [email protected] >> >>** OSMC 2015 - November - netways.de/osmc ** >>** OSDC 2016 - April ? netways.de/osdc ** >> >>------------------------------ >> >>Message: 3 >>Date: Sun, 15 Nov 2015 22:02:03 +0000 >>From: Madhusmita Gochhait <[email protected]> >>To: "[email protected]" <[email protected]> >>Subject: Re: [icinga-users] icinga-users Digest, Vol 23, Issue 25 >>Message-ID: >> >> <bn3pr0501mb1283807a1a4e4df5c8f6338eae...@bn3pr0501mb1283.namprd05.prod.outlook.com> >> >>Content-Type: text/plain; charset="iso-8859-1" >> >>I am using latest snapshot build ( compiled from the master branch in github) >>. >> >> >>root@icinga-cluster-2:~# icinga2 --version >>icinga2 - The Icinga 2 network monitoring daemon (version: r2.4.0-1) >> >>Copyright (c) 2012-2015 Icinga Development Team (https://www.icinga.org) >>License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html> >>This is free software: you are free to change and redistribute it. >>There is NO WARRANTY, to the extent permitted by law. >> >>Application information: >> Installation root: /usr/local >> Sysconf directory: /usr/local/etc >> Run directory: /usr/local/var/run >> Local state directory: /usr/local/var >> Package data directory: /usr/local/share/icinga2 >> State path: /usr/local/var/lib/icinga2/icinga2.state >> Modified attributes path: >> /usr/local/var/lib/icinga2/modified-attributes.conf >> Objects path: /usr/local/var/cache/icinga2/icinga2.debug >> Vars path: /usr/local/var/cache/icinga2/icinga2.vars >> PID path: /usr/local/var/run/icinga2/icinga2.pid >> >>System information: >> Operating system: Linux >> Operating system version: 3.13.0-32-generic >> Architecture: x86_64 >> Distribution: Ubuntu 14.04.1 LTS >> >>----------------------------- >> >>Message: 1 >>Date: Sun, 15 Nov 2015 11:39:36 +0000 >>From: Michael Friedrich <[email protected]> >>To: "[email protected]" <[email protected]> >>Subject: Re: [icinga-users] Question about icinga2 api dynamically >> added hosts and hostgroups >>Message-ID: <[email protected]> >>Content-Type: text/plain; charset="utf-8" >> >> >>> On 13 Nov 2015, at 23:02, Madhusmita Gochhait <[email protected]> wrote: >>> >>> After restart of icinga process , Icinga unable to query the hosts/groups >>> objects through api . Icinga http returns object does not exist >>> >>> Here are the steps to simulate the issue (Single Node) >>> >>> Step 1: curl -k -s -u icingaadmin:icinga >>> 'https://localhost:5665/v1/objects/hosts/10.102.58.77' -H "Accept: >>> application/json" -X PUT -d '{ "templates": [ "generic-host" ], "attrs": { >>> "address": "10.102.58.77?}} >>> {"results":[{"code":200.0,"status":"Object was created"}]} >>> Step 2 : query to icinga - curl -k -s -u icingaadmin:icinga >>> 'https://localhost:5665/v1/objects/hosts/10.102.58.77' will result with >>> detailed host output >>> >>> Step 3: Restart Icinga >>> service icinga2 reload >>> >>> Step 4: Host Query as detailed in Step 2 >>> curl -k -s -u icingaadmin:icinga >>> 'https://localhost:5665/v1/objects/hosts/10.102.58.77' >>> Error: Object does not exist >> >>I?m also unable to reproduce this here. >> >>michi@mbmif ~ $ icinga2 --version >>icinga2 - The Icinga 2 network monitoring daemon (version: >>v2.3.11-854-ge9db4bc; debug) >> >>Copyright (c) 2012-2015 Icinga Development Team (https://www.icinga.org) >>License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html> >>This is free software: you are free to change and redistribute it. >>There is NO WARRANTY, to the extent permitted by law. >> >>Application information: >> Installation root: /usr/local/icinga2 >> Sysconf directory: /usr/local/icinga2/etc >> Run directory: /usr/local/icinga2/var/run >> Local state directory: /usr/local/icinga2/var >> Package data directory: /usr/local/icinga2/share/icinga2 >> State path: /usr/local/icinga2/var/lib/icinga2/icinga2.state >> Modified attributes path: >> /usr/local/icinga2/var/lib/icinga2/modified-attributes.conf >> Objects path: /usr/local/icinga2/var/cache/icinga2/icinga2.debug >> Vars path: /usr/local/icinga2/var/cache/icinga2/icinga2.vars >> PID path: /usr/local/icinga2/var/run/icinga2/icinga2.pid >> >>System information: >> Operating system: Darwin >> Operating system version: 15.0.0 >> Architecture: x86_64 >> >> >>michi@mbmif ~ $ curl -k -s -u root:icinga -H 'Accept: application/json' -X >>PUT -d '{ "attrs": { "check_command": "hostalive", "address": "192.168.2.123" >>} }' 'https://localhost:5665/v1/objects/hosts/michiathome1' >>{"results":[{"code":200.0,"status":"Object was created"}]} >> >>[2015-11-15 12:32:31 +0100] information/ApiListener: New client connection >>(no client certificate) >>[2015-11-15 12:32:31 +0100] information/HttpServerConnection: Request: PUT >>/v1/objects/hosts/michiathome1 (root) >>[2015-11-15 12:32:31 +0100] information/ConfigCompiler: Compiling config >>file: >>/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/hosts/michiathome1.conf >>[2015-11-15 12:32:31 +0100] information/ConfigItem: Committing config items >> >>michi@mbmif ~ $ curl -k -s -u root:icinga >>'https://localhost:5665/v1/objects/hosts/michiathome1' >>{"results":[{"attrs":{"__name":"michiathome1","acknowledgement":0.0,"acknowledgement_expiry":0.0,"action_url":"","active":true,"address":"192.168.2.123","address6":"","check_attempt":1.0,"check_command":"hostalive","check_interval":300.0,"display_name":"michiathome1","enable_active_checks":true,"enable_event_handler":true,"enable_flapping":false,"enable_notifications":true,"enable_passive_checks":true,"enable_perfdata":true,"flapping":false,"flapping_last_change":0.0,"flapping_negative":0.0,"flapping_positive":0.0,"flapping_threshold":30.0,"force_next_check":false,"force_next_notification":false,"groups":[],"ha_mode":0.0,"icon_image":"","icon_image_alt":"","last_check":-1.0,"last_check_result":null,"last_hard_state":1.0,"last_hard_state_change":1447587016.4019169807,"last_in_downtime":false,"last_reachable":true,"last_state":1.0,"last_state_change":1447587016.4019169807,"last_state_down":0.0,"last_state_type":0.0,"last_state_unreachable":0.0,"last_state_up":0.0,"max_check_attempts" : > 3 >> .0,"name":"michiathome1","next_check":1447587300.0599999428,"notes":"","notes_url":"","original_attributes":null,"package":"_api","paused":false,"retry_interval":60.0,"state":1.0,"state_type":0.0,"templates":["michiathome1"],"type":"Host","vars":null,"version":1447587151.0631680489,"volatile":false,"zone":""},"joins":{},"meta":{},"name":"michiathome1","type":"Host"}]} >> >>michi@mbmif ~ $ sudo cat >>/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/hosts/michiathome1.conf >>object Host "michiathome1" { >>address = "192.168.2.123" >>check_command = "hostalive" >>version = 1447587151.063168 >>} >> >>michi@mbmif ~ $ sudo kill -HUP $(pidof icinga2) >> >>michi@mbmif ~ $ sudo cat >>/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/hosts/michiathome1.conf >>object Host "michiathome1" { >>address = "192.168.2.123" >>check_command = "hostalive" >>version = 1447587151.063168 >>} >> >>michi@mbmif ~ $ curl -k -s -u root:icinga >>'https://localhost:5665/v1/objects/hosts/michiathome1' >>{"results":[{"attrs":{"__name":"michiathome1","acknowledgement":0.0,"acknowledgement_expiry":0.0,"action_url":"","active":true,"address":"192.168.2.123","address6":"","check_attempt":1.0,"check_command":"hostalive","check_interval":300.0,"display_name":"michiathome1","enable_active_checks":true,"enable_event_handler":true,"enable_flapping":false,"enable_notifications":true,"enable_passive_checks":true,"enable_perfdata":true,"flapping":false,"flapping_last_change":1447587315.097356081,"flapping_negative":0.0,"flapping_positive":1447587315.0,"flapping_threshold":30.0,"force_next_check":false,"force_next_notification":false,"groups":[],"ha_mode":0.0,"icon_image":"","icon_image_alt":"","last_check":1447587315.096987009,"last_check_result":{"active":true,"check_source":"mbmif.int.netways.de","command":["/usr/local/sbin/check_ping","-H","192.168.2.123","-c","5000,100%","-w","3000,80%"],"execution_end":1447587315.0968000889,"execution_start":1447587300.0619831085,"exit_status":2.0,"output " > : >> "PING CRITICAL - Packet loss = >> 100%","performance_data":["rta=5000.000000ms;3000.000000;5000.000000;0.000000","pl=100%;80;100;0"],"schedule_end":1447587315.096987009,"schedule_start":1447587600.0599999428,"state":2.0,"type":"CheckResult","vars_after":{"attempt":1.0,"reachable":true,"state":2.0,"state_type":1.0},"vars_before":null},"last_hard_state":1.0,"last_hard_state_change":1447587315.096987009,"last_in_downtime":false,"last_reachable":true,"last_state":1.0,"last_state_change":1447587315.096987009,"last_state_down":0.0,"last_state_type":0.0,"last_state_unreachable":0.0,"last_state_up":0.0,"max_check_attempts":3.0,"name":"michiathome1","next_check":1447587599.129999876,"notes":"","notes_url":"","original_attributes":null,"package":"_api","paused":false,"retry_interval":60.0,"state":1.0,"state_type":1.0,"templates":["michiathome1"],"type":"Host","vars":null,"version":1447587151.0631680489,"volatile":false,"zone":""},"joins":{},"meta":{},"name":"michiathome1","type":"Host"}]} >> >> >>michi@mbmif ~ $ sudo mysql icinga -p -e 'select * from icinga_hoststatus hs >>join icinga_objects ohs on hs.host_object_id=ohs.object_id where >>ohs.name1="michiathome1" and ohs.is_active=1\G' >>Enter password: >>*************************** 1. row *************************** >> hoststatus_id: 643 >> instance_id: 1 >> host_object_id: 8940 >> status_update_time: 2015-11-15 12:35:58 >> output: PING CRITICAL - Packet loss = 100% >> long_output: >> perfdata: >> rta=5000.000000ms;3000.000000;5000.000000;0.000000 pl=100%;80;100;0 >> check_source: mbmif.int.netways.de >> current_state: 1 >> has_been_checked: 1 >> should_be_scheduled: 1 >> current_check_attempt: 1 >> max_check_attempts: 3 >> last_check: 2015-11-15 12:35:15 >> next_check: 2015-11-15 12:39:59 >> check_type: 0 >> last_state_change: 2015-11-15 12:35:15 >> last_hard_state_change: 2015-11-15 12:35:15 >> last_hard_state: 1 >> last_time_up: 0000-00-00 00:00:00 >> last_time_down: 0000-00-00 00:00:00 >> last_time_unreachable: 0000-00-00 00:00:00 >> state_type: 1 >> last_notification: 0000-00-00 00:00:00 >> next_notification: 0000-00-00 00:00:00 >> no_more_notifications: 0 >> notifications_enabled: 1 >>problem_has_been_acknowledged: 0 >> acknowledgement_type: 0 >> current_notification_number: 0 >> passive_checks_enabled: 1 >> active_checks_enabled: 1 >> event_handler_enabled: 1 >> flap_detection_enabled: 0 >> is_flapping: 0 >> percent_state_change: 0 >> latency: 0 >> execution_time: 15.034816980361938 >> scheduled_downtime_depth: 0 >> failure_prediction_enabled: 0 >> process_performance_data: 1 >> obsess_over_host: 0 >> modified_host_attributes: 0 >> event_handler: >> check_command: hostalive >> normal_check_interval: 5 >> retry_check_interval: 1 >> check_timeperiod_object_id: 0 >> is_reachable: 1 >> endpoint_object_id: 1 >> original_attributes: null >> object_id: 8940 >> instance_id: 1 >> objecttype_id: 1 >> name1: michiathome1 >> name2: NULL >> is_active: 1 >> >> >>> >>> >>> Similar behavior with host groups also . >>> >>> Thanks, >>> mgochhait >>> >>> >>> >>> >>> From: Madhusmita Gochhait <[email protected]> >>> Date: Tuesday, November 10, 2015 at 3:21 PM >>> To: "[email protected]" <[email protected]> >>> Subject: Question about icinga2 api dynamically added hosts and hostgroups >>> >>> I am using the snapshot version of icinga2 for the api feature . >>> Dynamically add hosts and host groups. >>> Here is what i am doing : >>> To add hostgroup : curl -k -s -u icingaadmin:icinga >>> 'https://localhost:5665/v1/objects/hostgroups/testgrp' -X PUT -d '{ >>> "attrs": { "name" : "testgrp" ,"display_name" : "testgrp" , "state_loaded" >>> :true }}' >>> To add host : >>> curl -k -s -u icingaadmin:icinga >>> 'https://localhost:5665/v1/objects/hosts/testhost' -X PUT -d '{ >>> "templates": [ "generic-host" ], "attrs": { "address": "8.8.8.8" , "groups" >>> : [ "testgrp" ]} }' >>> It gets successfully added and I am also able to query them through the >>> api . >>> But in UI , I am seeing only the host and no hostgroup . >>> The host group gets displayed once I restart/reload icinga . >>> Since , we have a large setup (>1000 hosts ) , we don?t want to reload >>> /restart everytime we add hostgroups . >>> Is there any way it can be done in same way as the host , so that both host >>> and host groups shows in UI without restart everytime ? >>> >>> Thanks, >>> mgochhait >>> >>> _______________________________________________ >>> icinga-users mailing list >>> [email protected] >>> https://lists.icinga.org/mailman/listinfo/icinga-users >> >> >>--? >>Michael Friedrich, DI (FH) >>Senior Developer >> >>NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg >>Tel: +49 911 92885-0 | Fax: +49 911 92885-77 >>GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 >>http://www.netways.de | [email protected] >> >>** OSMC 2015 - November - netways.de/osmc ** >>** OSDC 2016 - April ? netways.de/osdc ** >> >>------------------------------ >> >>Message: 2 >>Date: Sun, 15 Nov 2015 11:48:58 +0000 >>From: Michael Friedrich <[email protected]> >>To: "[email protected]" <[email protected]> >>Subject: Re: [icinga-users] Overriding Ping4 thresholds >>Message-ID: <[email protected]> >>Content-Type: text/plain; charset="utf-8" >> >> >>> On 12 Nov 2015, at 21:14, Lance Reed <[email protected]> wrote: >>> >>> I suspect my question has been answered multiple times in the past, >>> but I am not easily finding answers so here goes. >>> >>> I have multiple remote locations that use VPNs, so ping latency can >>> often go failure high and I get alerts on hosts and ping4 checks (the >>> default checks). >>> >>> We use multiple custom vars for things like location, and environment etc. >>> Because of this it was easy to setup in each hosts file created via >>> puppet to override hostalive. >>> >>> e.g. >>> >>> object Host "somehost.abcd.com" { >>> import "generic-host" >>> ... >>> vars.ping_wrta = "500" >>> vars.environment = "abcd" >>> vars.customer_monitored = "true" >>> vars.customer = "abcd" >>> vars.ping_cpl = "30" >>> } >>> >>> >>> That works well. However the default service checks are using default >>> attributes for ping4 which are not modified. >>> >>> I am wondering what people use to override default values for existing >>> service checks that get applied. >>> Or do I have to modify what type of check gets used in my host object >>> and make sure the correct one is used much like hostalive. I'd prefer >>> not to have any more Custom Vars added to each host object if >>> possible. >> >>I?d personally set these thresholds inside the service apply rules, and use >>the assign where/ignore where expressions to selectively apply certain >>services with different thresholds. Similar to what Thomas already posted. >> >>A different approach might also be to add conditionals inside your service >>apply rules, for example: >> >>apply Service ?ping4? { >> check_command = ?ping4? >> >> if (host.vars.customer == ?abcd?) { >> vars.ping_cpl = 50 >> } else if (host.vars.customer == ?efgh?) { >> vars.ping_cl = 30 >> } else { //default >> vars.ping_cpl = 40 >> } >> >> assign where host.address >>} >> >>Service apply rules may access all host configuration attributes, so you?re >>not bound to custom variables here. One could also match against the host >>name, or its display_name. >> >>Kind regards, >>Michael >> >> >>--? >>Michael Friedrich, DI (FH) >>Senior Developer >> >>NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg >>Tel: +49 911 92885-0 | Fax: +49 911 92885-77 >>GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 >>http://www.netways.de | [email protected] >> >>** OSMC 2015 - November - netways.de/osmc ** >>** OSDC 2016 - April ? netways.de/osdc ** >> >>------------------------------ >> >>Message: 3 >>Date: Sun, 15 Nov 2015 18:44:55 +0000 >>From: Madhusmita Gochhait <[email protected]> >>To: "[email protected]" <[email protected]> >>Subject: Re: [icinga-users] Question about icinga2 api dynamically >> added hosts and hostgroups >>Message-ID: >> >> <bn3pr0501mb1283dcd485cbe5fa7815d74fae...@bn3pr0501mb1283.namprd05.prod.outlook.com> >> >>Content-Type: text/plain; charset="iso-8859-1" >> >>The host config file was created . >> >>ls -ltr /usr/local/var/lib/icinga2/api/packages/_api/conf.d/hosts/ >>total 4 >>-rw-r--r-- 1 icinga icinga 110 Nov 15 10:29 10.102.58.77.conf >> >>But not able to query , after restart of icinga process. >> >>curl -k -s -u icingaadmin:icinga >>'https://localhost:5665/v1/objects/hosts/10.102.58.77' >>Error: Object does not exist. >> >>Please note that i am using the latest snapshot build of icinag2 . >> >>Regards, >>mgochhait >>---------------------------------------------------------------------- >> >>Message: 1 >>Date: Sun, 15 Nov 2015 08:55:40 +0000 >>From: Gunnar Beutner <[email protected]> >>To: "[email protected]" <[email protected]> >>Subject: Re: [icinga-users] Question about icinga2 api dynamically >> added hosts and hostgroups >>Message-ID: <[email protected]> >>Content-Type: text/plain; charset="utf-8" >> >> >> >> >> >> >>On 13/11/15 23:02, "icinga-users on behalf of Madhusmita Gochhait" >><[email protected] on behalf of [email protected]> >>wrote: >> >>>After restart of icinga process , Icinga unable to query the hosts/groups >>>objects through api . Icinga http returns object does not exist >>> >>> >>>Here are the steps to simulate the issue (Single Node) >>> >>> >>>Step 1: curl -k -s -u icingaadmin:icinga >>>'https://localhost:5665/v1/objects/hosts/10.102.58.77' -H "Accept: >>>application/json" -X PUT -d '{ "templates": [ "generic-host" ], "attrs": { >>>"address": "10.102.58.77?}} >>> {"results":[{"code":200.0,"status":"Object was created"}]} >>>Step 2 : query to icinga - curl -k -s -u icingaadmin:icinga >>>'https://localhost:5665/v1/objects/hosts/10.102.58.77' will result with >>>detailed host output >>> >>>Step 3: Restart Icinga >>> service icinga2 reload >> >>Works for me. Can you check whether the host?s config file was created?: >> >>acheron:icinga2 gunnar$ ls -l >>../i2/var/lib/icinga2/api/packages/_api/acheron-1445924979-1/conf.d/hosts/ >>total 8 >>-rw-r--r-- 1 gunnar staff 110 Nov 15 09:53 10.102.58.77.conf >>acheron:icinga2 gunnar$ cat >>../i2/var/lib/icinga2/api/packages/_api/acheron-1445924979-1/conf.d/hosts/10.102.58.77.conf >>object Host "10.102.58.77" { >>import "generic-host" >> >> >>address = "10.102.58.77" >>version = 1447577614.982893 >>} >>acheron:icinga2 gunnar$ >> >> >> >>> >>> >>>Step 4: Host Query as detailed in Step 2 >>>curl -k -s -u icingaadmin:icinga >>>'https://localhost:5665/v1/objects/hosts/10.102.58.77' >>>Error: Object does not exist >>> >>> >>> >>> >>> >>>Similar behavior with host groups also . >>> >>> >>>Thanks, >>>mgochhait >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>From: Madhusmita Gochhait <[email protected]> >>>Date: Tuesday, November 10, 2015 at 3:21 PM >>>To: "[email protected]" <[email protected]> >>>Subject: Question about icinga2 api dynamically added hosts and hostgroups >>> >>> >>> >>>I am using the snapshot version of icinga2 for the api feature . Dynamically >>>add hosts and host groups. >>>Here is what i am doing : >>>To add hostgroup : curl -k -s -u icingaadmin:icinga >>>'https://localhost:5665/v1/objects/hostgroups/testgrp' -X PUT -d '{ "attrs": >>>{ "name" : "testgrp" ,"display_name" : "testgrp" >>> , "state_loaded" :true }}' >>>To add host : >>>curl -k -s -u icingaadmin:icinga 'https://localhost:5665/v1/objects/hosts/ >>><https://localhost:5665/v1/objects/hosts/8.8.8.8>testhost' -X PUT -d '{ >>>"templates": [ "generic-host" ], "attrs": { "address": "8.8.8.8" , "groups" >>>: [ >>> "testgrp" ]} }' >>>It gets successfully added and I am also able to query them through the >>>api . >>>But in UI , I am seeing only the host and no hostgroup . >>>The host group gets displayed once I restart/reload icinga . >>>Since , we have a large setup (>1000 hosts ) , we don?t want to reload >>>/restart everytime we add hostgroups . >>>Is there any way it can be done in same way as the host , so that both host >>>and host groups shows in UI without restart everytime ? >>> >>> >>>Thanks, >>>mgochhait >>> >>> >>> >>> <http://stackoverflow.com/questions/tagged/icinga> >>> >>> >>> >>> >> >>--? >>Gunnar Beutner >>Senior Developer >> >>NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg >>Tel: +49 911 92885-0 | Fax: +49 911 92885-77 >>GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 >>http://www.netways.de | [email protected] >> >>** OSMC 2015 - November - netways.de/osmc ** >>** OSDC 2016 - April ? netways.de/osdc ** >> >>------------------------------ >> >>Subject: Digest Footer >> >>_______________________________________________ >>icinga-users mailing list >>[email protected] >>https://lists.icinga.org/mailman/listinfo/icinga-users >> >> >>------------------------------ >> >>End of icinga-users Digest, Vol 23, Issue 24 >>******************************************** >> >> >>------------------------------ >> >>Subject: Digest Footer >> >>_______________________________________________ >>icinga-users mailing list >>[email protected] >>https://lists.icinga.org/mailman/listinfo/icinga-users >> >> >>------------------------------ >> >>End of icinga-users Digest, Vol 23, Issue 25 >>******************************************** >> >> >>------------------------------ >> >>Subject: Digest Footer >> >>_______________________________________________ >>icinga-users mailing list >>[email protected] >>https://lists.icinga.org/mailman/listinfo/icinga-users >> >> >>------------------------------ >> >>End of icinga-users Digest, Vol 23, Issue 26 >>******************************************** >>_______________________________________________ >>icinga-users mailing list >>[email protected] >>https://lists.icinga.org/mailman/listinfo/icinga-users >> > >--? >Gunnar Beutner >Senior Developer > >NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg >Tel: +49 911 92885-0 | Fax: +49 911 92885-77 >GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 >http://www.netways.de | [email protected] > >** OSMC 2015 - November - netways.de/osmc ** >** OSDC 2016 - April ? netways.de/osdc ** > >------------------------------ > >Subject: Digest Footer > >_______________________________________________ >icinga-users mailing list >[email protected] >https://lists.icinga.org/mailman/listinfo/icinga-users > > >------------------------------ > >End of icinga-users Digest, Vol 23, Issue 28 >******************************************** _______________________________________________ icinga-users mailing list [email protected] https://lists.icinga.org/mailman/listinfo/icinga-users
