Bulk Import To Multiple Subfolders

CMK version: CRE 2.1.0p22
OS version:RHEL 8.5

Hi All,

So I read through the article on Host Administration and came acrods this section : 6. Importing hosts from CSV data

It describe a method to bulk import hosts by using CSV file. I have tested it in my test environment successfully. I noticed however that there is no way to import into multiple subfolders. It seems to support only a folder at a time.

The procedure is as follows: Select or create a folder into which the import should take place. Navigate to this folder (Setup > Hosts > …​) and in the Hosts menu select the entry Icon to import multiple hosts in CSV file format. Import hosts via CSV file.

The only other way I know of to perform this bulk host adding to multiple subfolders is via the REST API. How I would do it is by create a text file similar to the CSV file used in the bulk import then loop the create host process from top to end of the lines in the host list file.

I would like to cinform if my understanding is correct on this before I begin working on the bulk add script. Appreciate any feedback / tips / further advise that you have to share.

Thank you.

Best Regards,

Chris

The best way to import data to different subfolder is ti use the RestAPI for this. There you will beable to qualify your host for import based on folter, tags, labels aso.

Rg, Christian

2 Likes

I haven’t read the full post, but why not split your CSVs into several files and import them folder by folder?

… or use the script wato_import.py from the directory share/doc/check_mk/treasures?

Karl

2 Likes

Hi All,

Sorry taking a while to reply.

@ChristianM : Thanks. I suspect as much. Currently working on a bash script to do that.

@robin.gierse : I am trying to understand the way things works, anticipating mgmt’s questions. btw, I am the CMK champion here in my company.

@kdeutsch : Thanks for the recommendation. I am learning Python right now. Will look through it once I’ve achieve some level of mastery :smiley:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.