Merge branch 'public-single-node' into pmm-6401-read-prometheus-data-files

This commit is contained in:
Aliaksandr Valialkin 2023-01-27 11:38:43 -08:00
commit 6faaefef7b
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
38 changed files with 274 additions and 21 deletions

View file

@ -37,7 +37,7 @@ type UserInfo struct {
Username string `yaml:"username,omitempty"`
Password string `yaml:"password,omitempty"`
URLPrefix *URLPrefix `yaml:"url_prefix,omitempty"`
URLMap []URLMap `yaml:"url_map,omitempty"`
URLMaps []URLMap `yaml:"url_map,omitempty"`
Headers []Header `yaml:"headers,omitempty"`
requests *metrics.Counter
@ -284,7 +284,7 @@ func parseAuthConfig(data []byte) (map[string]*UserInfo, error) {
return nil, err
}
}
for _, e := range ui.URLMap {
for _, e := range ui.URLMaps {
if len(e.SrcPaths) == 0 {
return nil, fmt.Errorf("missing `src_paths` in `url_map`")
}
@ -295,7 +295,7 @@ func parseAuthConfig(data []byte) (map[string]*UserInfo, error) {
return nil, err
}
}
if len(ui.URLMap) == 0 && ui.URLPrefix == nil {
if len(ui.URLMaps) == 0 && ui.URLPrefix == nil {
return nil, fmt.Errorf("missing `url_prefix`")
}
if ui.BearerToken != "" {

View file

@ -278,7 +278,7 @@ users:
`, map[string]*UserInfo{
getAuthToken("foo", "", ""): {
BearerToken: "foo",
URLMap: []URLMap{
URLMaps: []URLMap{
{
SrcPaths: getSrcPaths([]string{"/api/v1/query", "/api/v1/query_range", "/api/v1/label/[^./]+/.+"}),
URLPrefix: mustParseURL("http://vmselect/select/0/prometheus"),
@ -304,7 +304,7 @@ users:
},
getAuthToken("", "foo", ""): {
BearerToken: "foo",
URLMap: []URLMap{
URLMaps: []URLMap{
{
SrcPaths: getSrcPaths([]string{"/api/v1/query", "/api/v1/query_range", "/api/v1/label/[^./]+/.+"}),
URLPrefix: mustParseURL("http://vmselect/select/0/prometheus"),

View file

@ -52,7 +52,7 @@ func createTargetURL(ui *UserInfo, uOrig *url.URL) (*url.URL, []Header, error) {
// See https://github.com/VictoriaMetrics/VictoriaMetrics/pull/1554
u.Path = ""
}
for _, e := range ui.URLMap {
for _, e := range ui.URLMaps {
for _, sp := range e.SrcPaths {
if sp.match(u.Path) {
return e.URLPrefix.mergeURLs(&u), e.Headers, nil

View file

@ -54,7 +54,7 @@ func TestCreateTargetURLSuccess(t *testing.T) {
// Complex routing with `url_map`
ui := &UserInfo{
URLMap: []URLMap{
URLMaps: []URLMap{
{
SrcPaths: getSrcPaths([]string{"/api/v1/query"}),
URLPrefix: mustParseURL("http://vmselect/0/prometheus"),
@ -86,7 +86,7 @@ func TestCreateTargetURLSuccess(t *testing.T) {
// Complex routing regexp paths in `url_map`
ui = &UserInfo{
URLMap: []URLMap{
URLMaps: []URLMap{
{
SrcPaths: getSrcPaths([]string{"/api/v1/query(_range)?", "/api/v1/label/[^/]+/values"}),
URLPrefix: mustParseURL("http://vmselect/0/prometheus"),
@ -132,7 +132,7 @@ func TestCreateTargetURLFailure(t *testing.T) {
}
f(&UserInfo{}, "/foo/bar")
f(&UserInfo{
URLMap: []URLMap{
URLMaps: []URLMap{
{
SrcPaths: getSrcPaths([]string{"/api/v1/query"}),
URLPrefix: mustParseURL("http://foobar/baz"),

View file

@ -37,7 +37,7 @@ Each service may scale independently and may run on the most suitable hardware.
This is a [shared nothing architecture](https://en.wikipedia.org/wiki/Shared-nothing_architecture).
It increases cluster availability, and simplifies cluster maintenance as well as cluster scaling.
![Naive cluster scheme](assets/images/Naive_cluster_scheme.png)
![Naive cluster scheme](Cluster-VictoriaMetrics_cluster-scheme.png)
## Multitenancy

View file

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 125 KiB

12
docs/assets/README.md Normal file
View file

@ -0,0 +1,12 @@
This folder must contain only files, which are needed for generating https://docs.victoriametrics.com .
This folder **should not contain** files specific for a particular documentation pages such as images
used in a particular doc. Such files must be placed in the same folder as the doc itself
and they must have the same prefix as the doc filename. For example, all the images for docs/foo/bar.md
should have filenames starting from docs/foo/bar. This simplifies lifetime management for these files.
For example, if the corresponding doc is removed, then it is easy to remove all the associated
images with a simple `rm -rf docs/foo/bar*` command. This also simplifies referring the associated images
from docs displayed at various views:
- https://docs.victoriametrics.com
- https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/docs

View file

@ -9,7 +9,35 @@ monitoring, logs collection, access protection, software updates, backups, etc.
Managed VictoriaMetrics id distributed via [AWS Marketplace](https://aws.amazon.com/marketplace/pp/prodview-4tbfq5icmbmyc).
To start using the service, one should have already registered AWS account
and visit [VictoriaMetrics product page](https://aws.amazon.com/marketplace/pp/prodview-4tbfq5icmbmyc).
See more details [here](https://dbaas.victoriametrics.com/howToRegister).
### Amazon Web Services
Managed VictoriaMetrics id distributed via <a href="https://aws.amazon.com/marketplace/pp/prodview-4tbfq5icmbmyc">AWS Marketplace</a>.
To start using the service, one should have already registered AWS account. Then, go to the
<a href="https://aws.amazon.com/marketplace/pp/prodview-4tbfq5icmbmyc">VictoriaMetrics product page</a>
and click "Continue to Subscribe" button:
<p>
<img src="quickstart_continue-subscribe.png" width="800">
</p>
Then on product page press the "Subscribe" button:
<p>
<img src="quickstart_subscribe.png" width="800">
</p>
You'll be taken to <a href="https://dbaas.victoriametrics.com/signIn">Managed VictoriaMetrics auth page</a>:
<p>
<img src="quickstart_signin.png" width="800">
</p>
Choose to register manually or via Google Auth.
Please note, that initial registering is only possible via link from <a href="https://aws.amazon.com/marketplace/pp/prodview-4tbfq5icmbmyc" target="_blank">AWS Marketplace</a>.
See what to do after registering in Quick Start guide.
## How to restore password
@ -18,13 +46,13 @@ If you forgot password, it can be restored in the following way:
1. Click `Forgot your password?` link at [this page](https://dbaas.victoriametrics.com/signIn):
<p>
<img src="restore-password.png" width="800">
<img src="quickstart_restore-password.png" width="800">
</p>
2. Enter your email in the field and click `Send Email` button:
<p>
<img src="restore-password-email.png" width="800">
<img src="quickstart_restore-password-email.png" width="800">
</p>
3. Follow the instruction sent to your email in order to gain access to your VictoriaMetrics cloud account:
@ -42,13 +70,13 @@ In case of questions contact our support support@victoriametrics.com
4. Navigate to the Profile page by clicking the corresponding link at the top right corner:
<p>
<img src="restore-password-profile.png" width="800">
<img src="quickstart_restore-password-profile.png" width="800">
</p>
5. Enter new password at the Profile page and press `Save` button:
<p>
<img src="restore-password-save-password.png" width="800">
<img src="quickstart_restore-password-save-password.png" width="800">
</p>
@ -58,7 +86,7 @@ Instances is a page where user can list and manage VictoriaMetrics single-node i
To create an instance click on the button `Create`:
<p>
<img src="quickstart-instances.png" width="800">
<img src="quickstart_instances.png" width="800">
</p>
In the opened form, choose parameters of the new instance such as:
@ -69,7 +97,7 @@ In the opened form, choose parameters of the new instance such as:
* `Retention` period for stored metrics.
<p>
<img src="quickstart-instance-create.png" width="800">
<img src="quickstart_instance-create.png" width="800">
</p>
Once created, instance will remain for a short period of time in `PROVISIONING` status
@ -77,7 +105,7 @@ while the hardware spins-up, just wait for a couple of minutes and reload the pa
You'll also be notified via email once provisioning is finished:
<p>
<img src="quickstart-instance-provisioning.png" width="800">
<img src="quickstart_instance-provisioning.png" width="800">
</p>
## Access
@ -86,7 +114,7 @@ After transition from `PROVISIONING` to `RUNNING` state, VictoriaMetrics is full
and ready to accept write or read requests. But first, click on instance name to get the access token:
<p>
<img src="quickstart-tokens.png" width="800">
<img src="quickstart_tokens.png" width="800">
</p>
Access tokens are used in token-based authentication to allow an application to access the VictoriaMetrics API.
@ -94,7 +122,7 @@ Supported token types are `Read-Only`, `Write-Only` and `Read-Write`. Click on t
to see usage examples:
<p>
<img src="quickstart-token-usage.png" width="800">
<img src="quickstart_token-usage.png" width="800">
</p>
Follow usage example in order to configure access to VictoriaMetrics for your Prometheus,

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View file

Before

Width:  |  Height:  |  Size: 296 KiB

After

Width:  |  Height:  |  Size: 296 KiB

View file

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 156 KiB

View file

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View file

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View file

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View file

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View file

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

View file

Before

Width:  |  Height:  |  Size: 426 KiB

After

Width:  |  Height:  |  Size: 426 KiB

View file

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 256 KiB

View file

@ -0,0 +1,213 @@
# User Management in Managed VictoriaMetrics
The user management system enables admins to control user access and onboard and offboard users to the Managed VictoriaMetrics. It organizes users according to their needs and role.
The document covers the following topics
1. [User Roles](#user-roles)
2. [User List](#user-list)
3. [How to Add User](#how-to-add-user)
4. [How to Update User](#how-to-update-user)
5. [How to Delete User](#how-to-delete-user)
## User roles
Managed VictoriaMetrics provides different levels of user access. It defines what information users can access and edit in your account.
You assign the role to the user during the user creation procedure. You can change the role after the creation
#### Roles definition
<table>
<tr>
<td><strong>User Role</strong></td>
<td><strong>Categories</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td rowspan="5" ><strong>Admin</strong></td>
<td>Deployments</td>
<td>
Access to all deployments tabs and information
<p>Create, update and delete deployment</p>
</td>
</tr>
<tr>
<td>Billing Details</td>
<td>Check billing information</td>
</tr>
<tr>
<td>Notifications</td>
<td>Create and update notifications</td>
</tr>
<tr>
<td>Audit Logs</td>
<td>Can check all information in audit logs</td>
</tr>
<tr>
<td>User Management</td>
<td>Add, edit and delete users</td>
</tr>
<tr>
<td rowspan="3"><strong>Editor</strong></td>
<td>Deployments</td>
<td>
Access to all deployments tabs and information
<p>Create, update and delete deployment</p>
</td>
</tr>
<tr>
<td>Notifications</td>
<td>Create and update notifications</td>
</tr>
<tr>
<td>Audit Logs</td>
<td>Can check all information in audit logs</td>
</tr>
<tr>
<td><strong>Viewer</strong></td>
<td>Deployments</td>
<td>Access to Overview, Monitoring, Explore and Alerts deployments tabs and information</td>
</tr>
</table>
#### User statuses
<table>
<tr>
<td class="highlight"><strong class="sr">Active</strong></td>
<td>The user can log in and use Managed VictoriaMetrics. The user role defines the access level.</td>
</tr>
<tr>
<td class="highlight"><strong class="s1">Pending Invitation</strong></td>
<td>An invitation was sent. The user must accept this.</td>
</tr>
<tr>
<td class="highlight"><strong class="nn">Inactive</strong></td>
<td>The user is registered in the Managed VictoriaMetrics but has no access to perform any actions. Admin can active or completely delete the user.</td>
</tr>
</table>
## User list
It shows all users with different roles, and you can apply provided actions with them.
<p>
<img src="user-managment_users-list.png" width="800">
</p>
In the table, there is additional information about the users:
<table>
<tr>
<td>User Name:</td>
<td>First name and last name</td>
</tr>
<tr>
<td>Email:</td>
<td>Registration user email</td>
</tr>
<tr>
<td>Status:</td>
<td>Active, Inactive or Pending Invitation</td>
</tr>
<tr>
<td>User Role:</td>
<td>Admin, Editor or Viewer</td>
</tr>
<tr>
<td>Last Active:</td>
<td>Last login date and time</td>
</tr>
<tr>
<td>Auth method:</td>
<td>Auth options to login into the Managed VictoriaMetrics</td>
</tr>
</table>
## How to Add User
<span>Click on</span>
<span>
<img src="user-managment_invite-user-button.png" width="100" height="50">
</span>
the user invitation button and fill out the form in the modal, which will appear after you click. All fields are mandatory.
<p>
<img src="user-managment_invite-user-modal.png" width="800">
</p>
<span>After filling out the form, click on the</span>
<span>
<img src="user-managment_invite-button.png" width="70" height="50">
</span>
button. The user will be saved, and an invitation email to the provided email address will be sent. As a confirmation, you will see the success message.
**The invitation link is only active for 24 hours.**
The user will be at Pending Invitation status. After accepting the invitation user status changes to Active.
<p>
<img src="user-managment_success-invitation.png" width="800">
</p>
## How to Update User
<span>To edit the user role and details, activate or deactivate a user, and click on</span>
<span>
<img src="user-managment_edit-user-btn.png" width="70" height="70">
</span>
<span>or</span>
<span>
<img src="user-managment_edit-user-link.png" width="100" height="70">
</span>
to edit the user.
<p>
<img src="user-managment_update-user-buttons.png" width="800">
</p>
User editing form:
<p>
<img src="user-managment_update-user.png" width="800">
</p>
<span>To save changes, click the</span>
<span>
<img src="user-managment_update-user-save-button.png" width="80" height="40">
</span>
button. If changes are saved successfully, you will see a message at the top of the page.
<p>
<img src="user-managment_update-user-success.png" width="800">
</p>
## How to Delete User
You can delete a user from your account. However, you will need to invite them again if you want to give them access.
<span>Click on</span>
<span>
<img src="user-managment_delete-user-btn.png" width="40" height="40">
</span>
to delete the user.
<p>
<img src="user-managment_delete-user-button.png" width="800">
</p>
To confirm the deletion of a user, you will need to re-enter their email address and press the **Delete** button
<p>
<img src="user-managment_delete-user-confirm.png" width="800">
</p>
You will be redirected to the main page with a success or error message
<p>
<img src="user-managment_delete-user-success.png" width="800">
</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

View file

@ -99,7 +99,7 @@ func readProxyProto(r io.Reader) (net.Addr, error) {
case 1:
// ipv4 (aka AF_INET)
if len(bb.B) < 12 {
return nil, fmt.Errorf("cannot ipv4 address from proxy protocol block with the length %d bytes; expected at least 12 bytes", len(bb.B))
return nil, fmt.Errorf("cannot read ipv4 address from proxy protocol block with the length %d bytes; expected at least 12 bytes", len(bb.B))
}
remoteAddr := &net.TCPAddr{
IP: net.IPv4(bb.B[0], bb.B[1], bb.B[2], bb.B[3]),