1

I use monit (https://mmonit.com/monit/) for system monitoring. Also I use my own "backend" instead of m/monit and I want to receive additional data from the monit instances.

For example, is it possible to read the data from the file and then send this data together with regular report?

Vadym
  • 111
  • 4

1 Answers1

0

I don't know how to read from file, but you can send script's result.

Add to monitrc

check program my-custom-data with path "/path/to/test_mydata.sh"
    if status > 60 then alert . # just example
    group custom-data

Bash file example:

#!/bin/sh
exit 56

and as result you will have this data in your xml

<service name="my-custom-data">
            <type>7</type>
            <collected_sec>1564140983</collected_sec>
            <collected_usec>970882</collected_usec>
            <status>0</status>
            <status_hint>0</status_hint>
            <monitor>1</monitor>
            <monitormode>0</monitormode>
            <onreboot>0</onreboot>
            <pendingaction>0</pendingaction>
            <program>
                <started>1564140983</started>
                <status>56</status>
                <output/>
            </program>
        </service>
Vadym
  • 111
  • 4