GithubHelp home page GithubHelp logo

moskit / m-script Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 2.0 4.67 MB

Server monitoring & management solution made the Unix way

Home Page: http://m-script.com

Shell 95.88% JavaScript 1.25% CSS 2.48% HTML 0.08% Roff 0.03% Python 0.29%

m-script's Introduction

Introduction

M-Script is a project intended to combine the flexibility of traditional Unix approach, simplicity of Unix shell and power of native Linux system utilities to a single server management solution.

M-Script is, basically, a collection of shell scripts for various server management tasks. Each of the scripts can be run separately when/if needed, but bound together they form a well-integrated solution, still flexible because it is easy to combine/pipe/edit shell scripts to make them do exactly what you need.

It is based upon the main Unix Way principles :

  • Write programs that do one thing and do it well.
  • Write programs to work together.
  • Write programs to handle text streams, because that is a universal interface.
  • And, of course, the KISS principle

Functionality

M-Script is designed to help in:

  • Monitoring
  • Backups
  • Administration tasks scripting
  • Cloud and clusters management: auto-scalability based on monitoring, tasks execution on multiple servers, synchronizing files and folders across multiple servers (clusters, super-clusters, cluster groups, regions, clouds)

Features

  • Pluggable monitoring modules
  • 3-level alerting system with filtering
  • Easy watchdogs creation
  • Monitoring data database (SQLite)
  • Monitoring data graphs
  • Flexible multi-config databases/files backups, local and/or remote
  • Remote backups: to/from, FTP, SCP, Rsync, S3, EC2 EBS snapshots
  • Cloud servers management: servers and images creation/deletion, auto-scalability, programmable deployment system, load balancing, EC2 Route53 DNS support
  • Dashboard web interface, easily scriptable to allow custom monitors/actions integration

Usage Example – Auto-scalability

You found out that you get the users activity peak each time it gets rainy in London. So what you want is to start one additional Amazon EC2 instance and add it to your application servers cluster.

First you need a custom monitoring plugin. In our case it is going to be a London weather monitoring plugin.

All it has to do is provide output lines starting with if the weather is sunny, or one of three alert levels if not, like this:

  • Weather in London: Sunny
  • <*> Weather in London: Rainy
  • <**> Weather in London: Heavy Rain
  • <***> Weather in London: Rain / Thunder

So here is the plugin (in Unix shell, but you can use whatever you think is a better fit):


#!/bin/bash

weather=`/usr/bin/curl -s http://rss.weather.com/weather/rss/local/UKXX0085 \
| grep \<description\> | grep wxicons | awk -F'/>' '{print $2}' | sed 's|For more.*$||'`
[[ $weather =~ Sunny ]] && echo "<OK> Weather in London: Sunny" && exit 0
[[ $weather =~ Rain ]] && [[ $weather =~ Thunder ]] && \
echo "<***> Weather in London: Rain / Thunder" && exit 0
[[ $weather =~ Heavy\ Rain ]] && echo "<**> Weather in London: Heavy Rain" && exit 0
[[ $weather =~ Rain ]] && echo "<*> Weather in London: Rainy" && exit 0
echo "<OK> Weather in London: Cloudy"

Now, you want to start one additional application server if it becomes rainy, two servers if the rain is heavy, and three servers if it’s a thunderstorm. This is done in the actions configuration file conf/actions.conf:


Weather\ in\ London|1|create_node --cluster=application --number=1
Weather\ in\ London|2|create_node --cluster=application --number=2
Weather\ in\ London|3|create_node --cluster=application --number=3
Weather\ in\ London|0|destroy_node --cluster=application --last

where ‘application’ is your application servers cluster name defined in conf/cluster.conf

That’s all.

This is only one of possible scalability scenarios. You can make it less aggressive starting up one server at a time, define how often servers can start, minimal and maximal numbers and so on. See M-Script Wiki for details.

m-script's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.