#!/bin/bash # Check if the script is running on macOS if [[ "$(uname)" != "Darwin" ]]; then echo "This script is designed to run on macOS." exit 1 fi # Check if Homebrew is installed if ! command -v brew &> /dev/null; then echo "Homebrew is not installed. Installing Homebrew..." /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi # Install SNMP tools echo "Installing SNMP tools via Homebrew..." brew install net-snmp # Prompt for user input echo "Enter the SNMPv3 username (e.g., admin):" read SNMP_USER echo "Enter the SNMPv3 password:" read -s SNMP_PASSWORD echo "Re-enter the SNMPv3 password:" read -s SNMP_PASSWORD_CONFIRM # Verify password confirmation if [ "$SNMP_PASSWORD" != "$SNMP_PASSWORD_CONFIRM" ]; then echo "Passwords do not match. Exiting." exit 1 fi echo "Enter the system location (e.g., Office):" read SYS_LOCATION echo "Enter the system contact (e.g., admin@example.com):" read SYS_CONTACT # Configure SNMPv3 echo "Configuring SNMPv3..." SNMP_CONF="/usr/local/etc/snmp/snmpd.conf" sudo mkdir -p /usr/local/etc/snmp cat <