Apparently nobody answered so far.
On the risk of doing something obvious too complex I would suggest to 
modify the framework/userslist a little bit
var channels = {};

Ape.addEvent('mkchan', function(channel) {
    channels[channel.getProperty('pubid')] = {'name' : 
channel.getProperty('name'), 'count': 0};
    channel.userslist = new $H;
});
Ape.addEvent('rmchan', function(channel) {
    delete channels[channel.getProperty('pubid')];
});

Ape.addEvent('afterJoin', function(user, channel) {
    var pubid = channel.getProperty('pubid');
    channels[pubid]['count']++;
    channel.userslist.set(pubid, user);
});

Ape.addEvent('left', function(user, channel) {
    var pubid = channel.getProperty('pubid');
    channels[pubid]['count']--;
    channel.userslist.erase(pubid);
});

Ape.registerCmd('list', false, function(param, info) {
    var channelCount = 0;
    var channelsList = '';
    for (var pubid in channels) {
        channelCount++;
        var channel = channels[pubid];
        channelsList += channel['name'] + '=' + channel['count'] + '\t';
    }
    Ape.log('Active channels: ' + channelCount + '\tDetails: [' + 
channelsList + ']');
    //info.user.pipe.sendRaw('R_OK', channels);
});

If this 'list' event is called regulary you can parse the log file.
On the other hand this is more or less a heartbeat and I would like to push 
this to nagios.


(spoiler alert: it is getting a little bit offtopic now)
Personally I would like to be able to send more things to nagios with 
something like send_nsca.
Wouldn't it be great if send_nsca was build into a module? So that it 
regularry sends performancedata and status updates?
Wouldn't it be fantastic if you could submit more checkresults direct from 
the spidermonkey scripts?
eg. var alert = new NagiosNSCA({'check' : 'monkeypunch', 'visitor': 
1000000000, 'punched': true, 'won': 'television set', 'state': 'WARNING' 
}).send();

The simplest way would be use the Ape.sockClient and do the javascripting 
around it. 
However send_nsca messages can be encrypted. Then it would be 'easier' to 
prepare a c wrapper. Should that wrapper be seperate (module) or build into 
the spidermonkey module so it can be called from javascript.


How are you monitoring the health / status of the ape daemon?
(maybe I should open a new topic...)

Peet R

-- 
-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

--- 
You received this message because you are subscribed to the Google Groups "APE 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to