Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
[dev.icinga.com #10867] "repository add" cli command writes invalid "type" attribute #3787
This issue has been migrated from Redmine: https://dev.icinga.com/issues/10867
Created by ToMMy on 2015-12-16 14:31:24 +00:00
Using standard Centos 7 + icinga2 2.4.1 + icingaweb2 latest from repository.
The problem shows up when you try to generate a host .conf in the repository. I'll show example to reproduce the problem but i must say that i need to do this because i need some custom vars to be added in the host object code block ( i match my custom vars with some templates and dependencies ).
see the vars.os ?? i need to add custom vars in this examples is one but i need many AND this is working well !
The error detail shown by "systemctl status icinga2.service -l " is:
After MANUALLY edit the /etc/icinga2/repository.d/hosts/NODENAME.conf file and removing the Type = host entry ... the reload works well....
2015-12-17 09:20:41 +00:00 by mfriedrich af3458d
2016-02-23 08:16:47 +00:00 by mfriedrich 9de34e0
Updated by ToMMy on 2015-12-16 14:44:02 +00:00
Also the CLI icinga2 node add NODENAME should have the possibility to append custom vars !! as the "icinga2 repository host add name="" ... let's say i would like to manually add an "host" that doesn't have the agent ... ( ES: A PFSense FW host or a Cisco router )
So the "icinga2 node update-config" just works as expected without the need to MANUALLY write confs, zones, services, etc... OR do it with the DELETE the standard file + work with "icinga2 repository host add etc... " this is just A LOT of user work that makes DIFFICULT for most people to adopt icinga2 for big envs.... nobody is going to hand-write the conf files for hundreds of VMs or Appliances...
What a sysadmin can do is to automate some cli commands with custom scripts and work with the template design that is brilliant... ok i think i've say everything hope this is going to be solved soon !... for now i am trying to build some scripts with python to work-around the main problem of the ticket ...
Thank you !
Updated by mfriedrich on 2015-12-17 09:21:32 +00:00
I've updated the bug description, if you'll have additional feature requests please open separate issues. But rest assured, the "repository add" functionality won't be enhanced since we now have the REST API in place.
I've pushed a fix to master, please verify that working.
Updated by ToMMy on 2015-12-17 13:15:29 +00:00
Thank you for the quick fix !!!
i was unable to test right now because i get errors compiling... i tried to build the RPM but it doesn't work.. i don't have much time right now to full debug my env but I'm shure the bug is fixed ...i'll just wait for an official rpm to be released .. for now i've found a work-around via self-made external script.
Ok i'll ask the new feature in a new request... i saw the REST API and i tested them .. but the files inside /etc/repository.d/ are not get modified.. the data is modified but not the files in the repo. This way... can make a lot of confusion because "half" of the conf is inside the repository.d files.. and "half" is managed by the api and as now only humans-visible via icingaweb2 ( or via api calls...wich return hard-to-read jsons )
So to view the complete configuration of a monitored node you have to "MIX" what's returned by api calls WITH the comparison on what you've got in the repos files ???
For example... if i have vars.os="Centos 6" in a host file definition inside /etc/icinga2/repository.d/host/NODE.conf and the i modify this value via api ( let's say i change this var to vars.os="Windows" ) .. in the file i keep seeing "Centos 6" ... in icingaweb2 i correctly see "Windows"
WOW.... quite a lot of HARD work for standard users without a managing tool yet released....you always have to CHECK everything before make changes ... this can turn into hell for people don't have time to write an own front-end/set of scripts to manage AND CHECK ...everything
That's why i beleve it' would be simpler for now to extend the " icinga2 repository host add " possibility to append custom vars ALSO to the " icinga2 node add" command ( and include this in the official docs ) ... because as of now... i beleve people are 90% using CLI Commands or EDITING FILES to add nodes...not the api as official documentation.
Untill the release of the icinga2 module director i prefer to keep everything in the repos files ..so it's easy for collabs to interact with them and avoid as hell the use of REST-API for now... after the release of the director it will make sense then i'll want to convert everything i have in the repo files ---> to director format .. also via api calls would be ok..but an automatic import of the current conf is needed ( hope this feature WILL be included .. if not would be quite useless !! NOBODY EVER WOULD REWRITE FROM SCRATCH ALL THE CONFS USING THE NEW TOOL...make the import possibile pls (:prey:) )
Pick this just like a feedback i'll open a feature request with this later on.
Thank you very much for your work !