Hi Flekkontrek,
It's an interesting use case. It would be interesting to consider what would be considered wrong behaviour.
A first option is to regularly monitor the manager's and agent's
ossec.log and other log files for error and/or warning messages (Not all error messages cause alerts, and not all errors.
cat /var/ossec/logs/ossec.log | grep 'ERROR \| WARNING' >> /path-for-file/log-report.log - Can be used to copy only error messasges and warnings to a new file so it is easier to read. Since the logs are by default rotated every 24hs, you could do this process once a day, so you read only the logs daily.
Another possible option is determine which wazuh daemons you have usually enabled an monitor if one is stopped:
/var/ossec/bin/wazuh-control status - Will print a list of the status of all daemons (you can add the name of daemon to check the status of only that daemon).
This command could be fired from the manager (using
command monitoring) periodically and with a custom decoder and rules, you could generate alerts if a daemon is shut down unexpectedly.
To launch the command every 2 minutes:
<localfile>
<log_format>full_command</log_format>
<command>/var/ossec/bin/wazuh-control status</command>
<frequency>120</frequency>
</localfile>
Then you could use a
custom decoder and rules to decode the response.
I hope this examples help you clear up your doubts. In case of further questions, do not hesitate to ask.
Cheers.