diff --git a/README.md b/README.md index 43ef3c5..43ed93e 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,8 @@ If you want json output just use *--json* flag ```bash sentinel --status --json ``` +* Notice that every storage usage displays in KB not just bytes. +* Notice that every cpu usage displays in percents. ## Control Sentinel To control Sentinel you just need to call sentinel command with special files diff --git a/src/env.bash b/src/env.bash index 740684f..a19ddb1 100644 --- a/src/env.bash +++ b/src/env.bash @@ -1,5 +1,5 @@ #!/bin/bash -export VERSION='0.3.1' +export VERSION='0.3.2' export CHECK_TIMEOUT=3 export TASKS_DIR=$(readlink -f './tasks') export WORK_DIR=$(readlink -f './proc') diff --git a/src/status-json.bash b/src/status-json.bash index e5b31ba..2f8d6ba 100644 --- a/src/status-json.bash +++ b/src/status-json.bash @@ -32,15 +32,15 @@ display_system_status() { print_json_key 'cpu_nice' "$(get_system_cpu_nice)" print_json_key 'cpu_idle' "$(get_system_cpu_idle)" print_json_key 'cpu_wait' "$(get_system_cpu_wait)" - print_json_key 'memory_usage' "$(get_system_memory_usage)K" + print_json_key 'memory_usage' "$(get_system_memory_usage)" print_json_key 'memory_usage_percent' "$(( $(get_system_memory_usage) * 100 / $(get_system_total_memory) ))" - print_json_key 'memory_total' "$(get_system_total_memory)K" - print_json_key 'memory_free' "$(get_system_free_memory)K" - print_json_key 'memory_cached' "$(get_system_cached_memory)K" - print_json_key 'swap_usage' "$(get_system_swap_usage)K" + print_json_key 'memory_total' "$(get_system_total_memory)" + print_json_key 'memory_free' "$(get_system_free_memory)" + print_json_key 'memory_cached' "$(get_system_cached_memory)" + print_json_key 'swap_usage' "$(get_system_swap_usage)" print_json_key 'swap_usage_percent' "$(( $(get_system_swap_usage) * 100 / $TOTAL_SWAP ))" - print_json_key 'swap_total' "${TOTAL_SWAP}K" - print_json_key 'swap_free' "$(get_system_free_swap)K" + print_json_key 'swap_total' "${TOTAL_SWAP}" + print_json_key 'swap_free' "$(get_system_free_swap)" task_count=$(ls $TASKS_DIR | wc -l) print_json_key 'task_count' "$task_count" @@ -93,12 +93,12 @@ display_task_status() { print_json_key 'uid' "$(get_uid $pid)" print_json_key 'gid' "$(get_gid $pid)" - print_json_key 'cpu' "$(get_cpu_usage $pid)%" - print_json_key 'memory_usage' "$(get_memory_usage $pid)K" + print_json_key 'cpu_usage' "$(get_cpu_usage $pid)" + print_json_key 'memory_usage' "$(get_memory_usage $pid)" print_json_key 'memory_usage_percent' "$(( $(get_memory_usage $pid) * 100 / $(get_system_total_memory) ))" - print_json_key 'memory_peak' "$(get_memory_peak_usage $pid)K" + print_json_key 'memory_peak' "$(get_memory_peak_usage $pid)" - print_json_key 'swap_usage' "$(get_swap_usage $pid)K" + print_json_key 'swap_usage' "$(get_swap_usage $pid)" print_json_key 'swap_usage_percent' "$(( $(get_swap_usage $pid) / $TOTAL_SWAP))" uptime_ts=$(( $(date +%s) - $(stat --printf='%Y' $pid_file) ))