Page tree
Skip to end of metadata
Go to start of metadata

MoSKito Control Integrations

MoSKito Control allows you to integrate some 3d-party services for sending notifications using plugins. This page contains step-by-step guides to integrate your services accounts into MoSKito Control.

Slack

MoSKito Contro allows you to integrate your slack team using custom bots. See https://api.slack.com/bot-users for more details.

Slack plugin has own configuration file, that must be located in resources folder (as moskitocontrol.json). Name of file specifies in plugins section of moskitocontrol.json config (without .json extention). MoSKito-control provides sample configuration named slack.json. Slack plugin can be configured to send status change notifications to different channels depends on old/new status and application, where this status changed.

To enable Slack notification include and configure Slack plugin.

1. Include Slack plugin

Add following to plugin section in your moskitocontrol.json configuration file.

{
  "name" : "SlackNotificationPlugin",
  "configurationName" : "slack",
  "className" : "org.moskito.control.plugins.slack.SlackPlugin"
}


Plugins section should look like:

"@pluginsConfig":{
    "@plugins": [
        ...    
  		{
            "name" : "SlackNotificationPlugin",
  			"configurationName" : "slack",
  			"className" : "org.moskito.control.plugins.slack.SlackPlugin"
  		},
        ...
    ]
}


2. Configure plugin

Slack configuration file has following fields.

  • botToken - bot API Token, witch can be obtained in bot setting page.
  • alertLink- an url which will be added to the alert. It can point to anything your want. But in case you want to point it to the moskito control frontend, use the setApplication link as shown in the example to open the proper application right-away.
  • baseImageUrlPath - MoSKito Control will display nice lamps to visualize the status. The images are downloaded from our server. You can replace them with your own images by providing custom url.
  • @channels - array of channel configurations. Manages sending messages to different channels depends on old/new status and application name, where status is changed.

Configuration file looks like this:

{
  "botToken" : "xxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx",
  "alertLink": "https://<yourhost>:<yourport>/moskito-control/control/setApplication?application=$APPLICATION",
  "baseImageUrlPath" : "http://www.moskito.org/applications/control/",
  "@channels" : {
      "applications" : ["APP"],
      "name" : "app-monitoring",
      "@notificationStatusChanges" : [
        {
	      "oldColors" : ["GREEN"],
		  "newColors" : ["RED"]
	    }
      ]
   }
}

Each channel contains following attributes:

  • name - name of the channel
  • applications - list of applications which can send alerts to this channel (Applications are defined in moskitocontrol.json)
  • @notificationStatusChanges - list of old/new status criterias to fire notification. Each list element includes two arrays named oldColors and newColorsoldColors array indicates old statuses condition to send notification to this channel. Only status changed from statuses in this array will be notified. If array is empty - any statuses pass. newColors same as old, but specifies new statuses. notificationStatusChanges attribute can be not stated. In that case any from/to status changes of specified applications components be notified.

Example1 - Components from application FOO with new RED and GREEN/YELLOW old status will send notifications to foo-monitoring channel:

...
"@channels" : [
    {
      "applications" : ["FOO"],
      "name" : "foo-monitoring",
      "@notificationStatusChanges" : [
        {
	      "oldColors" : ["GREEN", "YELLOW"],
		  "newColors" : ["RED"]
	    }
      ]
    }
]
...


Example2 - Components of applications PROD1 and PROD2 will send notifications to channel prod-monitoring-red, if status chanes to RED or to prod-monitoring-green, if status changes to GREEN:

...
"@channels" : [
  {
    "applications" : ["PROD1", "PROD2"],
    "name" : "prod-monitoring-red",
    "@notificationStatusChanges" : [
      {
         "oldColors" : [],
	     "newColors" : ["RED"]
      }
    ]
  },
  {
    "applications" : ["PROD1", "PROD2"],
    "name" : "prod-monitoring-green",
    "@notificationStatusChanges" : [
      {
         "oldColors" : [],
	     "newColors" : ["GREEN"]
      }
    ]
  },
]
...


You can combine any amount of channel configurations with any notification status changes. Same application can send events in different channel.

3. Run MoSKito Control

Now Slack notifications is enabled. Bot will send messages to Slack channels each time components status chage.


Opsgenie

MoSKito Control allows you to integrate your OpsGenie account for sending alerts on components status change.

OpsGenie plugin has own configuration file, that must be located in resources folder (same as moskitocontrol.json). Name of file specifies in plugins section of moskitocontrol.json config. MoSKito-control provides sample configuration named opsgenie.json. OpsGenie plugin can be configured to send alerts to various recipients and teams with different tags depends on old/new status and application, where this status changed.

To enable OpsGenie notification include and configure OpsGenie plugin.

1. Include OpsGenie plugin

Add following to plugin section in your moskitocontrol.json configuration file.

{
  "name" : "OpsGenieNotificationPlugin",
  "configurationName" : "opsgenie",
  "className" : "org.moskito.control.plugins.opsgenie.OpsgeniePlugin"
}

Plugins section should look like:

"@pluginsConfig":{
    "@plugins": [
      ...
      {
  	  	  "name" : "OpsGenieNotificationPlugin",
  		  "configurationName" : "opsgenie",
 		  "className" : "org.moskito.control.plugins.opsgenie.OpsgeniePlugin"
	  },
  	  ...
    ]

}


2. Configure plugin

OpsGenie plugin config file has following fields:

  • alertSender - source of alert
  • alertEntity the entity alert is related to
  • apiKey - OpsGenie api integration key of your account.
  • @notifications- list, that specifies alert configurations for different applications and old/new statuses.

Configuration file would look like this:

{
  "alertSender" :"MoSKito-Control",
  "alertEntity" : "Status changed",
  "@notifications" : [
    {
      "recipients" : ["recipient1@anotheria.net"],
      "teams" : ["sample_team"],
      "tags" : ["tag1", "tag2"]
    },
    {
      "recipients" : ["recipient2@anotheria.net"],
      "teams" : ["sample_team"],
      "tags" : ["tag3"]
    }
  ],
  "apiKey" : "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Each notification configuration contains:

  • recipients list of users, groups, schedule or escalation names to calculate which users will receive the notifications of the alert. 
  • teams  list  of team names which will be responsible for the alert. 
  • tags - list of labels attached to this alert.
  • applications - list of applications which can send alerts to this channel (Applications are defined in moskitocontrol.json)
  • @notificationStatusChanges - list of old/new status criterias to send alerts. Each list element includes two arrays named oldColors and newColorsoldColors array indicates old statuses condition to send alerts with configured filling. Only status changed from statuses in this array will be notified. If array is empty - any statuses pass. newColors same as old, but specifies new statuses. notificationStatusChanges attribute can be not stated. In that case any from/to status changes of specified applications components be notified.

Example1 - If status of application FOO component changes from GREEN/YELLOW to RED alert will be send. It will have recipient with email foo-recipient@anotheria.netfoo-team be responsible for this alert and it will contain RED and foo-status-changes tags.

...
"@notifications" : [
  {
    "recipients" : ["foo-recipient@anotheria.net"],
	"teams" : ["foo-team"],
	"tags" : ["RED", "foo-status-changes"]
	"applications" : ["FOO"],
	"@notificationStatusesChanges" : [
      {
        "oldColors" : ["GREEN", "YELLOW"],
        "newColors" : ["RED"]
      }
    ]
  }
]
...

Example2 - If status of application FOO component changes from any to RED new alert will have recipient with email app-recipient@anotheria.netred-team be responsible for this alert and it will contain RED-tag. If status of this application component changes to GREEN -  green-team be responsibe and GREEN-tag be attached.

...
"@notifications" : [
  {
    "recipients" : ["app-recipient@anotheria.net"],
	"teams" : ["red-team"],
	"tags" : ["RED-tag"]
	"applications" : ["FOO"],
	"@notificationStatusesChanges" : [
      {
        "oldColors" : [],
        "newColors" : ["RED"]
      }
    ]
  },
  {
    "recipients" : ["app-recipient@anotheria.net"],
	"teams" : ["green-team"],
	"tags" : ["GREEN-tag"]
	"applications" : ["FOO"],
	"@notificationStatusesChanges" : [
      {
        "oldColors" : [],
        "newColors" : ["GREEN"]
      }
    ]
  }
]
...

3. Run MoSKito Control

From now OpsGenie notifications is enables. MoSKito Control will send alerts to your OpsGenie account on specified components status change.

Email

MoSKito Contro allows you to send email notifications on components status changes using Mail notification plugin. Plugin sends email via SMTP server, so you must have one to make it work.

Mail plugin has own configuration file, that must be located in resources folder (same as moskitocontrol.json). Name of file specifies in plugins section of moskitocontrol.json config. MoSKito-control provides sample configuration named mail.json. Mail plugin can be configured to send status change notifications to different emails depends on old/new status and application, where this status changed.

To enable email notification include and configure Mail plugin (Also SMTP server is required).

1. Include email plugin

Add following to plugin section in your moskitocontrol.json configuration file.

{
  "name" : "MailNotificationPlugin",
  "configurationName" : "mail",
  "className" : "org.moskito.control.plugins.mail.MailPlugin"
}

Plugins section should look like:

"@pluginsConfig":{
    "@plugins": [
      ...
      {
        "name" : "MailNotificationPlugin",
        "configurationName" : "mail",
        "className" : "org.moskito.control.plugins.mail.MailPlugin"
	  },
  	  ...
    ]

}

2. Configure plugin

Mail plugin config file has following fields:

  • defaultMessageSender - Email address of notification sender. 
  • defaultMessageSubject - Subject of notification message.
  • host - your SMTP server host.
  • port - your SMTP server port.
  • user - your SMTP server account username. Can be set to any if authorization is not required.
  • password - your SMTP server account password. Can be set to any if authorization is not required.
  • debug - boolean. if true - debug info will be displayed in MoSKito-Control logs.
  • @notifications  list, that specifies email configurations for different applications and old/new statuses.

Configuration file would look like this:

{
  "defaultMessageSender" :"moskito-control@anotheria.net",
  "defaultMessageSubject" : "Status changed",
  "@notifications" : [
    {
      "applications" : ["APP1"],
      "recipients" : ["recipient1@anotheria.net"],
      "@notificationStatusChanges" : [
        {
          "newColors" : ["RED", "PURPLE"],
          "oldColors" : ["NONE"]
        }
      ]
    },
    {
      "applications" : ["APP2"],
      "recipients" : ["recipient2@anotheria.net"],
      "@notificationStatusChanges" : [
        {
          "newColors" : ["RED", "PURPLE", "GREEN"],
          "oldColors" : []
        }
      ]
    }
  ],
  "host" : "mail.anotheria.net",
  "port" : 25,
  "user" : "moskito@anotheria.net",
  "password" : "moskito",
  "debug" : true
}

Each notification configuration contains:

  • recipients - list of emails to send notifications. 
  • applications - list of applications which can send emails to this recipients (Applications are defined in moskitocontrol.json)
  • @notificationStatusChanges - list of old/new status criterias to fire notification. Each list element includes two arrays named oldColors and newColorsoldColors array indicates old statuses condition to send notification to recipients. Only status changed from statuses in this array will be notified. If array is empty - any statuses pass. newColors same as old, but specifies new statuses. notificationStatusChanges attribute can be not stated. In that case any from/to status changes of specified applications components be notified.

Example1 - If status of application FOO component changes from GREEN/YELLOW to RED email will be send. It will have recipient with email foo-recipient@anotheria.net.

...
"@notifications" : [
  {
    "recipients" : ["foo-recipient@anotheria.net"],
	"applications" : ["FOO"],
	"@notificationStatusesChanges" : [
      {
        "oldColors" : ["GREEN", "YELLOW"],
        "newColors" : ["RED"]
      }
    ]
  }
]
...

Example2 - If status of application FOO component changes from any to RED new email be send to app-recipient-1@anotheria.net and app-recipient-2@anotheria.net. If status of this application component changes to GREEN - email be send only to app-recipient-3@anotheria.net.

...
"@notifications" : [
  {
    "recipients" : ["app-recipient-1@anotheria.net", "app-recipient-2@anotheria.net"],
	"applications" : ["FOO"],
	"@notificationStatusesChanges" : [
      {
        "oldColors" : [],
        "newColors" : ["RED"]
      }
    ]
  },
  {
    "recipients" : ["app-recipient-3@anotheria.net"],
	"applications" : ["FOO"],
	"@notificationStatusesChanges" : [
      {
        "oldColors" : [],
        "newColors" : ["GREEN"]
      }
    ]
  }
]
...

3. Run MoSKito Control

From now email notifications is enables. MoSKito Control will send mails to your emails on components status changes.

Mattermost

MoSKito Contro allows you to integrate your mattermost instance to send notification on components status change.

Mattermost plugin has own configuration file, that must be located in resources folder (same as moskitocontrol.json). Name of file specifies in plugins section of moskitocontrol.json config. MoSKito-control provides sample configuration named mattermost.json. Mattermost plugin can be configured to send status change notifications to different channels depends on old/new status and application, where this status changed.

To enable Mattermost notification include and configure Mattermost plugin.

1. Include Mattermost plugin

Add following to plugin section in your moskitocontrol.json configuration file.

{
  "name" : "MattermostNotificationPlugin",
  "configurationName" : "mattermost",
  "className" : "org.moskito.control.plugins.mattermost.MattermostPlugin"
}


Plugins section should look like:

"@pluginsConfig":{
    "@plugins": [
        ...    
  		{
            "name" : "MattermostNotificationPlugin",
  			"configurationName" : "mattermost",
  			"className" : "org.moskito.control.plugins.mattermost.MattermostPlugin"
  		},
        ...
    ]
}


2. Configure plugin

Mattermost configuration file has following fields.

  • host - your mattermost instance host.
  • teamName - name of your mattermost team.
  • username - username of your mattermost instance account that joined to your team and channels, specified in config.
  • password- password of your mattermost instance account.
  • alertLink- an url which will be added to the alert. It can point to anything your want. But in case you want to point it to the moskito control frontend, use the setApplication link as shown in the example to open the proper application right-away.
  • baseImageUrlPath - MoSKito Control will display nice lamps to visualize the status. The images are downloaded from our server. You can replace them with your own images by providing custom url.
  • @channels - array of channel configurations. Manages sending messages to different channels depends on old/new status and application name, where status is changed.

Configuration file looks like this:

{
  "host" : "https://yourmattermosthost:8065"
  "teamName" : "yourteamname",
  "username" : "username",
  "password" : "*********",
  "alertLink": "https://<yourhost>:<yourport>/moskito-control/control/setApplication?application=$APPLICATION",
  "baseImageUrlPath" : "http://www.moskito.org/applications/control/",
  "@channels" : {
      "applications" : ["APP"],
      "name" : "app-monitoring",
      "@notificationStatusChanges" : [
        {
	      "oldColors" : ["GREEN"],
		  "newColors" : ["RED"]
	    }
      ]
   }
}

Each channel contains following attributes:

  • name - name of the channel
  • applications - list of applications which can send alerts to this channel (Applications are defined in moskitocontrol.json)
  • @notificationStatusChanges - list of old/new status criterias to fire notification. Each list element includes two arrays named oldColors and newColorsoldColors array indicates old statuses condition to send notification to this channel. Only status changed from statuses in this array will be notified. If array is empty - any statuses pass. newColors same as old, but specifies new statuses. notificationStatusChanges attribute can be not stated. In that case any from/to status changes of specified applications components be notified.

Example1 - Components from application FOO with new RED and GREEN/YELLOW old status will send notifications to foo-monitoring channel:

...
"@channels" : [
    {
      "applications" : ["FOO"],
      "name" : "foo-monitoring",
      "@notificationStatusChanges" : [
        {
	      "oldColors" : ["GREEN", "YELLOW"],
		  "newColors" : ["RED"]
	    }
      ]
    }
]
...


Example2 - Components of applications PROD1 and PROD2 will send notifications to channel prod-monitoring-red, if status chanes to RED or to prod-monitoring-green, if status changes to GREEN:

...
"@channels" : [
  {
    "applications" : ["PROD1", "PROD2"],
    "name" : "prod-monitoring-red",
    "@notificationStatusChanges" : [
      {
         "oldColors" : [],
	     "newColors" : ["RED"]
      }
    ]
  },
  {
    "applications" : ["PROD1", "PROD2"],
    "name" : "prod-monitoring-green",
    "@notificationStatusChanges" : [
      {
         "oldColors" : [],
	     "newColors" : ["GREEN"]
      }
    ]
  },
]
...


You can combine any amount of channel configurations with any notification status changes. Same application can send events in different channel.

3. Run MoSKito Control

Now Mattermost notifications is enabled. Bot will send messages to Mattermost channels each time components status chage.

Log File

MoSKito Control can write status changes of components to file using Log File plugin.

Plugin writes following line for each status change:

{timestamp} {application}:{component} {oldStatus} [{oldStatusMessage}] -> {newStatus} [{newStatusMessage}]

Where:

  • timestamp - status change time in form of ISO8601 timestamp in form of YYYY-MM-DDTHH:MM:SS,zzz .
  • application - application name where status changed.
  • component - component name where status changed.
  • oldStatus - old status color.
  • oldStatusMessage - message of old status.
  • newStatus - new status color.
  • newStatusMessage - message of new status.

Example:

2017-06-06T21:50:18,465 PROD:search01 NONE [None yet] -> PURPLE [Can't connect to the PROD.search01]


Log File plugin has own configuration file, that must be located in resources folder (same as moskitocontrol.json). Name of file specifies in plugins section of moskitocontrol.json config. MoSKito-control provides sample configuration named logfile.json. Log File plugin can be configured to write status changes to different files depends on old/new status and application, where this status changed.

To enable status change logging include and configure Log File plugin.

1. Include log file plugin.

Add following to plugin section in your moskitocontrol.json configuration file.

{
  "name" : "LogFileNotificationPlugin",
  "configurationName" : "logfile",
  "className" : "org.moskito.control.plugins.logfile.LogFilePlugin"
}


Plugins section should look like:

"@pluginsConfig":{
    "@plugins": [
        ...    
  		{
          "name" : "LogFileNotificationPlugin",
          "configurationName" : "logfile",
          "className" : "org.moskito.control.plugins.logfile.LogFilePlugin"
        },
        ...
    ]
}

2. Configure plugin

Configuration contain only @files field. It`s an array of configurations for each log file.

Log file configuration consists of following attributes:

  • path -  path to log file.
  • applications - list of applications which can write status changes to this file (Applications are defined in moskitocontrol.json)
  • @notificationStatusChanges - list of old/new status criterias to write log. Each list element includes two arrays named oldColors and newColorsoldColors array indicates old statuses condition to write log. Only status changed from statuses in this array will be notified. If array is empty - any statuses pass. newColors same as old, but specifies new statuses. notificationStatusChanges attribute can be not stated. In that case any from/to status changes of specified applications components be notified.

Plugin configuration should look like this:

{
  "@files" : [
    {
      "path" : "/path/to/log",
      "applications": ["APP1", "APP2"],
      "@notificationStatusChanges" : [
        {
          "oldColors": ["PURPLE"],
          "newColors": ["RED"]
        },
        {
          "oldColors": ["PURPLE"],
          "newColors": ["YELLOW"]
        }
      ]
    },
    {
      "applications" : ["APP3"],
      "path" : "/path/to/log"
    }
  ]
}

Example1 - Logs be written to /path/to/log.log file if status of components of APP1 and APP2 changed from PURPLE to RED or from GREEN to YELLOW:

{
  "@files" : [
    {
      "path" : "/path/to/log.log",
      "applications": ["APP1", "APP2"],
      "@notificationStatusChanges" : [
        {
          "oldColors": ["PURPLE"],
          "newColors": ["RED"]
        },
        {
          "oldColors": ["GREEN"],
          "newColors": ["YELLOW"]
        }
      ]
    }
  ]
}

Example2 - Logs be written to /path/to/log/app1.log file if status of components of APP1 changed from any to any. Logs be written to /path/to/log/app2-red.log file if status of components of APP2 changed from any to RED:

{
  "@files" : [
    {
      "path" : "/path/to/log/app1.log",
      "applications": ["APP1"]
    },
	{
	  "path" : "/path/to/log/app2-red.log",
      "applications" : ["APP2"],
      "@notificationStatusChanges" : [
        {
          "oldColors": [],
          "newColors": ["RED"]
        }
      ]
	}
  ]
}


3. Run MoSKito Control

Now status change log writing is enabled. Status change will be written to proper log files.


  • No labels