nagios-rpm-macros/macros.nagios

79 lines
2.4 KiB
Plaintext
Raw Normal View History

# macros.nagios file
# macros for Nagios and Icinga (sub-)package building - handle with care
#
#
# directories
#
# install all plugins into this directory
%nagios_plugindir %{_prefix}/lib/nagios/plugins
# install all event handler scripts into this directory
%nagios_eventhandlerdir %{_prefix}/lib/nagios/plugins/eventhandler
# files like p1.pl are located directly in this directory
%nagios_libdir %{_prefix}/lib/nagios
# Nagios uses this directory for status files
%nagios_localstatedir %{_var}/lib/nagios
# Nagios configuration should be stored here
%nagios_sysconfdir %{_sysconfdir}/nagios
# Nagios static webpages, stylesheets and theme(s), online documentation
%nagios_datadir %{_datadir}/nagios
# Nagios spool dir (checkresult-dir)
%nagios_spooldir %{_var}/spool/nagios
# Nagios logfile dir
%nagios_logdir %{_var}/log/nagios
# Nagios cgi directory
%nagios_cgidir %{_prefix}/lib/nagios/cgi
#
# NRPE
#
%nrpe_sysconfdir %{_sysconfdir}/nrpe.d
#
# Monitoring Plugins
#
%plugin_confdir %{_sysconfdir}/monitoring-plugins
#
# files
#
# This is the file that Nagios checks for external command requests
%nagios_command_file %{_var}/spool/nagios/nagios.cmd
# This is where the current status of all monitored services and
# hosts is stored.
%nagios_status_file %{_var}/lib/nagios/status.dat
# This is the file that Nagios should use to store host and
# service state information before it shuts down.
%nagios_state_retention_file %{_var}/lib/nagios/retention.dat
#
# users and groups
#
# User, Nagios runs under
%nagios_user nagios
# Group, Nagios runs under
%nagios_group nagios
# User, that can execute commands via %{nagios_command_file}
%nagios_command_user wwwrun
# Group, that can execute commands via %{nagios_command_file}
%nagios_command_group nagcmd
# Add Nagios user and groups
%nagios_user_group_add() \
/usr/sbin/groupadd -r %{nagios_group} 2>/dev/null || :\
/usr/sbin/useradd -r -g %{nagios_group} -d %{nagios_localstatedir} -s /bin/false -c "User for Nagios" %{nagios_user} 2>/dev/null || :\
%{nil}
%nagios_command_user_group_add() \
/usr/sbin/groupadd -r %{nagios_command_group} 2>/dev/null || :\
%if 0%{?suse_version} > 01220 \
/usr/sbin/usermod -a -G %{nagios_command_group} %{nagios_user} || :\
%else \
/usr/sbin/groupmod -A %{nagios_user} %{nagios_command_group} 2>/dev/null || :\
%endif \
%{nil}