How to change the default sidebar snapins for new users

Hello Simon

we use one main file (SIDEBAR_FILE / sidebar.mk):
Content of sidebar.mk:

{'fold': False,
 'snapins': [('tactical_overview', 'open'),
         ('search', 'open'),
         ('views', 'open'),
         ('bookmarks', 'open'),
         ('biaggr_groups', 'open'),
         ('tag_tree', 'open')]}

This file we’ve customized and it will be distributed via bash scrip:

USER_DIR="/opt/omd/sites/${OMD_SITE}/var/check_mk/web/"
EXCLUDE_USERS_FILE="/opt/wwi/wwi_scripts/sidebar/exclude_users.txt"
SIDEBAR_FILE="/opt/wwi/wwi_scripts/sidebar/sidebar.mk"
for USER_FOLDER in $(ls $USER_DIR|grep -v "^adm"|grep -v "^automation"); do	
# check the excluded users
# -----------------------------
EXCLUDE_USER=$(grep $USER_FOLDER $EXCLUDE_USERS_FILE|tail -1)
if [ "$EXCLUDE_USER" != "$USER_FOLDER" ]; then
	
	# copy only in folders
	# -----------------------------
	if [ ! -f "${USER_DIR}${USER_FOLDER}" ] && [ -d "${USER_DIR}${USER_FOLDER}" ]; then
		cp $SIDEBAR_FILE $USER_DIR""$USER_FOLDER"/"
	fi

fi
done

I hope it helps.

Best regards
Jan-Philipp

2 Likes