Jump to content

Notification Bridge


Paul

Recommended Posts

  • Administrators

Hi everyone,

Use this plugin to open up a local WCF using net pipes so that a console application can use it to sent notifications to Pulseway. Using this solution you can easily send Pulseway notifications from your scripts.

Version 1.3

=Installation=

  1. Add the NotificationBridgePlugin.dll plugin into Pulseway Manager -> Plugins.
  2. Configure your scripts to call NotificationBridge console application.

=Usage=

-p (Priority: 0=Low, 1=Normal, 2=Elevated, 3=Critical)
-t (Text message, use double quotes if the message includes a space)
-f (Include the text from a file)
-r (Allow repeating notifications)

Exit Codes:

  • 0 - Notification was successfully forwarded to Pulseway
  • 1 - Notification was rejected by Pulseway (Maintenance mode, Old notification was not deleted, Pulseway is stopped.

As always my plugin is open-source bound by no license. You may claim it your own.

Source Code: https://bitbucket.org/paulcsiki/notification-bridge-plugin/src

Download Link: Click

Paul.

Edited by Paul
release 1.3
Link to comment
Share on other sites

Great plugin Paul!

 

It would be perfect if you can add in one of the next versions the options   <message priority>, <message subject> <message text> optional <message file>   like:

 

NotificationBridge.exe -p 1 -s "Backupjob Success" -t "1248 MB saved"

or

NotificationBridge.exe -p 3 -s "Backupjob Error" -f "c:\batch\backup.log"

(-p 0=Low, 1=Normal, 2=Elevated, 3= Critical). Repeating notifications should be possible.

 

This Syntax will give script or batchfiles in combination with variables a optimal notification System!

 

I do this currently via EventCreate command and PCM Event Log notification but your NotificationBridge plugin would be more sexy ;-)

 

Lg. Sepp

Link to comment
Share on other sites

  • 3 months later...
  • Administrators

Great plugin Paul!

 

It would be perfect if you can add in one of the next versions the options   <message priority>, <message subject> <message text> optional <message file>   like:

NotificationBridge.exe -p 1 -s "Backupjob Success" -t "1248 MB saved"

or

NotificationBridge.exe -p 3 -s "Backupjob Error" -f "c:\batch\backup.log"

(-p 0=Low, 1=Normal, 2=Elevated, 3= Critical). Repeating notifications should be possible.

 

This Syntax will give script or batchfiles in combination with variables a optimal notification System!

 

I do this currently via EventCreate command and PCM Event Log notification but your NotificationBridge plugin would be more sexy ;-)

 

Lg. Sepp

 

Sorry about the late reply. What do you mean about the message file. Would you like me to open the file and append it's contents to the notification?

Link to comment
Share on other sites

correct,, eg. to send the result of a command in a script to the notification queue like

 

netstat > c:\temp\netstat.log

notificationbridge.exe -p 0 -s "Netstat resut" -f "c:\temp\netstat.log"

 

(date, time, computer and group should be includet in the notification)  

Link to comment
Share on other sites

  • 9 months later...

Just stumpled upon this plugin.

It has great potentials!

 

I would be nice it were possible to set the notifigation level, so it could be anything else than normal.

If I send an notification, all other notifications are ignores until the first notification has been removed. It would be better if it was possible to group them, so it was only the same notifications that was ignored.

 

Br, Martin.

Link to comment
Share on other sites

  • 10 months later...

What an awesome idea Paul. Being able to have applications that aren't natively supported by Pulseway send notifications through it is a great idea to keep all monitoring consolidated in the one app.

I've given it a try and it hasn't worked for me. I just get the message "Pulseway refused the notification". The command I ran was 'notifictionbridge.exe -p 1 -t "message"', and Windows version is Server 2008 (6.0.6002).

Any tips for fixing this would be appreciated.

Link to comment
Share on other sites

  • 2 weeks later...
  • Administrators

Hi,

Thank you for using my plugin. I think that the plugin worked once and then it stopped working because you didn't delete the first notification you've triggered. When I wrote the plugin I didn't mark the notification as repeatable to prevent scripts from spamming the Pulseway service.

One could always modify the following line:

https://bitbucket.org/paulcsiki/notification-bridge-plugin/src/860e9fb9c857a0b7f7164062e72c3c9f323b8356/Source/NotificationBridgePlugin/NotificationBridgeService.cs?at=master&fileviewer=file-view-default#NotificationBridgeService.cs-45

Here is the full method signature that Pulseway exposes for plugins:

bool SendNotificationToAllDevices(string message, NotificationPriority priority, bool allowMultipleNotifications = false)

As you may have guessed, the last parameter if set to true, Pulseway will allow repeated notifications for the NotificationBridge plugin.

Paul

Link to comment
Share on other sites

  • 3 weeks later...

I'm getting an error when trying to invoke this plugin.

 

C:\Program Files\Pulseway>NotificationBridge.exe -p 1 -t "test"
There was no endpoint listening at net.pipe://localhost/NotificationBridge that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Link to comment
Share on other sites

Hi, the plugin is installed, yet same problem!

The service would not let me restart it, but I did restart the whole computer, same problem.

Also, could you release the file with the multiple notifications allowed to be sent?

bool allowMultipleNotifications = false

 Recompiling the code with those changes is beyond my skills

 

Thanks

Link to comment
Share on other sites

  • Administrators

Hi,

I still believe that the plugin is not correctly installed. I will update the plugin tonight to support repeating notifications.

Edit: I've updated the first post with a new version of the plugin that supports repeating notifications, try again with the version 1.2 and see if you still get connection errors.

Paul

Edited by Paul
Link to comment
Share on other sites

  • 2 months later...

Hi Paul,

Any chance of a Linux version of this excellent plugin ?

I'm working with more and more Linux based systems now and find the Linux agent lacking when compared to the Windows version. There are a number of ways we could create custom notifications on Windows but cannot find any way to do it on Linux systems.

Thanks.

Kelvin

Link to comment
Share on other sites

  • 2 years later...

Hello Paul, i know it's been a while but I tried to use your notification plugin but it sends multiple notifications. So I've jumped into the code and modified it with "false" and tried to use "notification id" so that it's always the same ... and it still allows multiple notifications. I've added -m  -i parameters to your notifications.exe to support this and added nessecary changes to plugin itself but fort some reason it just displays all that is coming. Did something change? Could you update your code to support "choice"? it used to be do not allow multiple notifications but now it's different. 

Link to comment
Share on other sites

  • 1 month later...

In the web interface I can run this command in powershell and I will get a message:           & "C:\Scripts\Pulseway\Addin\NotificationBridge.exe" @('-p', 1, '-t', "message")

If I save that exact line as a script and run the script on the server through the web interface I get this error: There was no endpoint listening at net.pipe://localhost/NotificationBridge that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

How can I use the Notification Bridge with a script saved in Pulseway?

Thanks 

Edited by BiofilmIT
Link to comment
Share on other sites

  • Administrators

It's possible that you've setup powershell impersonation in the Pulseway Manager -> Settings -> Runtime and the user you're impersonating the scripts is not part of the local Administrators group.

-Paul

Link to comment
Share on other sites

  • 1 month later...

Thanks for this thread. It's been pretty insightful and we've been working hard to implement it in our enterprise. A couple questions to make sure we're taking the right approach for optimal execution. 

  1. We're copying the dll and .exe file from our network repo to the local machines across the enterprise
  2. We're going to elevate the Powershell permissions under the Pulseway Manager running locally from under the Settings tab and then under runtime at the bottom, the part titled PowerShell User Agent and we're filling the necessary fields there (user, pass and domain)
  3. We're then executing a powershell script to push the registry entries and referencing where we copied the executable and dll, in this case, ""C:\scripts\Notification Bridge 1.2\Release\NotificationBridgePlugin.dll"
    1. Set-ItemProperty -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Plugins" -Name Count -Value "1"
      New-Item -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Plugins" -Name Plugin0
      New-ItemProperty -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Plugins\Plugin0" -Name ClassName -Value "NotificationBridgePlugin.NotificationBridgePlugin"
      New-ItemProperty -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Plugins\Plugin0" -Name Description -Value "A bridge between Pulseway notification system and scripts."
      New-ItemProperty -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Plugins\Plugin0" -Name FileName -Value "C:\scripts\Notification Bridge 1.2\Release\NotificationBridgePlugin.dll"
      New-ItemProperty -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Plugins\Plugin0" -Name Name -Value "Notification Bridge"

       

  4. And then restarting all our machines for the registry addition to take effect.

At that point, we think all the machines running Pulseway will then be able to fire off the NotificationBridge commands and have the mothership detect them and put them in the alerts area.

Does that sound about right? I hope we're not over thinking this. :)

Appreciate any input, and I included the above for posterity in the hopes it might help someone attempting to do the same thing. 

 

Thanks!

Mario

Edited by Mario
Was looking for subscribe to response button!
Link to comment
Share on other sites

  • 8 months later...
  • Administrators

I'd just copy the NotificationBridge.dll file from the archive into the Pulseway installation folder and use it from there. You cannot use the notification bridge application without Pulseway installed (including the plugin configured) on the local machine.

-Paul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...