Commit Graph

2518 Commits

Author SHA1 Message Date
bergquist
2f35759346 asscoiate comment with name 2017-10-24 13:40:38 +02:00
bergquist
9b6535cca1 alerting: only editors can pause rules
closes #9640
2017-10-24 11:01:08 +02:00
stuart nelson
93ac6680ab update log15 (#9622)
* Update log15 and go-isatty

* Update usage in pkg log
2017-10-23 19:57:19 +02:00
Daniel Lee
7863a0417c plugins: fixes path issue on Windows
When loading a plugin and setting the path, an extra backslash sneaks
when running on Windows. Fixes #9597
2017-10-23 13:03:06 +02:00
Torkel Ödegaard
9cce5217d0 build: fixed gofmt issue and addd mock response feature 2017-10-23 09:57:28 +02:00
bergquist
139f077453 prometheus: enable gzip for /metrics endpoint
closes #9464
2017-10-23 09:35:46 +02:00
Torkel Ödegaard
1fd2270a93 build: split circle test shell scripts 2017-10-23 09:06:50 +02:00
bergquist
b3a8d93dca mysql: add usage stats for mysql 2017-10-19 10:30:54 +02:00
Sven Klemm
b2d880c6de modify $__timeGroup macro so it can be used in select clause (#9527)
* modify $__timeGroup macro so it can be used in select clause

* fix $__interval_ms for postgres datasource

* use $__timeGroup macro in documentation

* fix annotation template query
remove title since its no longer used and add tags instead

* change __timeFilter macro to work on postgresql < 8.1 and redshift
2017-10-18 18:10:01 +02:00
Carl Bergquist
43f039859a Merge pull request #9573 from cjchand/master
When Messasge field is set for an alert, map it to the output field i…
2017-10-18 12:10:42 +02:00
Alexander Zobnin
74e90d01ec Fixes for annotations API (#9577)
* annotations: throw error if no text specified and set default time to Now() if empty, #9571

* annotations: fix saving graphite event with empty string tags

* docs: add /api/annotations/graphite endpoint docs, #9571
2017-10-18 10:13:02 +02:00
Chris Chandler
204fe007b7 When Messasge field is set for an alert, map it to the output field in a Sensu check result. If Message is empty, send "Grafana Metric Condition Met" 2017-10-17 16:22:56 -05:00
krise3k
45a572ebd8 annotations: quote reserved fields (#9550) 2017-10-17 11:03:19 +02:00
Eric Dahl
888d608090 CloudWatch: Add ALB RequestCountPerTarget metric
This commit adds the new ALB metric `RequestCountPerTarget` which was
released in July 2017.
2017-10-14 21:50:23 -07:00
bergquist
ec14fa58b5 alerting: add count_non_null reducer
makes it possible to have a second condition requering
at least X points of data.
2017-10-13 09:47:10 +02:00
bergquist
b5727949fd logging: dont use cli logger in http_server 2017-10-12 15:29:01 +02:00
bergquist
88f55b01d8 oauth: raise error if session state is missing
ref #9476
2017-10-12 15:25:27 +02:00
bergquist
0848ba2e9c oauth: provide more logging for failed oauth requests 2017-10-12 15:25:27 +02:00
Carl Bergquist
b63725033e Merge pull request #9450 from utkarshcmu/kafka_alert
Kafka alerting
2017-10-12 12:11:13 +02:00
Carl Bergquist
ee5f69beb4 metrics: disable gzip for /metrics endpoint (#9468)
Prometheus client lib support gzip by itself. Which caused the
response to be double gzipped sometimes. We should use the Grafana
middle ware instead.

closes #9464
2017-10-12 12:02:36 +02:00
Carl Bergquist
9d53653647 Merge pull request #9378 from mattbostock/verify_tls
Bugfix: Always verify TLS unless explicitly told otherwise
2017-10-12 11:11:02 +02:00
bergquist
4ca3cc90dd Merge branch 'mattbostock-verify_datasource_tls' 2017-10-12 10:39:07 +02:00
Torkel Ödegaard
81a4df1372 fix: alert api limit param did not work and caused SQL syntax error, fixes #9492 2017-10-12 10:22:53 +02:00
bergquist
c0d257a0ee Merge branch 'verify_datasource_tls' of https://github.com/mattbostock/grafana into mattbostock-verify_datasource_tls 2017-10-12 10:15:32 +02:00
Alexander Zobnin
04ea7efac9 annotations: add endpoint for writing graphite-like events (#9495)
* annotations: add endpoint for writing graphite-like events

* annotations: fix new line handling in tooltip

* annotations: support tags in prior to Graphite 0.10.0 format
2017-10-12 10:12:15 +02:00
Torkel Ödegaard
2bc57d856c fix: set lastSeenAt date when creating users to then years in past insteasd of empty date, fixes #9260 2017-10-11 11:29:17 +02:00
Matt Bostock
4f3856adfb Retain old name for TLS client auth
I renamed `tlsAuth` to `tlsClientAuth` to better describe the fact that
this variable is used to enable TLS client authentication (as opposed to
server authentication) in c04d95f35.

However, changing the name breaks backwards compatibility for existing
installations using this feature and Grafana does not have a
standardised way of migrating changes in the schema:
https://github.com/grafana/grafana/pull/9377#issuecomment-333063543

For reasons of expediency given the severity of the bug (not verifying
TLS), keep the old name.
2017-10-11 08:18:04 +01:00
Matt Bostock
f6aa0e41e5 Return error if datasource TLS CA not parsed 2017-10-11 08:18:03 +01:00
Matt Bostock
5d312be419 Datasource HTTP settings: Add TLS skip verify
In c04d95f35 I changed the default for datasource HTTP requests so that
TLS is always verified.

This commit adds a checkbox to allow an admin to explicitly skip TLS
verification, for testing purposes.
2017-10-11 08:18:03 +01:00
Matt Bostock
a286ffa5f2 Alias macron package in app_routes.go
...to make this file compatible with goimports:
https://godoc.org/golang.org/x/tools/cmd/goimports
2017-10-11 08:18:03 +01:00
Matt Bostock
43169e4302 Verify datasource TLS and split client auth and CA 2017-10-11 08:18:03 +01:00
Matt Bostock
592c46c8b5 Tests: Clarify what InsecureSkipVerify does 2017-10-11 08:18:03 +01:00
Daniel Lee
d1c9760fa8 Postgres Data Source (#9475)
* add postgresql datasource

* add rest of files for postgres datasource

* fix timeseries query, remove unused code

* consistent naming, refactoring

* s/mysql/postgres/

* s/mysql/postgres/

* couple more tests

* tests for more datatypes

* fix macros for postgres

* add __timeSec macro

* add frontend for postgres datasource

* adjust documentation

* fix formatting

* add proper plugin description

* merge editor changes from mysql

* port changes from mysql datasource

* set proper defaultQuery for postgres

* add time_sec to timeseries query
accept int for value for timeseries query

* revert allowing time_sec and handle int or float values as unix
timestamp for "time" column

* fix tslint error

* handle decimal values in timeseries query

* allow setting sslmode for postgres datasource

* use type switch for handling data types

* fix value for timeseries query

* refactor timeseries queries to make them more flexible

* remove debug statement from inner loop in type conversion

* use plain for loop in getTypedRowData

* fix timeseries queries

* adjust postgres datasource to tsdb refactoring

* adjust postgres datasource to frontend changes

* update lib/pq to latest version

* move type conversion to getTypedRowData

* handle address types cidr, inet and macaddr

* adjust response parser and docs for annotations

* convert unknown types to string

* add documentation for postgres datasource

* add another example query with metric column

* set more helpful default query

* update help text in query editor

* handle NULL in value column of timeseries query

* add __timeGroup macro

* add test for __timeGroup macro

* document __timeGroup and set proper default query for annotations

* fix typos in docs

* add postgres to list of datasources

* add postgres to builtInPlugins

* mysql: refactoring as prep for merging postgres

Refactors out the initialization of the xorm engine and the query logic
for an sql data source.

* mysql: rename refactoring + test update

* postgres:refactor to use SqlEngine(same as mysql)

Refactored to use a common base class with the MySql data source.

Other changes from the original PR:
- Changed time column to be time_sec to allow other time units in the
future and to be the same as MySQL
- Changed integration test to test the main Query method rather than
the private transformToTable method
- Changed the __timeSec macro name to __timeEpoch
- Renamed PostgresExecutor to PostgresQueryEndpoint

Fixes #9209 (the original PR)

* postgres: encrypt password on config page

With some other cosmetic changes to the config page:
- placeholder texts
- reset button for the password after it has been encrypted.
- default value for the sslmode field.

* postgres: change back col name to time from time_sec

* postgres mysql: remove annotation title

Title has been removed from annotations

* postgres: fix images for docs page

* postgres mysql: fix specs
2017-10-10 15:19:14 +02:00
Alexander Zobnin
473c47cd1c snapshots: improve snapshot listing performance, #9314 (#9477)
exclude dashboard field from snapshot list search
2017-10-10 14:25:19 +02:00
utkarshcmu
da47dc8947 Fixed failing go tests 2017-10-09 18:56:05 -07:00
utkarshcmu
a562dc7c2b gofmt fixes 2017-10-09 18:27:04 -07:00
utkarshcmu
138bee99ef Added tests 2017-10-09 18:27:04 -07:00
utkarshcmu
d60339a9b1 Kafka REST Proxy works with Grafana 2017-10-09 18:27:04 -07:00
Daniel Lee
8423260f58 gzip: plugin readme content set explicitly
Macaron's gzip middleware tries to automatically figure out the content
type for a file when gzipped and seems to mostly fail with plugin
readmes. This change sets the content type to plain text.

Fixes #9344. Ref #5952.
2017-10-09 10:17:45 +02:00
Anton Hvornum
08dc08550c Corrected a PostgreSQL SELECT statement. (#9460)
At least in my Postgresql 9.6.5, the old syntax of capitalized queries doesn't work (Linux).<br>
Running with UTF-8 as standard encoding and the ` notations didn't work either, so removed those.
2017-10-08 20:37:16 +02:00
Torkel Ödegaard
25aa9df270 Create annotations (#8197)
* annotations: add 25px space for events section

* annotations: restored create annotation action

* annotations: able to use fa icons as event markers

* annotations: initial emoji support from twemoji lib

* annotations: adjust fa icon position

* annotations: initial emoji picker

* annotation: include user info into annotation requests

* annotation: add icon info

* annotation: display user info in tooltip

* annotation: fix region saving

* annotation: initial region markers

* annotation: fix region clearing (add flot-temp-elem class)

* annotation: adjust styles a bit

* annotations: minor fixes

* annoations: removed userId look in loop, need a sql join or a user cache for this

* annotation: fix invisible events

* lib: changed twitter emoij lib to be npm dependency

* annotation: add icon picker to Add Annotation dialog

* annotation: save icon to annotation table

* annotation: able to set custom icon for annotation added by user

* annotations: fix emoji after library upgrade (switch to 72px)

* emoji: temporary remove bad code points

* annotations: improve icon picker

* annotations: icon show icon picker at the top

* annotations: use svg for emoji

* annotations: fix region drawing when add annotation editor opened

* annotations: use flot lib for drawing region fill

* annotations: move regions building into event_manager

* annotations: don't draw additional space if no events are got

* annotations: deduplicate events

* annotations: properly render cut regions

* annotations: fix cut region building

* annotations: refactor

* annotations: adjust event section size

* add-annotations: fix undefined default icon

* create-annotations:  edit event (frontend part)

* fixed bug causes error when hover event marker

* create-annotations:  update event (backend)

* ignore grafana-server debug binary in git (created VS Code)

* create-annotations: use PUT request for updating annotation.

* create-annotations: fixed time format when editing existing event

* create-annotations: support for region update

* create-annotations: fix bug with limit and event type

* create-annotations: delete annotation

* create-annotations: show only selected icon in edit mode

* create-annotations: show event editor only for users with at least Editor role

* create-annotations: handle double-sized emoji codepoints

* create-annotations: refactor

use CP_SEPARATOR from emojiDef

* create-annotations: update emoji list, add categories.

* create-annotations: copy SVG emoji into public/vendor/npm and use it as a base path

* create-annotations: initial tabs for emoji picker

* emoji-picker: adjust styles

* emoji-picker: minor refactor

* emoji-picker: refactor - rename and move into one directory

* emoji-picker: build emoji elements on app load, not on picker open

* emoji-picker: fix emoji searching

* emoji-picker: refactor

* emoji-picker: capitalize category name

* emoji-picker: refactor

move buildEmojiElem() into emoji_converter.ts for future reuse.

* jquery.flot.events: refactor

use buildEmojiElem() for making emojis, remove unused code for font awesome based icons.

* emoji_converter: handle converting error

* tech: updated

* merged with master

* shore: clean up some stuff

* annotation: wip tags

* annotation: filtering by tags

* tags: parse out spaces etc. from a tags string

* annotations: use tagsinput component for tag filtering

* annotation: wip work on how we query alert & panel annotations

* annotations: support for updating tags in an annotation

* linting

* annotations: work on unifying how alert history annotations and manual panel annotations are created

* tslint: fixes

* tags: create tag on blur as well

Currently, the tags directive only creates the tag when the
user presses enter. This change means the tag is created on
blur as well (when the user clicks outside the input field).

* annotations: fix update after refactoring

* annotations: progress on how alert annotations are fetched

* annotations: minor progress

* annotations: progress

* annotation: minor progress

* annotations: move tag parsing from tooltip to ds

Instead of parsing a tag string into an array in the annotation_tooltip
class, this moves the parsing to the datasources. InfluxDB ds already
does that parsing. Graphite now has it.

* annotations: more work on querying

* annotations: change from tags as string to array

when saving in the db and in the api.

* annotations: delete tag link if removed on edit

* annotation: more work on depricating annotation title

* annotations: delete tag links on delete

* annotations: fix for find

* annotation: added user to annotation tooltip and added alertName to annoation dto

* annotations: use id from route instead from cmd for updating

* annotations: http api docs

* create annotation: last edits

* annotations: minor fix for querying annotations before dashboard saved

* annotations: fix for popover placement when legend is on the side (and doubel render pass is causing original marker to be removed)

* annotations: changing how the built in query gets added

* annotation: added time to header in edit mode

* tests: fixed jshint built issue
2017-10-07 10:31:39 +02:00
Matt Bostock
83f1ae4e3e OAuth: Rename sslcli
Rename `sslcli` to the more descriptive `oauthClient`.
2017-10-06 17:10:03 +01:00
Matt Bostock
ccf093da81 OAuth: Separate TLS client auth and CA config
It should be specify to either use TLS client authentication or use a
user-supplied CA; previously you had to enable client authentication to
use a custom CA.
2017-10-06 17:10:03 +01:00
Matt Bostock
f2f8ca52d9 OAuth: Check both TLS client cert and key
If either is set, try to use them.

This should help avoid a situation where someone has half-configured TLS
client authentication and it doesn't work without raising an obvious
error.
2017-10-06 17:10:03 +01:00
Matt Bostock
16c5d0e4b7 Always verify TLS unless explicitly told otherwise
TLS was not being verified in a number of places:

- connections to grafana.com

- connections to OAuth providers when TLS client authentication was
  enabled

- connections to self-hosted Grafana installations when using the CLI
  tool

TLS should always be verified unless the user explicitly enables an
option to skip verification.

Removes some instances where `InsecureSkipVerify` is explicitly set to
`false`, the default, to help avoid confusion and make it more difficult
to regress on this fix by accident.

Adds a `--insecure` flag to `grafana-cli` to skip TLS verification.

Adds a `tls_skip_verify_insecure` setting for OAuth.

Adds a `app_tls_skip_verify_insecure` setting under a new `[plugins]`
section.

I'm not super happy with the way the global setting is used by
`pkg/api/app_routes.go` but that seems to be the existing pattern used.
2017-10-06 17:09:27 +01:00
Carl Bergquist
ab5bc1bf4a Merge pull request #9111 from eloo/feature/enhance_hipchat_card
Feature/enhance hipchat card
2017-10-05 16:11:04 +02:00
Joseph Weigl
6a030b2e8c Change empty string checks and improve logging 2017-10-05 16:00:55 +02:00
Carl Bergquist
6a20c28c8c Merge pull request #9399 from cglrkn/master
Update script to make it use OpsGenie's REST API
2017-10-05 09:56:27 +02:00
Cagla Arikan
5a3f32521e Fix formatting issue 2017-10-05 08:42:45 +03:00
Ricard Clau
e4541a7fd1 support for s3 path (#9151) 2017-10-04 21:04:20 +02:00