Skip to content

Enable 'php_apc' crashed newrelic_plugin_agent #551

@g3rhard

Description

@g3rhard

Hello there

When I enable php_apc monitoring:

  php_apc:
    name: hostname
    scheme: http
    host: localhost
    verify_ssl_cert: false
    port: 80
    path: /apc-nrp.php

I got this:

------------------------------------------------------------------------ [START]
/usr/local/bin/newrelic-plugin-agent Exception [2018-04-27T07:10:14.511446]
------------------------------------------------------------------------- [INFO]
Interpreter: /usr/bin/python
CLI arguments: /usr/local/bin/newrelic-plugin-agent -c /etc/newrelic/newrelic_plugin_agent.cfg
Exception: 'NoneType' object has no attribute 'get'
Traceback:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/helper/unix.py", line 92, in start
    self.controller.start()
  File "/usr/local/lib/python2.7/dist-packages/helper/controller.py", line 266, in start
    self.run()
  File "/usr/local/lib/python2.7/dist-packages/helper/controller.py", line 253, in run
    self.process()
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 118, in process
    self.start_plugin_polling()
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 280, in start_plugin_polling
    self.config.application.get(plugin))
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 108, in poll_plugin
    thread.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/agent.py", line 308, in thread_process
    obj.poll()
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/base.py", line 460, in poll
    self.add_datapoints(data)
  File "/usr/local/lib/python2.7/dist-packages/newrelic_plugin_agent/plugins/php_apc.py", line 36, in add_datapoints
    system_stats.get('nslots',
AttributeError: 'NoneType' object has no attribute 'get'
-------------------------------------------------------------------------- [END]

Without this module everything is fine.
apc-nrp.php working:

curl localhost/apc-nrp.php
{"system_stats":null,"user_stats":{"num_slots":2053,"ttl":7200,"num_hits":63,"num_misses":9,"num_inserts":9,"num_entries":9,"expunges":0,"start_time":1524761237,"mem_size":76848,"memory_type":"mmap"},"shared_memory":{"num_seg":1,"seg_size":134217592,"avail_mem":134123560}}

System info:
newrelic-plugin-agent (1.3.0)
Python 2.7.13

Here is my config:
https://pastebin.com/aAyK0nGv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions