Commit f7494fa7 authored by Volodymyr Melnyk's avatar Volodymyr Melnyk

:-)

parent f0754f8f
......@@ -7,6 +7,10 @@ PATH=/bin:/usr/bin
io_stats_dir="${_spool_dir}/io"
io_stats_timestamp="${io_stats_dir}/.timestamp"
_log_file="${_log_dir}/save_io_stats.log"
_log 1 "On duty!"
while :; do
touch "${io_stats_timestamp}"
......
......@@ -10,6 +10,10 @@ mib="${_mib_root}.10"
act="${1}"
req="${2}"
_log_file="${_log_dir}/snmp_stats.log"
_log 1 "${act} ${req} requested"
instance_number="${req#${mib}}"
instance_number="${instance_number#.}"
......
......@@ -3,12 +3,13 @@ _exit_status_error=2
_exit_status="${_exit_status_ok}"
_root_dir='/opt/snmp_stats'
_lib_dir="${_root_dir}/lib"
_log_dir="${_root_dir}/log"
_var_dir="${_root_dir}/var"
_log_dir="${_var_dir}/log"
_lock_dir="${_var_dir}/run"
_spool_dir="${_var_dir}/spool"
_share_dir="${_root_dir}/share"
_mib_root=".1.3.6.1.4.1.53033.100"
_log_file="${_log_dir}/snmp_stats.log"
trap "exit ${_exit_status_error}" TERM
_top_pid="${$}"
......
......@@ -4,6 +4,12 @@ PATH=/bin
. /opt/snmp_stats/lib/common.sh
if [[ ! -f "${_log_spool}" ]]; then
mkdir -p "${_log_spool}"
chown root:nobody "${_log_spool}"
chmod 0770 "${_log_spool}"
fi
systemd_service_config='/etc/systemd/system/save_io_stats.service'
if [[ ! -f "${systemd_service_config}" ]]; then
_log 1 "Installing systemd service configuration file"
......@@ -12,10 +18,16 @@ fi
sudoers_config='/etc/sudoers.d/save_io_stats'
if [[ ! -f "${sudoers_config}" ]]; then
_log 1 "Installing sudoers configuration file"
_log 1 "Installing sudoers configuration snippet"
cat "${_share_dir}/sudoers/save_io_stats" >"${sudoers_config}"
fi
logrotate_config='/etc/logrotate.d/snmp_stats'
if [[ ! -f "${logrotate_config}" ]]; then
_log 1 "Installing logrotate configuration snippet"
cat "${_share_dir}/logrotate/snmp_stats" >"${logrotate_config}"
fi
io_stats_spool="${_spool_dir}/io"
if [[ ! -f "${io_stats_spool}" ]]; then
_log 1 "Creating the spool directory"
......
/opt/snmp_stats/var/log/*
{
missingok
su nobody
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment