#!/bin/bash # --- IMPORTANT: Configure your Nagios config path here --- NAGIOS_CFG_PATH="/etc/nagios/nagios.cfg" # This path is now updated based on your input. # Output files - Bash will manage these for Python ZABBIX_HOSTGROUPS_OUTPUT="zabbix_hostgroups.txt" ZABBIX_HOSTS_OUTPUT="zabbix_hosts.txt" ZABBIX_COMMANDS_OUTPUT="zabbix_commands.txt" # This will now contain JSON ZABBIX_SERVICES_RAW_OUTPUT="zabbix_services_raw.txt" ZABBIX_INCLUDED_FILES_LOG="nagios_parsed_files.log" echo "--- Nagios to Zabbix Export Script (Bash wrapper for Python) ---" echo "Starting parsing from: $NAGIOS_CFG_PATH" echo "" # Check if Python3 is available if ! command -v python3 &> /dev/null then echo "Error: python3 could not be found. Please install it." exit 1 fi # Check if the Nagios config file exists if [[ ! -f "$NAGIOS_CFG_PATH" ]]; then echo "Error: Main Nagios config file not found at $NAGIOS_CFG_PATH" echo "Please update NAGIOS_CFG_PATH in the script if it's incorrect." exit 1 fi # Run the embedded Python script python3 - "$NAGIOS_CFG_PATH" <