I would like to send notifications to instant messengers, such as AIM, Facebook, Gadu-Gadu, IAX (Inter-Asterisk Exchange), ICQ, IRC (Internet Relay Chat), Jabber, MSN, Netsend, Tlen, Yahoo, Google Talk (GTalk), Skype, Bonjour, etc. Is it possible to do this using external software controlled via command line?
How can PRTG send instant messages to Jabber, ICQ, MSN, Yahoo, etc., using external software?
1 Reply
This article applies to PRTG Network Monitor 8 or later
Use Custom Notifications to Send Instant Messages
Using PRTG's Execute Program notifications option, you can use an instant messenger with command line capabilities to send messages via virtually any instant messaging protocol. This article will show an example of how to send notifications to an ICQ account, using a combination of the following programs:
- PRTG Network Monitor
- Miranda Instant Messenger version 0.9.15
- Miranda Command Line Plugin version 0.0.3.0
- NSSM—the Non-Sucking Service Manager version 2.7
Step 1: Install and Prepare Miranda
- Download Miranda IM and install it on your computer in Portable Mode (this is an option during setup), so you can move it to your PRTG server later on.
- In Miranda IM, set up an ICQ account dedicated to sending messages for PRTG (sign up for a new one, if necessary). Add all future recipients of notifications to this account's contact list and test if messages are received on the other side. Note: Although this is an example for ICQ, you can add any other account using one of the supported protocols, e.g. Jabber, MSN, etc.
- Write down the possible recipients' ICQ numbers—you will need them later.
- Download the Command Line plugin and extract it to your Miranda installation directory. To check, make sure the file CmdLine.dll is in the \Plugins sub folder after extracting.
Step 2: Move Miranda to PRTG Server System
Note: When running a cluster, you need to perform the actions in this step on every single node to make sure notifications are also available in case the Master Node fails.
- Copy the Miranda IM directory to the system running your PRTG core server. You can choose any directory, e.g. C:\Miranda IM
- Move the file MimCmd.exe from the Miranda installation directory to the \Notifications\EXE sub folder of your PRTG program directory.
Step 3: Configure Miranda as Windows Service
Now comes the tricky part: You have to make sure that the file miranda32.exe (or miranda64.exe, accordingly) from the Miranda IM directory and the PRTG Server.exe system service (which is PRTG's core server) are running under the same Windows user account, which for PRTG is, by default, the local Windows "system" account. One way is to register the Miranda EXE file as a Windows service, started under the local Windows "system" account.
Note: When running a cluster, you need to perform the actions in this step on every single node to make sure notifications are also available in case the Master Node fails.
- Download and install "NSSM—the Non-Sucking Service Manager", an open source command line tool which lets you easily run an EXE file as Windows service. Extract the ZIP file to a directory on the system running your PRTG core server, e.g. C:\nssm-2.7.
- On the Windows command line, enter a command to register Miranda as a service, for example:
C:\nssm-2.7\win32> nssm.exe install MirandaIM - In a GUI window, you will be prompted to enter the path to the application you wish to run as a service and any commandline options to send to it (see NSSM usage documentation). Enter the path to the Miranda application, for example C:\Miranda IM\miranda32.exe, and a service name, for example MirandaIM. You do not need to enter any options. Click on Install service. The service is added with start type "Automatic".
- In the Windows Computer Management console (compmgmt.msc), view the list of services and start the newly created service MirandaIM manually. It should be started under the Windows local "system" account (check this in the task manager). After a successful start, you should see the configured ICQ account as "online" in any of the recipients' messengers. This is mandatory to receive messages later.
Step 4: Set Up Notification in PRTG
- In the PRTG web interface, select Setup | Account Settings | Notifications from the main menu.
- Click on Add new notification and set a check mark for Execute Program.
- In the Program file drop-down menu, select Mimcmd.exe
- In the Parameter field, enter
message <ICQ#1> <ICQ#2> "Message"to send Message to the ICQ numbers <ICQ#1> and <ICQ#2>.
For example, enter the following to send PRTG's standard notification to ICQ# 12345678:message 12345678 "[%sitename] %device %name %status %down (%message)" - Click on Save
- The new notification is now shown in the list of notifications. Click on the Test link to send a test message. It should be visible in the recipient's messenger immediately.
- You can add several notifications by repeating the actions in this step.
- Use a sensor's Notifications tab to add a trigger which uses this newly created notification.
Notes
- Instead of an ICQ number you can also enter other IDs as recipients, depending on the messenger accounts configured in Miranda. For example, you can send a message to an MSN ID (usually this is an email address). Account types can also be mixed in one call, for example you can send the same message to ICQ and MSN:
message 12345678 JohnQPublic@msn.com "[%sitename] %device %name %status %down (%message)" - Instead of using the messenger account IDs as recipients you can also use the profile names as shown in the Miranda contact list. The message will then be sent to the first contact matching the name. For example, to send a message to an ICQ account shown as "Paessler" in the Miranda contact list, you would type:
message Paessler "[%sitename] %device %name %status %down (%message)"
Known Issues
With the command line tool version used, messages might be sent triple (one per minute), although only triggered once. This is because the command line tool does not give back an exit code 0. You can work around this by creating a batch file calling the command line tool with the respective options, then terminating with
EXIT 0
In PRTG you will then use the batch file instead of the command line tool directly.
Trouble Shooting
If you run into a message Could not create connection with Miranda, this indicates an issue in the communication between miranda32.exe and MimCmd.exe (when executed by PRTG). Please make sure the miranda32.exe and PRTG Server.exe services are running under the same Windows user account (usually, this is SYSTEM). This account must have sufficient rights to execute the necessary files. You might need to reconfigure both services, so they run on a Windows domain account.
(A "Thank you" goes to Jon DeSalvatore for sending this hint!)
Created on Jan 25, 2011 2:33:43 PM by
Daniel Zobel [Paessler Support]
(21,383)
●3
●3
Last change on Oct 20, 2011 12:45:29 PM by
Daniel Zobel [Paessler Support]
(21,383)
●3
●3
Please log in or register to enter your reply.
Add comment