VMware Cloud Community
linux-guru
Contributor
Contributor
Jump to solution

Monitoring qmail

Hi folks,

does anybody monitor qmail with HQ?
I played a little bit around to do some basic monitoring of qmail but were not very successful.
One thing I did to perform a check if qmail sends out mail, was to check the process owned by qmails (which is the "sending-user").
I also would like to monitor the status of other qmail-services like qmail-smtpd etc.
At commandline the easies thing to do this is to run e.g. "svstat /service/*" which shows all processes from daemontools and their state as well as their up-/downtime and PID.
As far as I know daemontools do not write "real" PID-files.
Another thing I would like to perform is some stats about qmail's mailqueue.
At commandline it is done by doing e.g. "/var/qmail/bin/qmail-qstat" which shows e.g. "messages in queue: 6803
messages in queue but not yet preprocessed: 997"
Generating some graphs out of these results would be nice, too.

Checking if qmail sends out mail (as stated above) was done by adding a service which checks the process and has "CredName.User.eq=qmails" as process.query .

Can anybody please help out with some answers or point me to the right way for doing these things?

Cheers

Tobias
Reply
0 Kudos
1 Solution

Accepted Solutions
dougm_hyperic
VMware Employee
VMware Employee
Jump to solution

Glad to hear it is working from the commandline, I have added the
steps for using the plugin within HQ:
http://support.hyperic.com/confluence/display/DOCSHQ27/qmail+Plugin#qmailPlugin-usage

Also updated the plugin with 2 changes:
- Add a 'hostname' configuration property to the services used in the
metric templates, defaults to 'localhost'
- Add 'Outbound Connections' metric to both services

For more info on filters:
http://support.hyperic.com/confluence/display/DOCSHQ27/Plugin+XML+Descriptor#PluginXMLDescriptor-fil...

And metric templates:
http://support.hyperic.com/confluence/display/DOCSHQ27/Measurement+Plugin#MeasurementPlugin-metricta...

Keep the feedback and questions coming, this is helping to fill-in
many of the blanks in the plugin docs.

Message was edited by: rmorgan

View solution in original post

Reply
0 Kudos
9 Replies
dougm_hyperic
VMware Employee
VMware Employee
Jump to solution

This makes a good example for our plugin documentation. Still a work
in progress, but the current example does much of what you're looking
for:

http://support.hyperic.com/confluence/display/DOCSHQ27/qmail+Plugin

Happy to provide adjustments to the example based on any feedback.

linux-guru
Contributor
Contributor
Jump to solution

Hi Doug,

thanks for providing this plugin.

But: I am no Java and XML coder and got some troubles while trying to implement it.

I did:

- create a file called qmail-plugin.xml under pdk/plugins/ on the client with content of [1]
- create a file called process-metrics.xml under pdk/plugins/ also in the client with content of [2]
- ran "jre/bin/java -jar pdk/lib/hq-product.jar -Dplugins.include=qmail -Dmetric-indicator=true" on client's bash

and get an error which states:

Exception in thread "main" org.hyperic.hq.product.PluginException: Error on line 1: Expected "encoding=...".
at org.hyperic.hq.product.pluginxml.PluginParser.parse(PluginParser.java:56)
at org.hyperic.hq.product.pluginxml.PluginData.getInstance(PluginData.java:223)
at org.hyperic.hq.product.ProductPluginManager.registerPluginJar(ProductPluginManager.java:668)
at org.hyperic.hq.product.ProductPluginManager.registerPluginJar(ProductPluginManager.java:505)
at org.hyperic.hq.product.ProductPluginManager.registerPlugins(ProductPluginManager.java:572)
at org.hyperic.hq.product.util.PluginDumper.loadPlugins(PluginDumper.java:448)
at org.hyperic.hq.product.util.PluginDumper.init(PluginDumper.java:310)
at org.hyperic.hq.product.util.PluginMain.main(PluginMain.java:246)

Script-/XML-Files:
[1]
<?xml version="1.0"?>

<!DOCTYPE plugin [
<!ENTITY process-metrics SYSTEM "/pdk/plugins/process-metrics.xml">
]>

<plugin>
<server name="qmail" description="MTA">

<config>
<option name="process.query"
description="Process Query"
default="State.Name.eq=qmail-send"/>
</config>

<plugin type="measurement"
class="org.hyperic.hq.product.MeasurementPlugin"/>

<metric name="Availability"
template="sigar.ptql:Type=ProcState,Arg=$!:State:%process.query%"
indicator="true"/>

&process-metrics;

<filter name="template"
value="exec:file=/var/qmail/bin/hq-qmail-qstat,exec=sudo:${alias}"/>

<metric name="Messages In Queue"
indicator="true"/>

<metric name="Messages Awaiting Preprocessing"
indicator="true"/>

<service name="SMTP">
<filter name="template"
value="SMTP:hostname=localhost:${alias}"/>

<metric name="Availability"
indicator="true"/>

<metric name="Inbound Connections"
indicator="true"/>
</service>

<service name="POP3">
<filter name="template"
value="POP3:hostname=localhost:${alias}"/>

<metric name="Availability"
indicator="true"/>

<metric name="Inbound Connections"
indicator="true"/>
</service>

</server>

</plugin>


[2]

<?xml version="1.0"?>

<!DOCTYPE plugin [
<!ENTITY process-metrics SYSTEM "/pdk/plugins/process-metrics.xml">
]>

<plugin>
<server name="qmail" description="MTA">

<config>
<option name="process.query"
description="Process Query"
default="State.Name.eq=qmail-send"/>
</config>

<metric name="Availability"
template="sigar.ptql:Type=ProcState,Arg=$!:State:%process.query%"
indicator="true"/>

&process-metrics;
</server>
</plugin>


What did I wrong or how can the error stated above be resolved?

TIA

Tobias
Reply
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee
Jump to solution

I have updated the doc with the deployment steps:

http://support.hyperic.com/confluence/display/DOCSHQ27/qmail+Plugin#qmailPlugin-sources

Regarding 'process-metrics.xml', my apologies, that file is included
with the distribution but was added after the version currently
available from our website.
I have updated qmail-plugin.xml in the docs to include those metrics
inline so you don't need to create the additional file.

Give it a try with the updated plugin and let us know how that goes.

Message was edited by: rmorgan
Reply
0 Kudos
linux-guru
Contributor
Contributor
Jump to solution

Now it is working. 🙂

... at least from commandline.
How can I implement the whole thing to add this plugin / metrics to a existing server? Means how do I provide a service using this plugin? Couldn't find anything in the docs. Maybe I am too stupid too find it 🙂
I already copied the XML into the hq-plugins directory as descibed in the docs.

I needed to do some customisation. Where does it have do be done? Only on the client? On the server also?
If I say "customisation" I mean that I needed to change "hostname=localhost" to "hostname=IP" in the XML.

How can SMTP-Outgoing connections be monitored? I currently do not completely understand the syntax of "filter" attributes.

TIA for your help.

Tobias
Reply
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee
Jump to solution

Glad to hear it is working from the commandline, I have added the
steps for using the plugin within HQ:
http://support.hyperic.com/confluence/display/DOCSHQ27/qmail+Plugin#qmailPlugin-usage

Also updated the plugin with 2 changes:
- Add a 'hostname' configuration property to the services used in the
metric templates, defaults to 'localhost'
- Add 'Outbound Connections' metric to both services

For more info on filters:
http://support.hyperic.com/confluence/display/DOCSHQ27/Plugin+XML+Descriptor#PluginXMLDescriptor-fil...

And metric templates:
http://support.hyperic.com/confluence/display/DOCSHQ27/Measurement+Plugin#MeasurementPlugin-metricta...

Keep the feedback and questions coming, this is helping to fill-in
many of the blanks in the plugin docs.

Message was edited by: rmorgan
Reply
0 Kudos
linux-guru
Contributor
Contributor
Jump to solution

Works very good. Thanks for your help. To be honest, I wouldn't have expected such a detailed help. 🙂

There is currently one thing I don't understand / I can't fix by myself.
Collecting metrics for outbound connections doesn't make sense like you currently do it. Let's take SMTP as example.
At the moment connections on %hostname on port %SMTP with state outgoing will be measured.
Unfortunately outgoing SMTP-connects will originate from %hostname on ANY port to ANY server on port %SMTP.
How can this be included into collecting metrics?

TIA

Tobias
Reply
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee
Jump to solution

Glad to hear the plugin is working well for you. The qmail plugin
doubles as a good example for the docs, so thank you for the idea!
I have added an "All Outbound Connections" metric to the netservices
plugin:
http://jira.hyperic.com/browse/HHQ-103

This metric will count all connections where the remote port is that
of the given protocol (SMTP/25 in your case) regardless of the address.
After deploying the updated netservices-plugin.jar, just change qmail-
plugin.xml:

<metric name="Outbound Connections"
indicator="true"/>

to:
<metric name="All Outbound Connections"
indicator="true"/>

You'll need to enable the metric by hand since your service already
exists, or just delete/re-create the service and it will be enabled
by default.


Reply
0 Kudos
linux-guru
Contributor
Contributor
Jump to solution

Did it like you suggested and deleted / re-created SMTP, but got no success with it.
Incomming Connections is measured but All Outgoing Connection has no data. Collection interval is set to 5 minutes but doesn't result in anything.

Can you please again have a look at it? IMHO there is something wrong either with the updated netservices-plugin.jar or with metric-definition in the qmail-plugin.

TIA

Tobias
Reply
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee
Jump to solution

Did you update the plugin on the agent side too?

You can test the metrics from the command line like so:
% ./jre/bin/java -jar pdk/lib/hq-product.jar -Dplugins.include=qmail -
t "qmail SMTP"
qmail SMTP Availability:
qmail SMTP:SMTP:hostname=localhost:Availability
=>100.0%<=
qmail SMTP Inbound Connections:
qmail SMTP:SMTP:hostname=localhost:InboundConnections
=>0.0<=
qmail SMTP All Outbound Connections:
qmail SMTP:SMTP:hostname=localhost:AllOutboundConnections
=>0.0<=

You can also turn on debug logging in the agent by changing
agent.properties:
log4j.rootLogger=INFO, R
to:
log4j.rootLogger=DEBUG, R

And you can see which metrics are being collected in logs/agent.log


Reply
0 Kudos