Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Volodymyr Melnyk
snmp_stats
Commits
f31a2c08
Commit
f31a2c08
authored
Nov 26, 2018
by
Volodymyr Melnyk
Browse files
Fix another bug
parent
d240faa8
Changes
3
Hide whitespace changes
Inline
Side-by-side
bin/snmp_io_stats.sh
View file @
f31a2c08
#!/bin/bash
PATH
=
/bin
PATH
=
/bin
:/usr/bin
.
/opt/snmp_stats/lib/common.sh
...
...
@@ -12,7 +12,7 @@ req="${2}"
_log_file
=
"
${
_log_dir
}
/snmp_io_stats.log"
_log
1
"
${
act
}
${
req
}
requested"
_log
0
"
${
act
}
${
req
}
requested"
instance_number
=
"
${
req
#
${
mib
}}
"
instance_number
=
"
${
instance_number
#.
}
"
...
...
@@ -43,4 +43,3 @@ if [[ -f "${io_stats_dir}/${instance_number}" ]]; then
echo
"integer"
echo
"
$(
printf
'%0.f'
"
${
io_stats_w
}
"
)
"
fi
lib/common.sh
View file @
f31a2c08
...
...
@@ -8,8 +8,8 @@ _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"
_mib_root
=
".1.3.6.1.4.1.53033.100"
trap
"exit
${
_exit_status_error
}
"
TERM
_top_pid
=
"
${
$}
"
...
...
sbin/install.sh
View file @
f31a2c08
...
...
@@ -10,30 +10,32 @@ if [[ ! -f "${_log_dir}" ]]; then
chmod
0770
"
${
_log_dir
}
"
fi
_log_file
=
'/dev/null'
systemd_service_config
=
'/etc/systemd/system/save_io_stats.service'
if
[[
!
-f
"
${
systemd_service_config
}
"
]]
;
then
_log
0
"Installing systemd service configuration file"
_log
1
"Installing systemd service configuration file"
cat
"
${
_share_dir
}
/systemd/save_io_stats.service"
>
"
${
systemd_service_config
}
"
fi
sudoers_config
=
'/etc/sudoers.d/save_io_stats'
if
[[
!
-f
"
${
sudoers_config
}
"
]]
;
then
_log
0
"Installing sudoers configuration snippet"
_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
0
"Installing logrotate configuration snippet"
_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
0
"Creating the spool directory"
_log
1
"Creating the spool directory"
mkdir
-p
"
${
io_stats_spool
}
"
chown
root:nobody
"
${
io_stats_spool
}
"
chmod
0770
"
${
io_stats_spool
}
"
fi
_log
0
"Installation steps have been completed"
_log
1
"Installation steps have been completed"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment