Provide a count of Keystone Tokens

Uses a connection to the database to count the number of keystone
tokens. Can count tokens on Undercloud and Overcloud.  For Overcloud
you must provide a repo that provides "libdbi-dbd-mysql".

+ Collectd from EPEL to address when/if your OpenStack includes
  collectd installed already

Change-Id: I4da4c3b02cff661572de3852a33d26875cfcdc0d
This commit is contained in:
akrzos 2017-03-16 14:29:22 -04:00
parent e29cdbf21c
commit 21d48c8236
12 changed files with 313 additions and 16 deletions

View File

@ -38,6 +38,7 @@
roles:
- { role: common, when: collectd_controller }
- { role: epel, when: collectd_controller }
- { role: repo, when: keystone_overcloud_collectd_plugin }
- { role: collectd-openstack, when: collectd_controller }
tasks:
- name: Collectd off if not collectd_controller

View File

@ -16,6 +16,7 @@
static_dashboards:
- cloud_gnocchi_status
- cloud_instance_count
- cloud_keystone_token_count
- cloud_rabbitmq_monitoring
- cloud_system_performance_comparsion
- three_node_performance_food_groups

View File

@ -57,12 +57,19 @@ disable_ssh_dns: false
# epel7 rpm for collectd packages
epel7_rpm: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# Extra Repos to add during collectd install
repos:
rhel-7-server-beta:
baseurl: http://walkabout.foobar.com/released/RHEL-7/7.3-Beta/Server/x86_64/os/
# Host where connmond will be running
connmon_host: 192.0.2.1
########################################
# Collectd Configuration
########################################
# Install collectd from EPEL
collectd_from_epel: true
# Interval in seconds
collectd_interval: 10
# Run collectd on specific openstack nodes:
@ -94,6 +101,12 @@ apache_controller_mod_status_port: 5001
gnocchi_status_python_plugin: false
gnocchi_status_interval: 30
########################
# Keystone token count via dbi plugin
########################
keystone_undercloud_collectd_plugin: false
keystone_overcloud_collectd_plugin: false
########################
# Rabbitmq plugin
########################

View File

@ -3,6 +3,18 @@
# Install/run collectd for Browbeat
#
- name: Remove Non-EPEL collectd install
yum:
name: libcollectdclient
state: absent
become: true
when: collectd_from_epel
- name: Clean Non-EPEL collectd configuration
shell: "rm -rf /etc/collectd.d/*.conf"
become: true
when: collectd_from_epel
#
# (akrzos) yum module works at this point due to the fact the EPEL repo now exists. EPEL rpm is
# installed at this point in time.
@ -16,6 +28,16 @@
- collectd-mysql
- collectd-turbostat
- name: (Keystone Token Count) Install libdbi mysql driver
yum:
name: "{{item}}"
state: present
become: true
when: "(('controller' in group_names and {{keystone_overcloud_collectd_plugin}} == true and '{{inventory_hostname}}' == groups['controller'][0]) or ('undercloud' in group_names and {{keystone_undercloud_collectd_plugin}} == true))"
with_items:
- libdbi-dbd-mysql
- collectd-dbi
# Get mysql's root password
- name: (Controllers Only) Get mysql root password
command: hiera mysql::server::root_password

View File

@ -21,6 +21,9 @@ LoadPlugin apache
{% endif %}
LoadPlugin cpu
LoadPlugin conntrack
{% if keystone_overcloud_collectd_plugin %}
LoadPlugin dbi
{% endif %}
LoadPlugin df
LoadPlugin disk
LoadPlugin exec
@ -83,14 +86,41 @@ PreCacheChain "PreCache"
EscapeCharacter "_"
</Carbon>
</Plugin>
{% if apache_controller_collectd_plugin %}
<Plugin apache>
<Instance "status">
URL "http://127.0.0.1:{{apache_controller_mod_status_port}}/mod_status?auto"
</Instance>
</Plugin>
{% endif %}
{% if keystone_overcloud_collectd_plugin %}
{%if inventory_hostname == groups['controller'][0] %}
<Plugin dbi>
<Query token_count>
Statement "select count(*) as count from token"
<Result>
Type gauge
InstancePrefix "token"
ValuesFrom "count"
</Result>
</Query>
<Database "keystone">
Driver "mysql"
DriverOption "host" "localhost"
DriverOption "dbname" "keystone"
DriverOption "username" "root"
DriverOption "password" "{{mysql_root_password.stdout}}"
DriverOption "mysql_unix_socket" "/var/lib/mysql/mysql.sock"
Query token_count
</Database>
</Plugin>
{% else %}
# Token Count plugin installed and enabled on {{groups['controller'][0]}}
{% endif %}
{% endif %}
<Plugin df>
ValuesPercentage true
</Plugin>

View File

@ -21,6 +21,9 @@ LoadPlugin apache
{% endif %}
LoadPlugin cpu
LoadPlugin conntrack
{% if keystone_undercloud_collectd_plugin %}
LoadPlugin dbi
{% endif %}
LoadPlugin df
LoadPlugin disk
LoadPlugin exec
@ -83,14 +86,35 @@ PreCacheChain "PreCache"
EscapeCharacter "_"
</Carbon>
</Plugin>
{% if apache_undercloud_collectd_plugin %}
<Plugin apache>
<Instance "status">
URL "http://127.0.0.1:{{apache_undercloud_mod_status_port}}/mod_status?auto"
</Instance>
</Plugin>
{% endif %}
{% if keystone_undercloud_collectd_plugin %}
<Plugin dbi>
<Query token_count>
Statement "select count(*) as count from token"
<Result>
Type gauge
InstancePrefix "token"
ValuesFrom "count"
</Result>
</Query>
<Database "keystone">
Driver "mysql"
DriverOption "host" "localhost"
DriverOption "dbname" "keystone"
DriverOption "mysql_unix_socket" "/var/lib/mysql/mysql.sock"
Query token_count
</Database>
</Plugin>
{% endif %}
<Plugin df>
ValuesPercentage true
</Plugin>

View File

@ -54,7 +54,7 @@
"steppedLine": false,
"targets": [
{
"refId": "B",
"refId": "A",
"target": "aliasByMetric(aliasSub($Cloud.$Node.gnocchi_status.*, 'gauge-', ''))",
"textEditor": false
}

View File

@ -54,7 +54,7 @@
"steppedLine": false,
"targets": [
{
"refId": "B",
"refId": "A",
"target": "alias(sumSeries($Cloud.overcloud-*compute-*.processes-qemu-kvm.ps_count.processes), 'Sum qemu-kvm processes')",
"textEditor": false
}

View File

@ -0,0 +1,187 @@
{
"dashboard": {
"annotations": {
"list": []
},
"editable": true,
"gnetId": null,
"hideControls": false,
"id": null,
"links": [],
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": null,
"editable": true,
"error": false,
"fill": 0,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"id": 1,
"isNew": true,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"max": true,
"min": true,
"rightSide": true,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [
{
"refId": "A",
"target": "alias($Cloud.$Node.dbi-keystone.gauge-token, 'Tokens')",
"textEditor": false
}
],
"timeFrom": null,
"timeShift": null,
"title": "$Node Keystone Token Count",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"showTitle": true,
"title": "Token Count"
}
],
"schemaVersion": 12,
"sharedCrosshair": false,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allFormat": "glob",
"current": {
"text": "",
"value": ""
},
"datasource": null,
"hide": 0,
"includeAll": false,
"multi": false,
"multiFormat": "glob",
"name": "Cloud",
"options": [],
"query": "*",
"refresh": 1,
"regex": "/^(?!stats[d]*[_counts]*$).*$/",
"type": "query"
},
{
"current": {
"tags": [],
"text": "undercloud",
"value": "undercloud"
},
"datasource": null,
"hide": 0,
"includeAll": false,
"multi": false,
"name": "Node",
"options": [
{
"selected": false,
"text": "overcloud-controller-0",
"value": "overcloud-controller-0"
},
{
"selected": true,
"text": "undercloud",
"value": "undercloud"
}
],
"query": "$Cloud.*",
"refresh": 0,
"regex": "/.*[cu][on][dn].*/",
"type": "query"
}
]
},
"time": {
"from": "now-24h",
"to": "now"
},
"timepicker": {
"now": true,
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "utc",
"title": "Cloud Keystone Token Count",
"version": 2
}
}

View File

@ -49,11 +49,11 @@
"steppedLine": false,
"targets": [
{
"refId": "M",
"refId": "A",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_count.processes, 'rabbitmq Processes')"
},
{
"refId": "N",
"refId": "B",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_count.threads, 'rabbitmq Threads')"
}
],
@ -125,11 +125,11 @@
"steppedLine": false,
"targets": [
{
"refId": "M",
"refId": "A",
"target": "alias(scale($Cloud.$Node.processes-rabbitmq.ps_cputime.syst, 0.0001), 'rabbitmq System')"
},
{
"refId": "N",
"refId": "B",
"target": "alias(scale($Cloud.$Node.processes-rabbitmq.ps_cputime.user, 0.0001), 'rabbitmq User')"
}
],
@ -201,11 +201,11 @@
"steppedLine": false,
"targets": [
{
"refId": "M",
"refId": "A",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_rss, 'rabbitmq RSS')"
},
{
"refId": "N",
"refId": "B",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_vm, 'rabbitmq Virtual')"
}
],
@ -277,11 +277,11 @@
"steppedLine": false,
"targets": [
{
"refId": "M",
"refId": "A",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_pagefaults.majflt, 'rabbitmq Majflt')"
},
{
"refId": "N",
"refId": "B",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_pagefaults.minflt, 'rabbitmq Minflt')"
}
],
@ -353,11 +353,11 @@
"steppedLine": false,
"targets": [
{
"refId": "M",
"refId": "A",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_disk_ops.read, 'rabbitmq Read')"
},
{
"refId": "N",
"refId": "B",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_disk_ops.write, 'rabbitmq Write')"
}
],
@ -429,11 +429,11 @@
"steppedLine": false,
"targets": [
{
"refId": "M",
"refId": "A",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_disk_octets.read, 'rabbitmq Read')"
},
{
"refId": "N",
"refId": "B",
"target": "alias($Cloud.$Node.processes-rabbitmq.ps_disk_octets.write, 'rabbitmq Write')"
}
],

View File

@ -0,0 +1,10 @@
---
#
# Task to deploy a repo file
#
- name: Add custom repos
template:
src: "templates/browbeat.repo.j2"
dest: /etc/yum.repos.d/browbeat.repo
become: true

View File

@ -0,0 +1,9 @@
# Deployed by Browbeat
{% for key in repos %}
[{{key}}]
name={{key}}
baseurl={{repos[key].baseurl}}
gpgcheck=0
enabled=1
{% endfor %}