Icinga2 API - How to append files into an active stage

  • Hello,


    After reading API chapter in the documentation, I have the following understanding:


    Create a package

    Code
    1. POST https://server:5665/v1/config/packages/:package_name

    Add new files

    Code
    1. POST https://panigale:5665/v1/config/stages/:package_name
    2. {
    3. "files": {
    4. ":file_name1" : ":config_file1_content",
    5. ":file_name2" : ":config_file2_content"
    6. }
    7. }


    But if I call it again, a new stage will be created with only the file_name3 :(

    Code
    1. POST https://panigale:5665/v1/config/stages/:package_name
    2. {
    3. "files": {
    4. ":file_name3" : ":config_file3_content"
    5. }
    6. }

    Is there way to add new files to the current actived stage ?


    Cheers,


    Kelson

  • You need to fetch the current stage, amend the changes and commit a new stage to the package. There's no such update mechanism for packages and stages.

  • Is that correct to work like this ?



    Concerning packages, what's recommanded to do ?

    1. A package per zone ?
    2. A package per node

    The post was edited 1 time, last by Kels ().

  • POST needs to be PUT (create, not modify).


    I'd recommend to use just one config package, similar to how the Director manages to do so.

  • OK I will update my API requests, thanks.


    Just to be sure, will we reach some kind of limit size or perfomance issues for REST request if we work only with one package ?

    PHP and Apaches have post max size config vars.

  • Icinga 2's API is not a full webserver replacement. Therefore I'd suggest to test-drive performance in a test lab, and see whether it holds against your planned deployment, or if multiple packages make more sense.