commit 13e8011d6b0cefdf9d24dcee4694e9edd921c7ec Author: Kuro Date: Sun Jul 20 01:01:45 2025 +0200 initial commit diff --git a/nagiosToZabbixConverter.sh b/nagiosToZabbixConverter.sh new file mode 100644 index 0000000..b5b5d38 --- /dev/null +++ b/nagiosToZabbixConverter.sh @@ -0,0 +1,272 @@ +#!/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" <