Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We've got a lot of back-end applications that we need to monitor the performance of (metrics such as orders waiting to be processed, time since last run, etc). Currently, this is done by an in-house watchdog application that fires out emails whenever a threshold is exceeded, but there's no way to acknowledge an issue and squelch these alerts.

Rather than build our own complete alerting system, we'd like to tie in to the Zenoss installation we use to monitor our servers. I've found a few articles on creating events programmatically, but I'd rather Zenoss itself monitors the values that the current watchdog app is looking at (so we get the benefits of graphing and history as well).

Is it possible, then, to programmatically provide a data feed (rather than an event) to Zenoss? Or is there another way to go about this?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

The cleanest solution, IMHO, is to let the app provide information via SNMP.

Then you can monitor it using any software that speaks SNMP, including, but not limited to Zenoss.

There are various ways to achieve this.

I have done it myself for some custom apps:

The apps were running on a Linux server, which already ran the Net-SNMP daemon. So I wrote a plugin for Net-SNMP (just a small Perl script), which queried the values from the app and reported it to Net-SNMP.

I used the exec mechanism of Net-SNMP to run it ( http://net-snmp.sourceforge.net/docs/man/snmpd.conf.html#lbAZ ). Basically you just put

exec  [MIBOID] NAME PROG ARGS

into the snmpd.conf. Then Net-SNMP will invoke your script, and report its results back via SNMP. Your script just needs to print the result(s) on stdout (one per line if it reports multiple values), otherwise it does not have to do anything specific. Note: Using exec is now deprecated in favor of extend, but the principle is the same.

There are other, more powerful extension mechanisms (you can write a plugin in Perl, or a dynamic module in C, ...), but this is a good place to start.

Other SNMP daemons will have similar extension mechanism, it just depends on what you are currently using on the server that your app runs on.

Also, there is a special protocol called AgentX to allow an app to serve as a "sub-agent" (that is, to report data to the main SNMP daemon on a system). You could even implement a subagent in your app.

In short, there are many ways to accomplish data reporting via SNMP; just choose the simplest solution, then extend it when you need to. At any rate, that way you get an extensible, standard-based solution, instead of ad-hoc emails.

Edit:

To do this under MS Windows:

One possiblity (there may be others, don't know) is to install Net-SNMP under Windows (they have a Windows version). You actually have two options:

  1. Keep the Windows SNMP service running, and install Net-SNMP alongside it
  2. Disable the Windows SNMP service, and run Net-SNMP instead

Under option 1, you will need to let the Windows SNMP service use a non-standard port, and have the Net-SNMP agent proxy requests to it. Under option 2, the Net-SNMP agent will directly load the DLLs which the Windows agent would use if it ran. Thus in both cases, you should still get the MS-specific information the Windows agent provides. Both approaches have some drawbacks; see the README.win32 for details.

Once you have Net-SNMP running, you can use all its extension functionality, just like under Linux (see above).

You can also extend the Windows SNMP agent directly (without using Net-SNMP), but I don't know much about that. There is a "Windows SNMP API", which is apparently one way: http://msdn.microsoft.com/en-us/library/aa379207%28v=vs.85%29.aspx

share|improve this answer
    
Is there a straightforward way to accomplish the same thing using Windows' SNMP implementation? We do have Linux boxes that I could use but I'd rather associate the apps with the server they're running on, if possible. –  Andy S Jun 20 '11 at 13:47
    
@Andy S: Good question. I've never tried this on Windows, but it should work. I expanded my answer to try and help. –  sleske Jun 20 '11 at 15:11
    
@Andy S: Have tried to give some Windows information. If you need more help, consider asking a new question (something like "How can I extend the SNMP agent provided by MS Windows?"). –  sleske Jun 20 '11 at 15:23

I wrote a paper a couple of your back now discussing different options for "process monitoring" with Zenoss - http://community.zenoss.org/docs/DOC-3537 .

Not much has changed since then other than that the built-in Zenoss process monitoring is a little less quirky and more reliable. It discusses various ways including using the net-snmp daemon (which incidentally is also available for Windows). It also discusses running scripts using ssh. Either way, you can graph collected data, in addition to alerting on thresholds.

Cheers, Jane

share|improve this answer
    
Interesting paper. However, it seems this does not answer the question asked. The paper is only about checking that processes are running. The OP was asking about how to monitor specific metrics provided by a process, such as the length of some internal queue. –  sleske Jun 21 '11 at 14:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.