include/util.h: prevent multiple inclusion of header

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
common: util: add get_fs_stats() function

simplifies the task of obtaining available/used disk space, as well as
used available percentage.

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
mon: DataHealthService: use get_fs_stats() instead

and relieve the DataStats struct from clutter by using
ceph_data_stats_t instead of multiple fields.

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
ceph_mon: check available storage space for mon data dir on start

error out if available storage space is below 'mon data avail crit'

Fixes: #9502

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
common: LogEntry: if channel is missing, default to "cluster"

Keeps backward compatibility when there are entities that do not know
what a channel is.  This way we ensure that those messages are logged as
they were expected to be before channels were introduced: to the cluster
log.

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
mon: LogMonitor: appropriately expand channel meta variables

We must only expand the log file's channel meta variables upon requiring
a channel's log file.  As we may have a 'default' channel that will
cover all channels, we must wait to expand channels as they come in and
do so if they haven't yet been expanded.  Expanding the 'log_file' in
place would have the unfortunate side effect of expanding, say,

default=/tmp/whatever.$channel.log

to

default=/tmp/whatever.default.log

which would not be what we wanted upon receiving a message that should
go into channel 'foo' -- assuming we specified no such channel in the
options, channel 'foo' should go into '/tmp/whatever.foo.log'.

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
mon: LogMonitor: add debug message upon logging to a channel's file

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
mon: LogMonitor: adjust debug messages output levels

Reduce the noise.

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
mon: Monitor: log RO admin socket commands on 'debug' level

Reduces the noise caused by read-only operations via the admin socket.
RW commands are still logged at 'info' level.

Fixes: #9455

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
mon: Monitor.h: add 'requires_perm()' function to MonCommand struct

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
mon: Monitor: use MonCommand::requires_perm() when checking perms

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
mon: Monitor: log RO commands on 'debug' level, RWX on 'info'

Fixes: #9455

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
Merge pull request #2538 from ceph/wip-mon-data-space-die

mon: die if 'mon data' fs has critically low available disk space & fix logging issues

Reviewed-by: Sage Weil <sage@redhat.com>