Jump to content

Recommended Posts

  • Administrators
Posted (edited)

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
Posted

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

  • 3 months later...
  • Administrators
Posted

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?

Posted

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)  

  • Administrators
Posted

I am currently working on an updated version of the plugin. I will let you know when it's finished.

  • 9 months later...
Posted

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.

  • Administrators
Posted (edited)

Hi Martin,

 

Thanks, I'll add this feature soon.

 

Paul

Edited by Paul
  • Administrators
Posted

I've updated the plugin, check the first post for updated usage.

  • 10 months later...
Posted

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.

  • 2 weeks later...
  • Administrators
Posted

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

  • 3 weeks later...
Posted

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.

  • Administrators
Posted

Hi,

Have you installed the plugin in Pulseway Manager -> Plugins ? Is the Pulseway service started? Try restarting the Pulseway service.

Paul

Posted

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

  • Administrators
Posted (edited)

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
  • 2 months later...
Posted

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

  • Staff
Posted

Hi Kelvin,

Thank you for your feedback. We do plan on having support for sending notifications from the command line on Linux too.

Chris

Posted

Hi Chris,

Thanks for the reply. Any timeline on this ? Might save me the effort of looking at alternatives in the interim because realistically, the current limitation is a big issue for us.

Regards,

Kelvin

  • Staff
Posted

Hi Kelvin,

Unfortunately we don't have any ETA for the Linux port of the notification bridge plugin. We apologize for the inconvenience.

Chris

  • 2 years later...
Posted

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. 

  • 1 month later...
Posted (edited)

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
  • Administrators
Posted

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

  • 1 month later...
Posted (edited)

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!
  • 8 months later...
Posted

Hello.

Why is the PCMonitorClient.dll in the NotificationBridge1.2.zip file? I guess pulseway must be installed on the system and it has a newer PCMonitorClient.dll.

Or can i use NotificationBridge without install pulseway?

Many thanks

  • Administrators
Posted

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

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...