GithubHelp home page GithubHelp logo

ralyodio / kimsufi-alert Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 3.0 173 KB

Kimsufi alert will send you an email or SMS when an OVH kimsufi server is available for purchase.

License: MIT License

JavaScript 100.00%

kimsufi-alert's Introduction

kimsufi-alert

Kimsufi alert will send you an email or SMS when an OVH kimsufi server is available for purchase.

node.js (required)

#mac
brew install node

Other OS (windows, linux) should install from source found at http://nodejs.org

install

git clone [email protected]:chovy/kimsufi-alert.git
cd kimsufi-alert
npm install

# add a cronjob to periodically check
crontab -e

# add this line (runs every 5 minutes)
*/5 * * * * /usr/local/bin/node ~/path/to/kimsufi-alert/index.js

configure

Create a custom config file and edit as desired:

cp config.sample.json config.json

Be sure to update with your real smtp and sms settings. Either notification service can be disabled.

You can also remove/add your desired packages and zones to monitor in your custom config file (see list below).

The host and port are hardcoded (not read from process.env). The other SMS details and SMTP credentials are taken from the environment (do not hardcode them in the config file).

You can change the name of the ENV variable, but the defaults should be fine.

	"env": {
		"smtp": {
			"host": "smtp.gmail.com", //hardcoded
			"port": 465, //hardcoded
			"user": "SMTP_USER", //read from process.env.SMTP_USER
			"pass": "SMTP_PASS" //read from process.env.SMTP_PASS
		},
		"sms": {
			"sid": "TWILIO_ACCOUNT_SID", //read from process.env.TWILIO_ACCOUNT_SID
			"auth": "TWILIO_AUTH_TOKEN"  //read from process.env.TWILIO_AUTH_TOKEN 
		}
	},

If you're not sure what your SMTP settings are, you can find the common providers here:

https://github.com/andris9/nodemailer-wellknown/blob/master/services.json

Set your SMTP user and password environment variables to receive email notifications:

# in ~/.bashrc
export [email protected]
export SMTP_PASS=xyz
. ~/.bashrc

# from command line execution (ie: crontab)
[email protected] SMTP_PASS=xyz /usr/local/bin/node ~/path/to/kimsufi-alert/index.js

Set your SMS Twilio provider environment variables to receive sms notifications:

# in ~/.bashrc
export TWILIO_ACCOUNT_SID=aaa
export TWILIO_AUTH_TOKEN=bbb

# from command line execution (ie: crontab)
TWILIO_ACCOUNT_SID=aaa TWILIO_AUTH_TOKEN=bbb /usr/local/bin/node ~/path/to/kimsufi-alert/index.js

Twilio is the only SMS provider supported, they will give you a SEND FROM phone number, and you can then send to any phone number once you sign up.

running

Best from a cronjob on periodic intervals:

cd kimsufi-alert

# edit config.json first (copied from config.sample.json)

./index.js

# ignore last run and force it to send a notification (good for testing)
./index.js --force 

# from crontab (must run node explicitly)
crontab -e
*/5 * * * * [email protected] SMTP_PASS=xyz TWILIO_ACCOUNT_SID=aaa TWILIO_AUTH_TOKEN=bbb /usr/local/bin/node /path/to/kimsufi-alert/index.js

Be default, kimsufi-alert will only send a notification if the results are different than the last run. This avoids getting spammed with email and sms every 5 minutes.

available server packages

Add the packages you want to monitor to your config.json file under servers

  • KS-1
  • KS-2
  • KS-3
  • KS-4
  • KS-5A
  • KS-5B
  • KS-6

available zones (data centers)

Add the zones you want to monitor to your config.json file under zones

  • bhs: Beauharnois, Canada (Americas)
  • gra: Gravelines, France
  • rbx: Roubaix, France (Western Europe)
  • sbg: Strasbourg, France (Central Europe)
  • par: Paris, France

Inspired by https://github.com/MA3STR0/kimsufi-crawler (Python kimsufi crawler by MA3STR0)

LICENSE: MIT

kimsufi-alert's People

Contributors

anthonyettinger avatar chovy avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

kimsufi-alert's Issues

Uncomment service nodemailer

In your readme, you should recommend to uncomment line 157 to receive email, otherwise an exception is thrown.

Thanks you for sharing your code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.