Invalid Foldername while Foldername correct


I’m adding new Hosts using the Check MK’s Web API in a python script.
Still facing a weird problem when adding hosts and creating them into folders.

Code looks like that:
ip_addr = str(ip_addresses[x])
folder_name = str(ordner[x])

I’m reading the informations from a excel file, which is working very well.
In my case, the foldername is named “Workstations”, it brings me the error “Invalid foldername. Only the characters a-z,A-Z,0-9, _ and - are allowed”

The question is - my folder’s name doesn’t contain any other characters as mentioned in the error message - you can see there are only Lower and upper-characters.

Where’s the problem and how can I fix it?
(I don’t have this problem every time, the error randomly appears)

The folder name to use in WATO’s API is not the visible folder from the web GUI but the internal folder name from the directory on the command line. The WATO GUI lowercases all folder names so the name you have to use is likely “workstations”.
But it could also be a random software bug.

For me, it looks like a software bug because its coming randomly and lowercase names doesn’t change the problem, but now - randomly - it works again…

1 Like

Are you working with the full path to the folder? If I remember correctly you have to use the full path from main directory starting at API calls.

Do you mean like this: “/Foldername” ?

I mean folder1/subfolder1/subfolder2. You can check the correct foldername inside your wato configuration on the operating system. It have to be ecactly the same path like inside ~site/etc/check_mk/conf.d/wato/.

Additionally you can also use the get_all_folders function to get a full and correct list of your folders.