#!/bin/sh
#
#
# Univention Nagios Plugin
#  check_univention_smtp: check smtp status
#
# SPDX-FileCopyrightText: 2007-2025 Univention GmbH
# SPDX-License-Identifier: AGPL-3.0-only
#
#
eval "$(/usr/sbin/univention-config-registry shell hostname domainname mail/postfix/inet/interfaces)"

address="$hostname.$domainname"
if [ -n "$mail_postfix_inet_interfaces" ]; then
	if [ "$mail_postfix_inet_interfaces" = "127.0.0.1" ]; then
		address=127.0.0.1
	fi
fi

exec /usr/lib/nagios/plugins/check_smtp -H "$address"
