# mysql:queries and mysql:metrics not work ..

**URL:** https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168
**Category:** PMM 1.x
**Created:** [October 25, 2016, 10:42am UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168 "2016-10-25T10:42:53Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![cmons](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@cmons](https://forums.percona.com/u/cmons)
#### Post date: [October 25, 2016, 10:42am UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168/1 "2016-10-25T10:42:53Z")

</div>

Hello,

we test the functionality pmm.  
We have 2 server : - PMM Server (Centos 7) : 10.130.3.53

- PMM Client (Centos 6 with Percona Server 5.5) : perco - 10.130.3.62

For the Slow Query check for QAN PMM on the PMM Client :  
slow\_query\_log\_file=/var/log/mysql-slow.log  
slow\_query\_log=ON  
long\_query\_time=0.01  
log\_slow\_admin\_statements=ON  
log\_slow\_slave\_statements=ON

On the Client :  
[root@perco ~]# pmm-admin list  
pmm-admin 1.0.5

PMM Server | 10.130.3.53  
Client Name | perco  
Client Address | 10.130.3.62  
Service manager | unix-systemv

* * *

SERVICE TYPE NAME CLIENT PORT RUNNING DATA SOURCE OPTIONS

* * *

mysql:queries perco 42001 YES root:_**@unix(/var/lib/mysql/mysql.sock) query\_source=slowlog  
mysql:metrics perco 42002 YES root:**_@unix(/var/lib/mysql/mysql.sock)

[root@perco ~]# pmm-admin ping  
OK, PMM server is alive.

PMM Server | 10.130.3.53  
Client Name | perco  
Client Address | 10.130.3.62

[root@perco ~]# pmm-admin check-network --no-emoji  
PMM Network Status

Server | 10.130.3.53  
Client | 10.130.3.62

- Client → Server

* * *

SERVER SERVICE STATUS

* * *

Consul API OK  
QAN API OK  
Prometheus API OK

Connection duration | 373.944µs  
Request duration | 442.435µs  
Full round trip | 816.379µs

- Client ← Server

* * *

SERVICE TYPE NAME REMOTE ENDPOINT STATUS

* * *

mysql:metrics perco 10.130.3.62:42002 DOWN

When an endpoint is down it may indicate that the corresponding service is stopped (run ‘pmm-admin list’ to verify).  
If it’s running, check out the logs /var/log/pmm-\*.log

When all endpoints are down but ‘pmm-admin list’ shows they are up and no errors in the logs,  
check the firewall settings whether this system allows incoming connections from server to address:port in question.

When we launch pmm-admin check-network --no-emoji command, we can see the STATUS is DOWN ..

But we check on the log file :  
[root@perco log]# cat pmm-mysql-metrics-42002.log  
time=“2016-10-25T19:57:14+02:00” level=info msg=“Starting mysqld\_exporter (version=1.0.5, branch=master, revision=3c95bb2c647443430db2337627d5f677665f41c7)” source=“mysqld\_exporter.go:631”  
time=“2016-10-25T19:57:14+02:00” level=info msg=“Build context (go=go1.7.1, user=, date=)” source=“mysqld\_exporter.go:632”  
time=“2016-10-25T19:57:14+02:00” level=info msg=“Listening on 10.130.3.62:42002” source=“mysqld\_exporter.go:666”

[root@perco log]# cat pmm-mysql-queries-42001.log

# Version: percona-qan-agent 1.0.5

# Basedir: /usr/local/percona/qan-agent

# Listen: 127.0.0.1:42001

# PID: 2686

# API: 10.130.3.53/qan-api

# UUID: 5c323db2bbd94aae4b1a05571b37387c

2016/10/25 19:51:51.182411 main.go:165: Starting agent…  
2016/10/25 19:51:51.183653 main.go:343: Agent is ready  
2016/10/25 19:51:51.196672 main.go:207: API is ready

And on the mysql-slow.log we can see entry :  
[root@perco log]# tail -n 20 mysql-slow.log  
FROM information\_schema.tables t  
JOIN information\_schema.columns c USING (table\_schema,table\_name)  
WHERE c.extra = ‘auto\_increment’ AND t.auto\_increment IS NOT NULL;

# Time: 161025 20:09:35

# User@Host: root[root] @ localhost

# Thread\_id: 960 Schema: Last\_errno: 0 Killed: 0

# Query\_time: 0.020572 Lock\_time: 0.000375 Rows\_sent: 1 Rows\_examined: 106 Rows\_affected: 0 Rows\_read: 106

# Bytes\_sent: 401

SET timestamp=1477418975;  
SELECT table\_schema, table\_name, column\_name, auto\_increment,  
pow(2, case data\_type  
when ‘tinyint’ then 7  
when ‘smallint’ then 15  
when ‘mediumint’ then 23  
when ‘int’ then 31  
when ‘bigint’ then 63  
end+(column\_type like ‘% unsigned’))-1 as max\_int  
FROM information\_schema.tables t  
JOIN information\_schema.columns c USING (table\_schema,table\_name)  
WHERE c.extra = ‘auto\_increment’ AND t.auto\_increment IS NOT NULL;

But on the web interface, not found entry on the qan and metrics panels (we can see picture on the attachement) ..

Why ?

We disable SELINUX and iptables for PMM Server and PMM client..

Do you have the idea for this problem ?

Thank you for tyour help,  
Regards,  
CM

---

<div class="post-metadata">

### Author: ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)
#### Post date: [October 25, 2016, 1:07pm UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168/2 "2016-10-25T13:07:44Z")

</div>

Hello,

- Please check the status of endpoint at [url][http://server/prometheus/targets[/url]](http://server/prometheus/targets%5B/url%5D)
- Enter container `docker exec -ti pmm-server bash` and run `curl http://10.130.3.62:42002/metrics`. It should work, otherwise - it’s firewall problem.
- Ensure server time (where container runs) is in sync (timezone does not matter)

---

<div class="post-metadata">

### Author: ![cmons](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@cmons](https://forums.percona.com/u/cmons)
#### Post date: [October 25, 2016, 2:47pm UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168/3 "2016-10-25T14:47:23Z")

</div>

Hello,

- Please check the status of endpoint at [URL][http://server/prometheus/targets[/URL]](http://server/prometheus/targets%5B/URL%5D) :  
We can see an attachement the output

- Enter container `docker exec -ti pmm-server bash` and run `curl http://10.130.3.62:42002/metrics`. It should work, otherwise - it’s firewall problem :  
root@3a5cea16da90:/opt# curl [URL][http://10.130.3.62:42002/metrics[/URL]](http://10.130.3.62:42002/metrics%5B/URL%5D)

MySQL 3-in-1 exporter
# MySQL 3-in-1 exporter
- [high-res metrics](https://forums.percona.com/metrics-hr)
- [medium-res metrics](https://forums.percona.com/metrics-mr)
- [low-res metrics](https://forums.percona.com/metrics-lr)

Ensure server time (where container runs) is in sync (timezone does not matter) :  
The Server PMM :  
[root@localhost ~]# date  
mer. oct. 26 01:53:19 CEST 2016

The Container docker :  
[root@localhost ~]# docker exec -ti pmm-server bash  
root@3a5cea16da90:/opt# date  
Tue Oct 25 23:54:18 UTC 2016

And the Percona Server PMM Client :  
root@978b04984347:/# date  
Tue Oct 25 22:14:48 CEST 2016

For you the problem is the server time ?  
How is it possible that the container does not have the same time zone as the server?

Do you have recommendation for configuration docker timezone ?

Thank you for your help,  
Regards,  
CM

---

<div class="post-metadata">

### Author: ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)
#### Post date: [October 25, 2016, 2:52pm UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168/4 "2016-10-25T14:52:50Z")

</div>

It does not matter what timezone is, the time should be in sync. Container may have another timezone as configured on the image.

So the problem like I said is with server time: mer. oct. 26 01:53:19 CEST 2016  
It can’t be in the future.  
Please sync server time and you will see the graphs.

---

<div class="post-metadata">

### Author: ![cmons](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@cmons](https://forums.percona.com/u/cmons)
#### Post date: [October 26, 2016, 3:02am UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168/5 "2016-10-26T03:02:28Z")

</div>

Hello,

It works perfect thanks

We have 2 another question :

1/We have servers who are always on Percona Server 5.5, but we have this error because on PS 5.5 the EXPLAIN command is not supported for INSERT or DELETE querys.  
Do you have recommendation for by pass with error or work this query ?

2/Next question, for SELECT query, the command EXPLAIN not work.We can see an attachement the output panel and output log root@4f4cee6f4972:/var/log# tail -f qan-api.log.  
It’s possible to explain me why the agent ws error lost connection to API but on the panel QAN is ok only explain not work?  
2016/10/26 10:25:53.396863 WARNING agent Lost connection to API  
2016/10/26 10:27:13.405483 WARNING agent ws error: EOF  
2016/10/26 10:27:13.405838 WARNING agent Lost connection to API

Thank you for your help,  
regards,  
CM

---

<div class="post-metadata">

### Author: ![weber](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@weber](https://forums.percona.com/u/weber)
#### Post date: [October 26, 2016, 6:16am UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168/6 "2016-10-26T06:16:46Z")

</div>

Unfortunately, the screenshots appear too small and I can’t see the issue. Is it possible to resend them?

---

<div class="post-metadata">

### Author: ![carlos.salguero](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/carlos.salguero/32/20_2.png) [@carlos.salguero](https://forums.percona.com/u/carlos.salguero)
#### Post date: [October 26, 2016, 2:13pm UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168/7 "2016-10-26T14:13:16Z")

</div>

Could you provide the complete MySQL version?  
Perhaps you could provide us the ouput of:

show variables like ‘%version%’;

---

<div class="post-metadata">

### Author: ![cmons](https://avatars.discourse-cdn.com/v4/letter/c/ecb155/32.png) [@cmons](https://forums.percona.com/u/cmons)
#### Post date: [October 27, 2016, 4:27am UTC](https://forums.percona.com/t/mysql-queries-and-mysql-metrics-not-work/5168/8 "2016-10-27T04:27:20Z")

</div>

The problem is solved.

Thank you for your help,  
The problem is to lost the connect between PMM Client and PMM Server.

Thank you,  
Regards,
