M/Monit collector API
Hello,
I've made an “SNMP-MMonit gateway” which is a snmptrapd and a sender script. The script evaluates the trap, constructs the XML and sends it to MMonit by curl, but the XML is not 100%.
Unfortunately I haven’t find an XSD or an any documentation from Collector API, only an old mail on mailing list from Jan-Henrik Haukeland to plan to open the collector.
Are you still planning to open it? And if so, when?
Thanks,
Gabor
Comments (4)
-
repo owner -
reporter Thank you for your answer. I’ve found all the necessary info in source as you pointed out.
SNMP trap is a simple text message, not numeric value, so drawing is not needed.
Now I’m using this template:
<?xml version="1.0" encoding="ISO-8859-1"?>
<monit id="$SNMP_TRAP_SENDER_HOSTNAME" incarnation="$(date "+%s")" version="5.3.2">
<server>
<localhostname>$SNMP_TRAP_SENDER_HOSTNAME</localhostname>
<controlfile>null</controlfile>
<poll>10000000</poll>
</server>
<services>
<service name="monit">
<type>7</type>
<collected_sec>$(date "+%s")</collected_sec>
<collected_usec>$(date "+%6N")</collected_usec>
<status>2097152</status>
<monitor>1</monitor>
</service>
</services>
<event>
<collected_sec>$(date "+%s")</collected_sec>
<collected_usec>$(date "+%6N")</collected_usec>
<service>monit</service>
<type>7</type> <!-- It is a “Program”... -->
<id>2097152</id> <!-- “Status” value is...-->
<state>3</state> <!-- 0/1/2 Failed/Succeeded/Changed...-->
<action>1</action> <!-- and the action is Alert -->
<message><![CDATA[$SNMP_MESSAGE]]></message>
</event>
</monit> -
reporter - changed status to resolved
-
repo owner - Log in to comment
The collector XML API is open, but undocumented. One can investigate the Monit source code to see the format and content of the XML document. The problem with sending arbitrary data to M/Monit is that there needs to be something on the M/Monit side that can e.g. draw charts with these data and also an API for querying the data.