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.

I'm not entirely sure whether or not this is actually possible, but essentially I'm looking for advice on how to go about doing the following:

I run a server monitoring service and at the minute this operates on a push mechanism - each server runs a cronjob every minute or so that posts relevant data to our API server which then processes the data.

What I'm looking at moving towards is a small self contained application that will run on each server and listen on a certain port (e.g 8282). Ideally I'd like an Apache instance with PHP along with a few custom PHP scripts in the document root.

Is there a way you can package up applications together this way without having to install libraries and applications separately. I don't mind having to create separate packages for different versions of Linux.

Thanks,

Lee.

Edit: Just to clarify, I probably overcomplicated this question quite severely. Essentially what I was meant to ask if whether or not there is a standalone http server out there with built in PHP support. Apologies for the confusion.

share|improve this question
    
Just to clarify, I probably overcomplicated this question quite severely. Essentially what I was meant to ask if whether or not there is a standalone http server out there with built in PHP support. Apologies for the confusion. –  Lee Brooks Jul 20 '12 at 15:24
    
Look at this SO question (ignore the accepted answer). –  Tom Marthenal Jul 23 '12 at 2:54

3 Answers 3

up vote 4 down vote accepted

It sounds like you are trying to re-invent Nagios and NRPE. Perhaps you would find it easier to extend Nagios than to start from scratch? Nagios makes it very easy to write custom plugins, and to query the results of these tests over the network using NRPE.

share|improve this answer
    
I know this is an old thread, but I realised I hadn't marked an answer as accepted. What I ended up doing was using node.js as you can easily spawn a websocket and only need to ship around a single binary. –  Lee Brooks Jun 7 at 20:43

I freely concede to not being entirely sure if this was a serious question.

A package is a collection of individual files which together perform a common function. As you have noted, apache is often distributed as a package, and consists of a good number of files (369, on my box); PHP likewise.

Yes, you can unpack the packages you need, and the packages they depend on, and repack them all together as a single, custom package which has everything you want to distribute. Yes, you will need to do this for each distribution you wish to support.

It's probably not wise to do this, as many packages, eg apache, depend on a number of other packages; some people will already have some of those packages installed, and if you package everything your app needs together in a take-it-all-at-once-or-not-at-all way, you'll have to overwrite some of their already-installed files. This will be bad.

Note that although free software is generally pretty good about allowing redistribution, if you redistribute GPL'd software like this, you will be obliged to fulfil the requirement to make source code available to anyone who asks; be sure that you're ready to fulfil this obligation.

share|improve this answer
    
I guess what I'm really looking for is a standalone http server with PHP support. It was probably poor wording on my part. –  Lee Brooks Jul 20 '12 at 15:23

Can you do this? Sure.
Every Linux distribution I've ever encountered supports some kind of software packaging system (RPM and APT being the most common).
Instructions on creating packages for a given distribution can be found in that distribution's documentation.
If you want to avoid library dependencies you're going to have to statically link the contents of your package, which means the package will be HUGE.


Should you do this? ABSOLUTELY NOT.
For one thing running a full web server on every system just for monitoring is crazy: You're adding resource utilization and potential security holes.
Also as Bart B pointed out there's already a tool for this (and Nagios is not the only one. There are tons of tools that use SNMP for this sort of thing too).

I suggest you search around on SF for monitoring tools, or ask Google. I'm sure you'll find something that meets your needs.

share|improve this answer

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.