Deploy Seyren with Grafana on Ubuntu 14.04

Seyren (/ˈsaɪ.rʌn/) 是一款基于Graphite的报警平台,它支持下面这些报警通知方式:

安装

Prerequisites/依赖软件

特别注意: Seyren目前只支持MongoDB 3.0版本,在安装的时候一定要特别注意使用正确的版本。

Run/下载并运行软件包

1
2
3
4
wget https://github.com/scobal/seyren/releases/download/1.3.0/seyren-1.3.0.jar
export GRAPHITE_URL=http://graphite.foohost.com:80
java -jar seyren-1.3.0.jar
open http://localhost:8080

To run seyren on another port:
指定Seyren的端口,默认使用8080端口:

1
2
export SEYREN_URL="http://localhost:8081/seyren"
java -jar seyren-1.3.0.jar -httpPort=8081

邮件报警界面

报警邮件

Config

The following options can be supplied as system properties or environment variables.
有趣的是,Seyren的很多配置是通过定义环境变量的方式来实现的,并没有专门的配置文件来定义这些设置,具体的变量信息,参考下面的介绍:
(注意:设置Base中的变量就能保证Seyren的正常运行)

Base
  • MONGO_URL - The Mongo connection string. / MongoDB的地址,默认是:mongodb://localhost:27017/seyren
  • SEYREN_URL - The location of your Seyren instance. / Seyren服务器的地址. 默认是: http://localhost:8080/seyren
  • SEYREN_LOG_PATH - The path of seyren.log. Default: ``. If a value is set, it must end with a ‘/‘. / Seyren日志seyren.log的存放路径,默认为空;如果要设置,则路径名称必须以”/“结尾;
  • SEYREN_LOG_FILE_LEVEL - The level of messages logged to the file appender (must correspond to a Logback log level. So one of trace, debug, info, warn or error). Default: info. / 定义日志的记录级别,各级别如下:trace, debug, info, warn or error
  • SEYREN_THREADS - The number of pooled check threads to start. / Seyren发起查检请求的并发数,默认为8
  • GRAPHS_ENABLE - Show(true) or hide(false) graphs in check page. Default: true. / 设置是否在check页面显示监控图,默认为true即显示监控图表。

以下为一些非必须的扩展选项,可按需查看使用

Graphite
  • GRAPHITE_URL - The location of your Graphite server. Default: http://localhost:80
  • GRAPHITE_REFRESH - The fixed period (in ms) between checks. Default: 60000
  • GRAPHITE_USERNAME - The HTTP Basic auth username for the Graphite server. Default: ``
  • GRAPHITE_PASSWORD - The HTTP Basic auth password for the Graphite server. Default: ``
  • GRAPHITE_KEYSTORE - The HTTP KeyStore path for the https Graphite server. Default: ``
  • GRAPHITE_KEYSTORE_PASSWORD - The HTTP KeyStore password for the HTTPS Graphite server. Default: ``
  • GRAPHITE_TRUSTSTORE - The HTTP TrustStore path for the https Graphite server. Default: ``
  • GRAPHITE_CONNECTION_REQUEST_TIMEOUT - The number of millisconds to wait to obtain a connection from the pool. Default: 0 (infinite)
  • GRAPHITE_CONNECT_TIMEOUT - The number of milliseconds to wait to establish a connection. Default: 0 (infinite)
  • GRAPHITE_SOCKET_TIMEOUT - The number of milliseconds to wait for request data. Default: 0 (infinite)
Email
  • SMTP_HOST - The smtp server to send email notifications from. Default: localhost
  • SMTP_PORT - The smtp server port. Default: 25
  • SMTP_FROM - The from email address for sending out notifications. Default: alert@seyren
  • SMTP_USERNAME - The smtp server username if authenticated SMTP is used. Default: ``
  • SMTP_PASSWORD - The smtp server password if authenticated SMTP is used. Default: ``
  • SMTP_PROTOCOL - The smtp server protocol if authenticated SMTP is used. Default: smtp
HTTP
  • HTTP_NOTIFICATION_URL - The url for a resource that contains a POST HTTP Method. Default: ``
BigPanda.io

Use a Big Panda App Key as Target when adding a new subscription.

  • BIGPANDA_NOTIFICATION_URL - The url for a resource that contains a POST HTTP Method. Default: ``
  • BIGPANDA_AUTH_BEARER - The Authorization Bearer header that is assigned to each customer by BigPanda. See Alerts API integration Default: ``
Flowdock

Use a Flow API token as Target when adding a new subscription.

  • FLOWDOCK_EXTERNAL_USERNAME - The username that messages will be sent from to a flow. Default: Seyren
  • FLOWDOCK_TAGS - Special tags to add to all messages. Default: ``
  • FLOWDOCK_EMOJIS - Mapping between state and emojis unicode. Default: ``
HipChat
  • HIPCHAT_AUTHTOKEN - The hipchat api auth token. Default: ``
  • HIPCHAT_USERNAME - The username that messages will be sent from. Default: Seyren Alert
Hubot
  • HUBOT_URL - The location where Hubot is running. Default ``
IRCcat
  • IRCCAT_HOST - The hostname of the server where IRCcat is running. Default: localhost
  • IRCCAT_PORT - The port on which IRCcat is running. Default: 12345
PagerDuty
  • No system properties or environment variables here, but in “Subscriptions dialog box”, set the target field with a “Service API Key”.
    To generate a “Service API Key”, see PagerDuty Support: Adding Services, section “Use our API directly”.
Pushover
  • PUSHOVER_APP_API_TOKEN - Your pushover App API Token
Real-time metrics
  • GRAPHITE_CARBON_PICKLE_ENABLE - Enable a TCP server to listen Carbon relay pickle protocol. Default: false
  • GRAPHITE_CARBON_PICKLE_PORT - The TCP server port. Default: 2004
Slack

The target for a Slack subscription will be the channel name (including the #, for example #channel). You can optionally suffix the channel name with ! and that will cause the alerts to include a @channel mention (for example #channel!).

  • SLACK_TOKEN - The Slack api auth token. Default: ``
  • SLACK_USERNAME - The username that messages will be sent to slack. Default: Seyren
  • SLACK_ICON_URL - The user icon URL. Default: ``
  • SLACK_EMOJIS - Mapping between state and emojis unicode. Default: ``
SNMP
  • SNMP_HOST - The SNMP host. Default: localhost
  • SNMP_PORT - The SNMP port. Default: 162
  • SNMP_COMMUNITY - The SNMP community. Default: public
  • SNMP_OID - The SNMP OID. Default: 1.3.6.1.4.1.32473.1
TEMPLATE
  • TEMPLATE_EMAIL_FILE_PATH - The path to the velocity template used when emailing an alert. Seyren will first attempt to load from the class path, but will fall back to loading from the filesystem. Default: com/seyren/core/service/notification/email-template.vm"
  • TEMPLATE_EMAIL_SUBJECT_FILE_PATH - The path to the velocity template used for subject when emailing an alert. Seyren will first attempt to load from the class path, but will fall back to loading from the filesystem. Default: com/seyren/core/service/notification/email-subject-template.vm"
Twilio
  • TWILIO_ACCOUNT_SID - The Twilio Account SID. Default ``
  • TWILIO_AUTH_TOKEN - The Twilio Auth Token. Default ``
  • TWILIO_PHONE_NUMBER - The Twilio phone number to use to send SMS. Default ``
  • TWILIO_URL - The Twilio API URL. Mostly useful for testing. Default https://api.twilio.com/2010-04-01/Accounts
Victorops
  • VICTOROPS_REST_ENDPOINT - The REST Endpoint given by Victorops. See REST Integration Default ``
Proxy

The Proxy settings are changed by using JAVA_OPTS. It important that you exclude your graphite server or you will proxy these requests also.

  • JAVA_OPTS Example JAVA_OPTS=”-server -Dhttps.proxyHost=PROXYSERVER -Dhttps.proxyPort=PROXYPORT -Dhttp.proxyHost=PROXYSERVER -Dhttp.proxyPort=PROXYPORT -Dhttp.nonProxyHosts=GRAPHITESERVER|*YOURDOMAIN.COM|INTERNALHIPCHAT

Seyren API

See Seyren API

Chef

You can use Seyren Cookbook to deploy Seyren with Chef.

Docker

You can use the Docker Seyren Image to deploy a seyren instance in a docker container.

Docker compose

You can use docker-compose to create containers and hack seyren.
First, you need to install Docker and Docker Compose.
Then, you just need to start Docker Compose:

1
docker-compose up

and open http://localhost:8080/seyren.
Graphite is available on http://localhost:8081/ with Basic Auth guest/guest.

Init script

Seyren-Init is an init.d script which allows you to start the service.

Development

Build Status

To run the acceptance tests with Maven:

1
mvn clean verify

To run the integration tests with Maven:

1
mvn clean verify -Pkarma

To fire-up the app using Maven and wait (meaning you can run the tests separately from your IDE):

1
mvn clean verify -Dwait

You should then be able to browse to http://localhost:8080/seyren and have a play.

To package up a new jar file without running the tests:

1
2
3
mvn package -DskipTests
# Set environment variables as needed.
java -jar seyren-web/target/seyren-web-*-war-exec.jar

本文参考该Github项目中的Readme:https://github.com/scobal/seyren