Jump to content

Low Dependancy Push Notification Service

Go to solution Solved by Biohazard777,
3 hours ago, UltraSCSI said:
Send-MailMessage -From $SMTPUsername -To $emailTo -Subject $MailSubject -Body $MailBody -SmtpServer $SMTPServer -Port $SMTPPort -Credential $credentials -UseSsl

I'd make 3 attempts (try/catch) with 60s cooldown between them.
Then I'd tell it to make 3 more attempts from a secondary email account (preferably one that doesn't use the same mail server).

 

4 hours ago, UltraSCSI said:

You are totally correct here, I guess what I really mean is less front loaded. Less for the client machine to do in hopes to make it easier on our RMM and on the machines they are running on.

Yeah but sending out e-mails is such a low load for the client machines. And pushing a single ps script per client shouldn't be a considerable load for the RMM either...
Unless if you have a huge amount of client machines, in which case it might be a considerable load on your mail server as well.

 

4 hours ago, UltraSCSI said:

Now that I've like fully typed out my situation and thoughts, its becoming obvious that I'm gonna have to write it myself lol

Hey, as long as it gets the job done.
Sure writing your own might make it prone to bugs, but implement someone eases solution and you have a new "tech debt". (that is if you can even find one that fits your use the way you want it)

Okay here is the situation:
I am needing a way to get a notification when a specified computer comes online.

The RMM solution that we have in place is doodoo weewiz and cannot be configured to send of an email or any other notification when machines come online.

I do however have the ability to queue up Powershell and batch commands for a computers next power up.

I COULD write up a powershell script that fires off an email when a machine connects, however I have had pretty poor reliability with this solution.

In my mind I am thinking there has to be some solution that has very low dependency so I can be sure it will work a bit more consistently.
Something that I can have a script simply send off a packet or two to a web server and have that translated to a different service like telegram etc.

This is simple enough that I likely could roll my own software for it but I would prefer to use a solution that somebody with more coding experience has developed xD

Any thoughts? Am I wack for thinking this is a solution?

Link to comment
https://linustechtips.com/topic/1540809-low-dependancy-push-notification-service/
Share on other sites

Link to post
Share on other sites

1 hour ago, UltraSCSI said:

Something that I can have a script simply send off a packet or two to a web server and have that translated to a different service like telegram etc.

I mean you are just moving the problem further down the pipeline and adding more dependencies and stuff to maintain....

What happens if the server is down, or telegram changes API etc.
 

1 hour ago, UltraSCSI said:

I COULD write up a powershell script that fires off an email when a machine connects, however I have had pretty poor reliability with this solution.

Care to explain?
What failed, what does the script look like (do you have error handling and retries in place)?

Link to post
Share on other sites

Hey thanks for replying!

 

38 minutes ago, Biohazard777 said:

Care to explain?

What failed, what does the script look like (do you have error handling and retries in place)?


This is typically how I would handle something like this:

$SMTPServer = "mail.xxx.com"
$SMTPPort = 2525
$SMTPUsername = "xxx"
$SMTPPassword = ConvertTo-SecureString "xxx" -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential ($SMTPUsername, $SMTPPassword)

$MailSubject = "Machine Online"
$MailBody = "The machine with the hostname $hostname and IP address $privateIPAddr is now online."
$emailTo = "xxx"


Send-MailMessage -From $SMTPUsername -To $emailTo -Subject $MailSubject -Body $MailBody -SmtpServer $SMTPServer -Port $SMTPPort -Credential $credentials -UseSsl


In the past have had very little issue with this layout, having everything broken down with variables at the top just makes it quicker for my eyes to track what I need to update on a per situation basis.
We have an SMTP email relay service that we use for various things, I have always used that to send off emails via ps or cmd and had no issues.
 

Whenever I manually text and run email scripts there is no issue.
When issuing from our RMM it seems to be hit or miss, so I am fairly sure its just crap.
It isn't very verbose either, it just says failed or timeout if it doesn't work.

 

39 minutes ago, Biohazard777 said:

I mean you are just moving the problem further down the pipeline and adding more dependencies and stuff to maintain....

What happens if the server is down, or telegram changes API etc.

 

You are totally correct here, I guess what I really mean is less front loaded. Less for the client machine to do in hopes to make it easier on our RMM and on the machines they are running on.
I totally get that if the RMM is pushing a script either it works or it doesn't regardless of its complexity, I am just trying to minimize variables to avoid issues on the client side.


I am totally happy maintaining a server that handles all of this, and maybe just calls back to the SMTP relay rather than adding in the Telegram/Other API etc.

Now that I've like fully typed out my situation and thoughts, its becoming obvious that I'm gonna have to write it myself lol

Link to post
Share on other sites

3 hours ago, UltraSCSI said:
Send-MailMessage -From $SMTPUsername -To $emailTo -Subject $MailSubject -Body $MailBody -SmtpServer $SMTPServer -Port $SMTPPort -Credential $credentials -UseSsl

I'd make 3 attempts (try/catch) with 60s cooldown between them.
Then I'd tell it to make 3 more attempts from a secondary email account (preferably one that doesn't use the same mail server).

 

4 hours ago, UltraSCSI said:

You are totally correct here, I guess what I really mean is less front loaded. Less for the client machine to do in hopes to make it easier on our RMM and on the machines they are running on.

Yeah but sending out e-mails is such a low load for the client machines. And pushing a single ps script per client shouldn't be a considerable load for the RMM either...
Unless if you have a huge amount of client machines, in which case it might be a considerable load on your mail server as well.

 

4 hours ago, UltraSCSI said:

Now that I've like fully typed out my situation and thoughts, its becoming obvious that I'm gonna have to write it myself lol

Hey, as long as it gets the job done.
Sure writing your own might make it prone to bugs, but implement someone eases solution and you have a new "tech debt". (that is if you can even find one that fits your use the way you want it)

Link to post
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

×