# Django Python-agent : APM Quick Start Produces “No services were found”

**URL:** <https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822>\
**Category:** APM\
**Created:** [September 25, 2018, 12:36pm UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822 "2018-09-25T12:36:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![narutobaka](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@narutobaka](https://discuss.elastic.co/u/narutobaka)\
**Post date:** [September 25, 2018, 12:36pm UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822/1 "2018-09-25T12:36:30Z")

</div>

Hi

I work on CentOS7 VmWARE virtual machine :  
Django + apm-agent : Machine 1 ip : 192.168.232.135  
Apm-server + Elasticsearch + Kibana : 192.168.232.131

I try to configure stack Django == Apm-agent == Apm-Server == Elasticsearch == Kibana.

But when i click on apm menu in Kibana, I get :

> No services were found

By clicking on "setup Instructions" I get :  
For Server status : You have correctly setup APM-Server  
For Agent status : Data successfully received from one or more agents  
For Load Kibana objects : 16 saved objects successfully added

But when i click on launch APM i get nothing in APM kibana's page, no agent.

My APM-agent configuration :

My django version is :

> [root@localhost ~]# python  
> Python 2.7.5 (default, Jul 13 2018, 13:06:57)  
> [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2  
> Type "help", "copyright", "credits" or "license" for more information.
> 
> > > > import django  
> > > > django.VERSION  
> > > > (1, 8, 18, 'final', 0)

I follow install instruction from here [APM avec Elastic&nbsp;Observability | Elastic](https://www.elastic.co/fr/solutions/apm) for django app :

I install elastic-apm in my django virtualenv :

> pip install elastic-apm

> version of elastic-apm :  
> (django\_pod) [pod@localhost root]$ pip list | grep elastic-apm  
> elastic-apm 3.0.1

> ## 
> 
> # Installed applications list
> 
> # 
> 
> INSTALLED\_APPS = (  
> # put it in first !!  
> # [Installation — django-modeltranslation dev documentation](http://django-modeltranslation.readthedocs.org/en/latest/installation.html#configuration)  
> 'modeltranslation',  
> 'django.contrib.admin',  
> 'django.contrib.auth',  
> 'django.contrib.contenttypes',  
> 'django.contrib.sessions',  
> 'django.contrib.messages',  
> 'django.contrib.staticfiles',  
> # Pages statiques  
> 'django.contrib.sites',  
> 'django.contrib.flatpages',  
> # Applications tierces  
> 'ckeditor',  
> 'filer',  
> 'easy\_thumbnails',  
> 'elasticapm.contrib.django',  
> # [https://bitbucket.org/cpcc/django-cas](https://bitbucket.org/cpcc/django-cas) -\> application modifiée pour ajout  
> # gateway et double authentification  
> 'django\_cas\_gateway',  
> 'taggit',  
> 'taggit\_templatetags',  
> 'djangoformsetjs',  
> 'captcha',  
> 'bootstrap3',  
> 'rest\_framework',  
> 'rest\_framework.authtoken',  
> 'lti\_provider',  
> # Applications locales  
> 'pods',  
> 'core',  
> 'h5pp',  
> )

> ## 
> 
> # Activated middleware components
> 
> # 
> 
> MIDDLEWARE\_CLASSES = (  
> 'elasticapm.contrib.django.middleware.TracingMiddleware',  
> 'django.contrib.sessions.middleware.SessionMiddleware',  
> 'django.middleware.locale.LocaleMiddleware',  
> 'django.middleware.common.CommonMiddleware',  
> 'django.middleware.csrf.CsrfViewMiddleware',  
> 'django.contrib.auth.middleware.AuthenticationMiddleware',  
> 'django.contrib.messages.middleware.MessageMiddleware',  
> # Pages statiques  
> 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',  
> )

> ## 
> 
> # Configuration ELASTIC\_APM
> 
> # 
> 
> ELASTIC\_APM = {  
> 'DEBUG' : True,  
> 'SERVICE\_NAME':'PODv1',  
> 'SERVER\_URL' : '[http://192.168.232.131:8200](http://192.168.232.131:8200)',  
> }

I split my post cause of post caractère limit

---

<div class="post-metadata">

**Author:** ![narutobaka](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@narutobaka](https://discuss.elastic.co/u/narutobaka)\
**Post date:** [September 25, 2018, 12:40pm UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822/2 "2018-09-25T12:40:43Z")

</div>

My APM-Serveur configuration :

I use elastic repo to install APM-server via yum install :

> [elasticsearch-6.x]  
> name=Elasticsearch repository for 6.x packages  
> baseurl=[https://artifacts.elastic.co/packages/6.x/yum](https://artifacts.elastic.co/packages/6.x/yum)  
> gpgcheck=1  
> gpgkey=[https://artifacts.elastic.co/GPG-KEY-elasticsearch](https://artifacts.elastic.co/GPG-KEY-elasticsearch)  
> enabled=1  
> autorefresh=1  
> type=rpm-md  
> priority=10  
> protect=1

apm-server version is :

> [root@localhost apm-server]# rpm -qa | grep apm-server  
> apm-server-6.4.1-1.x86\_64

apm-server configuration:

> ```
> host: "localhost:8200"
> concurrent_requests: 5
> rum:
> enabled: true
> queue:
> mem:
> events: 4096      
> setup.template.settings:
> index:
> number_of_shards: 1
> codec: best_compression
> output.elasticsearch:
> hosts: ["localhost:9200"]
> enabled: true
> indices:
> - index: "apm-%{[beat.version]}-sourcemap"
> when.contains:
> processor.event: "sourcemap"
> 
> - index: "apm-%{[beat.version]}-error-%{+yyyy.MM.dd}"
> when.contains:
> processor.event: "error"
> 
> - index: "apm-%{[beat.version]}-transaction-%{+yyyy.MM.dd}"
> when.contains:
> processor.event: "transaction"
> 
> - index: "apm-%{[beat.version]}-span-%{+yyyy.MM.dd}"
> when.contains:
> processor.event: "span"
> 
> - index: "apm-%{[beat.version]}-metric-%{+yyyy.MM.dd}"
> when.contains:
> processor.event: "metric"
> 
> - index: "apm-%{[beat.version]}-onboarding-%{+yyyy.MM.dd}"
> when.contains:
> processor.event: "onboarding"
> 
> ```
> 
> #to get more info I put loglevel to debug :
> 
> logging.level: debug  
> logging.selectors: ["\*"]  
> logging.metrics.enabled: false  
> logging.metrics.period: 30s  
> logging.to\_files: true  
> logging.files:  
> path: /var/log/apm-server  
> name: apm-server  
> rotateeverybytes: 10485760  
> keepfiles: 7  
> permissions: 0600

Result after log activation in /var/log/apm-server/apm-server :

> 2018-09-25T09:04:11.112+0200 INFO pipeline/output.go:95 Connecting to backoff(elasticsearch([http://localhost:9200](http://localhost:9200)))  
> 2018-09-25T09:04:11.112+0200 DEBUG [elasticsearch] elasticsearch/client.go:688 ES Ping(url=[http://localhost:9200](http://localhost:9200))  
> 2018-09-25T09:04:11.123+0200 DEBUG [elasticsearch] elasticsearch/client.go:711 Ping status code: 200  
> 2018-09-25T09:04:11.124+0200 INFO elasticsearch/client.go:712 Connected to Elasticsearch version 6.4.1  
> 2018-09-25T09:04:11.124+0200 DEBUG [elasticsearch] elasticsearch/client.go:730 HEAD [http://localhost:9200/\_template/apm-6.4.1](http://localhost:9200/_template/apm-6.4.1)  
> 2018-09-25T09:04:11.128+0200 INFO template/load.go:129 Template already exists and will not be overwritten.  
> 2018-09-25T09:04:11.128+0200 INFO pipeline/output.go:105 Connection to backoff(elasticsearch([http://localhost:9200](http://localhost:9200))) established  
> 2018-09-25T09:04:11.143+0200 DEBUG [elasticsearch] elasticsearch/client.go:321 PublishEvents: 1 events have been published to elasticsearch in 15.043264ms.  
> 2018-09-25T09:04:11.143+0200 DEBUG [memqueue] memqueue/ackloop.go:160 ackloop: receive ack [0: 0, 1]  
> 2018-09-25T09:04:11.143+0200 DEBUG [memqueue] memqueue/eventloop.go:535 broker ACK events: count=1, start-seq=1, end-seq=1
> 
> 2018-09-25T09:04:11.143+0200 DEBUG [memqueue] memqueue/ackloop.go:128 ackloop: return ack to broker loop:1  
> 2018-09-25T09:04:11.143+0200 DEBUG [memqueue] memqueue/ackloop.go:131 ackloop: done send ack

and nothing log after .....

---

<div class="post-metadata">

**Author:** ![narutobaka](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@narutobaka](https://discuss.elastic.co/u/narutobaka)\
**Post date:** [September 25, 2018, 12:42pm UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822/3 "2018-09-25T12:42:35Z")

</div>

My Elasticsearch configuration :

I follow this guide for elasticsearch installation : [Install Elasticsearch with RPM | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html)

I make a yum install from same repo as apm-server

elasticsearch version :

> [root@localhost apm-server]# rpm -qa | grep elasticsearch  
> elasticsearch-6.4.1-1.noarch

elasticsearch configuration :

> # ---------------------------------- Cluster -----------------------------------
> 
> # 
> 
> # Use a descriptive name for your cluster:
> 
> # 
> 
> cluster.name: APM-application

> # ------------------------------------ Node ------------------------------------
> 
> # 
> 
> # Use a descriptive name for the node:
> 
> # 
> 
> node.name: APM-1

> # --------------------------------- Discovery ----------------------------------
> 
> # 
> 
> # Pass an initial list of hosts to perform discovery when new node is started:
> 
> # The default list of hosts is ["127.0.0.1", "[::1]"]
> 
> # 
> 
> discovery.zen.ping.unicast.hosts: ["127.0.0.1"]

Result of elasticsearch configuration :

> [root@localhost ~]# curl localhost:9200  
> {  
> "name" : "APM-1",  
> "cluster\_name" : "APM-application",  
> "cluster\_uuid" : "p5dqXl57Qd2mdXz7QqFkhQ",  
> "version" : {  
> "number" : "6.4.1",  
> "build\_flavor" : "default",  
> "build\_type" : "rpm",  
> "build\_hash" : "e36acdb",  
> "build\_date" : "2018-09-13T22:18:07.696808Z",  
> "build\_snapshot" : false,  
> "lucene\_version" : "7.4.0",  
> "minimum\_wire\_compatibility\_version" : "5.6.0",  
> "minimum\_index\_compatibility\_version" : "5.0.0"  
> },  
> "tagline" : "You Know, for Search"  
> }

My Kibana configuration :

I follow this guide for kibana installation : [Install Kibana with RPM | Kibana Guide [8.11] | Elastic](https://www.elastic.co/guide/en/kibana/current/rpm.html)

I make a yum install from same repo as apm-server

Kibana version :

> [root@localhost kibana]# rpm -qa | grep kibana  
> kibana-6.4.1-1.x86\_64

kibana configuration :

> server.port: 5601  
> server.host: "192.168.232.131"  
> elasticsearch.url: "[http://localhost:9200](http://localhost:9200)"  
> kibana.index: ".kibana"  
> kibana.defaultAppId: "home"  
> elasticsearch.shardTimeout: 0  
> logging.dest: /var/log/kibana/kibana.log  
> logging.verbose: true  
> apm\_oss.errorIndices: apm-\*  
> apm\_oss.spanIndices: apm-\*  
> apm\_oss.transactionIndices: apm-\*  
> apm\_oss.onboardingIndices: apm-\*

What did i miss in my stack configuration?

cordialy,

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [September 26, 2018, 7:17am UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822/4 "2018-09-26T07:17:26Z")

</div>

Hi,  
for identifying the issue, I suggest you first check if there have been data written to your Elasticsearch. You can do so by running e.g. following query to check for `transactions` in the Kibana Dev Tools and check for `hits.total` in the response:

```auto
GET apm*/_search
{
  "query": {
    "term": {
      "processor.name": "transaction"
    }
  }
}

```

In case no documents could be found, please check your python agent logs for any error messages. The Server logs you are showing do not contain any hint of requests from the agent. The Server config file shows you are using a local setup for the APM Server `host: "localhost:8200"`. You can do a curl request to the APM Server to see if it is actually reachable, e.g. `curl localhost:8200`.

---

<div class="post-metadata">

**Author:** ![narutobaka](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@narutobaka](https://discuss.elastic.co/u/narutobaka)\
**Post date:** [September 26, 2018, 1:50pm UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822/5 "2018-09-26T13:50:32Z")

</div>

hi

and thank for your answer.

I test your command in DevTools :

> GET apm\*/\_search  
> {  
> "query": {  
> "term": {  
> "processor.name": "transaction"  
> }  
> }  
> }

And I get this in return :

> {  
> "took": 7,  
> "timed\_out": false,  
> "\_shards": {  
> "total": 4,  
> "successful": 4,  
> "skipped": 0,  
> "failed": 0  
> },  
> "hits": {  
> "total": 0,  
> "max\_score": null,  
> "hits":   
> }  
> }

So there is no document.

First I try a telnet from my python-agent VM to my server-apm VM and i get :

> [root@localhost elasticsearch]# telnet 192.168.232.131 8200  
> Trying 192.168.232.131...  
> telnet: connect to address 192.168.232.131: Connection refused

So i change the host value in apm-server configuration to :

> host: "192.168.232.131:8200"

then retry telnet :

> [root@localhost elasticsearch]# telnet 192.168.232.131 8200  
> Trying 192.168.232.131...  
> Connected to 192.168.232.131.  
> Escape character is '^]'.  
> ^C

I try to curl but I get this :

> [root@localhost ~]# curl -v 192.168.232.131:8200
> 
> - About to connect() to 192.168.232.131 port 8200 (#0)
> - Trying 192.168.232.131...
> - Connected to 192.168.232.131 (192.168.232.131) port 8200 (#0)
> 
> > GET / HTTP/1.1  
> > User-Agent: curl/7.29.0  
> > Host: 192.168.232.131:8200  
> > Accept: _/_
> 
> \< HTTP/1.1 404 Not Found  
> \< Content-Type: text/plain; charset=utf-8  
> \< X-Content-Type-Options: nosniff  
> \< Date: Wed, 26 Sep 2018 13:22:21 GMT  
> \< Content-Length: 19  
> \<  
> 404 page not found

I try this too :

> [root@localhost ~]# curl -v 192.168.232.131:8200/v1/transactions
> 
> - About to connect() to 192.168.232.131 port 8200 (#0)
> - Trying 192.168.232.131...
> - Connected to 192.168.232.131 (192.168.232.131) port 8200 (#0)
> 
> > GET /v1/transactions HTTP/1.1  
> > User-Agent: curl/7.29.0  
> > Host: 192.168.232.131:8200  
> > Accept: _/_
> 
> \< HTTP/1.1 405 Method Not Allowed  
> \< Content-Type: application/json  
> \< Date: Wed, 26 Sep 2018 13:24:41 GMT  
> \< Content-Length: 44  
> \<
> 
> - Connection #0 to host 192.168.232.131 left intact  
> {"error":"only POST requests are supported"}

I'm looking for how to activate python agents logs? how to do that?

cordialy

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [September 26, 2018, 2:27pm UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822/6 "2018-09-26T14:27:43Z")

</div>

It sounds like there was an actual connection problem between the agent and the server, that you solved with changing the `host` configuration in the server. When running an earlier version than `6.4.0` it is expected to get a `404` for calling `<apm-server-host>:<port>`, you could try to call `<apm-server-host>:<port>/healthcheck` instead.

Have you checked if this actually fixed your issues and data are showing up now in Kibana?

You can find more information about how to control [logging in your django app](https://www.elastic.co/guide/en/apm/agent/python/current/django-support.html#django-logging) .

---

<div class="post-metadata">

**Author:** ![narutobaka](https://avatars.discourse-cdn.com/v4/letter/n/ee7513/32.png) [@narutobaka](https://discuss.elastic.co/u/narutobaka)\
**Post date:** [September 26, 2018, 2:38pm UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822/7 "2018-09-26T14:38:20Z")

</div>

Hi

> Have you checked if this actually fixed your issues and data are showing up now in Kibana?

was a good advice, the problem come from host value configuration in apm-server.

now data are showing up in Kibana great ;).

I go continue to test elastic apm solution.

Thank a lot for your help.

cordialy

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 17, 2018, 10:50am UTC](https://discuss.elastic.co/t/django-python-agent-apm-quick-start-produces-no-services-were-found/149822/8 "2018-10-17T10:50:53Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
