Broadcast Message To Specific Chat Room

Hello,

Is there a way to send a message to a room without being logged into the room. Basically what we have is nagios running which can send an alert through a message to a user, though we would like to have it send the alert message into one of the rooms we created. Is something like this possible?

Is there any particular reason you don’'t want to be in the room when you send the message?

My solution is a bot built on the Smack library that reads messages queued in a mysql table and sends them out. If that’'s all you need, it can be done in <100 lines of code.

lol ya that would be easy except 1. not a programmer, 2. nagios doesn’'t use mysql basically the script it uses logs into the system and sends the message and logs out

I poked around the nagios site a little. It looks like there’‘s an experimental plugin that lets you store the data in mysql. I didn’‘t find anything about xmpp though. Are you trying to send messages using something built in to nagios, or did you find a plugin that does it? If there’'s any docs that cover what functionality is available relating to XMPP that would help us figure out an answer.

To answer your initial question though, you do have to join a room before sending a message to it. Otherwise public chatrooms would be subjected to horrific volumes of spam.

I haven’'t seen nagios for quite some time, however I kindof recall it being written in php… could be wrong, anyway have a look at Flyspray http://flyspray.org/ (more great open source) they have a php class in their bugtracker which I was able to pull out and use to do exactly what you are trying to do.

The class itself didn’'t do MUC, however given php is easy and XMPP is well documented it was easy enough to extend it so it could MUC,

It logs into the chat, sends the message and leaves the chat. Takes about 5 lines of code and the class to do it - log in - speak - logout.

I use it in a web app I built for work that sends outage notifications to chatroom(s) as soon they get entered into our db. I extended it to do xhtml chat too so it can color code the event info based on severity and status, the message is a basic abstract of the outage with a hyperlink to the web interface with the details. A simple 1 line notice that doesn’‘t disturb the chat, yet doesn’'t go unnoticed either.

There is plenty of great perl and python support for xmpp too, if you are using open source you must have someone to hack a bit of code for you too.

Open source rules