I am working on Sensu and graphite. Where Sensu server sends the data in the JSON format to graphite server to draw graphs of the various metrics and parameters.
I am getting following error while trying to start carbon. I have pasted the error log and trace back here. I am not able to find the solution in the internet. I tried googling almost everything.
I have enabled AMQP to read the metrics from the rabbitMQ server.
Traceback (most recent call last):
File "./carbon-cache.py", line 30, in <module>
run_twistd_plugin(__file__)
File "/opt/graphite/lib/carbon/util.py", line 90, in run_twistd_plugin
config.parseOptions(twistd_options)
File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 614, in parseOptions
usage.Options.parseOptions(self, options)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/usage.py", line 266, in parseOptions
self.subOptions.parseOptions(rest)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/usage.py", line 276, in parseOptions
self.postOptions()
File "/opt/graphite/lib/carbon/conf.py", line 188, in postOptions
program_settings = read_config(program, self)
File "/opt/graphite/lib/carbon/conf.py", line 497, in read_config
settings.readFrom(config, section)
File "/opt/graphite/lib/carbon/conf.py", line 137, in readFrom
value = parser.getboolean(section, key)
File "/usr/lib/python2.7/ConfigParser.py", line 370, in getboolean
raise ValueError, 'Not a boolean: %s' % v
ValueError: Not a boolean: False
ENABLE_AMQP = True
AMQP_VERBOSE = True
AMQP_HOST = 192.168.1.134
AMQP_PORT = 5671
AMQP_VHOST = /sensu
AMQP_USER = sensu
AMQP_PASSWORD = mypass
AMQP_EXCHANGE = metrics
AMQP_METRIC_NAME_IN_BODY = True
Kindly help me out. I am in need of it....
For the benefit of those coming from Google, the problem may actually be that you're missing the Python module txAMQP. You can install the module with:
pip install txamqp
or on Ubuntu (tested on Ubuntu 14.04)
sudo apt-get install python-txamqp
Related
Silly question, but I'm new to Python and Google Cloud. I'm trying to predict customer-lifetime-value with google cloud automl_v1beta1, the code is here
from google.cloud.automl_v1beta1 import AutoMlClient, PredictionServiceClient
from google.cloud_v1beta1 import automl
client = AutoMlClient.from_service_account_file(keyfile_name)
location_path = f"projects/{project_id}/locations/us-central1"
dataset_display_name = automl_dataset
# create dataset
create_dataset_response = client.create_dataset(
parent=location_path,
dataset={'display_name': dataset_display_name, 'tables_dataset_metadata': {}})
and I received the following errors:
\
Traceback (most recent call last):
File "/home/tensorflow-lifetime-value/clv_automl/test1.py", line 220, in <module>
main()
File "/home/tensorflow-lifetime-value/clv_automl/test1.py", line 193, in main
model_name = create_automl_model(client,
File "/home/tensorflow-lifetime-value/clv_automl/test1.py", line 48, in
create_automl_model
create_dataset_response = client.create_dataset(
File "/home/.local/lib/python3.9/site-packages/google/cloud/automl_v1/services/auto_ml/client.py", line 623, in create_dataset
request.dataset = dataset
File "/usr/local/lib/python3.9/dist-packages/proto/message.py", line 757, in __setattr__
pb_value = marshal.to_proto(pb_type, value)
File "/usr/local/lib/python3.9/dist-packages/proto/marshal/marshal.py", line 211, in to_proto
pb_value = rule.to_proto(value)
File "/usr/local/lib/python3.9/dist-packages/proto/marshal/rules/message.py", line 36, in to_proto
return self._descriptor(**value)
ValueError: Protocol message Dataset has no "tables_dataset_metadata" field.
I got the same error using your code when I used google-cloud-automl<=0.1.2. Your error will be fixed if you use google-cloud-automl>=0.1.2. But I suggest to always install the latest version by doing pip install --upgrade google-cloud-automl to maximize the latest updates from Google Cloud.
Im trying to install the gym atari package on version 0.9.5 (I specifically need this version), but when I run the code (which is supposed to be running smoothly if gym is properly downloaded), I get the following error:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
The problem occurred when I tried to run gym.make().
Does anyone know how to fix this?
The same behavior happened to me with python 3.9, but for some reason not on python 3.8 (there was a different error there). Maybe Im missing some rendering library?
The full error message is:
[2021-05-22 02:17:05,405] Making new env: PongNoFrameskip-v4
C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py:17: PkgResourcesDeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately.
result = entry_point.load(False)
Traceback (most recent call last):
File "C:/Users/1/PycharmProjects/University Homework/Reinforcement Learning/dqn/main.py", line 61, in <module>
env = get_env(task, seed)
File "C:\Users\1\PycharmProjects\University Homework\Reinforcement Learning\dqn\utils\gym.py", line 13, in get_env
env = gym.make(env_id)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 164, in make
return registry.make(id)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 122, in make
env = spec.make()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\registration.py", line 89, in make
env = cls(**self._kwargs)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 32, in __init__
self.game_path = atari_py.get_game_path(game)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\atari_py\games.py", line 20, in get_game_path
raise Exception('ROM is missing for %s, see https://github.com/openai/atari-py#roms for instructions' % (game_name,))
Exception: ROM is missing for pong, see https://github.com/openai/atari-py#roms for instructions
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\utils\closer.py", line 67, in close
closeable.close()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 164, in close
self.render(close=True)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 150, in render
return self._render(mode=mode, close=close)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 109, in _render
if self.viewer is not None:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
Exception ignored in: <function Env.__del__ at 0x00000203EE2174C8>
Traceback (most recent call last):
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 203, in __del__
self.close()
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 164, in close
self.render(close=True)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\core.py", line 150, in render
return self._render(mode=mode, close=close)
File "C:\Users\1\PycharmProjects\University Homework\venv37\lib\site-packages\gym\envs\atari\atari_env.py", line 109, in _render
if self.viewer is not None:
AttributeError: 'AtariEnv' object has no attribute 'viewer'
Also, the relevant code:
if __name__ == '__main__':
# Get Atari games.
benchmark = gym.benchmark_spec('Atari40M')
# Change the index to select a different game.
task = benchmark.tasks[3]
# Run training
seed = 0 # Use a seed of zero (you may want to randomize the seed!)
env = get_env(task, seed)
And get_env is:
def get_env(task, seed):
env_id = task.env_id
env = gym.make(env_id)
set_global_seeds(seed)
env.seed(seed)
expt_dir = 'tmp/gym-results'
env = wrappers.Monitor(env, expt_dir, force=True)
env = wrap_deepmind(env)
return env
The error looks like the Atari ROM for pong is not found. This is probably due to the fact that gym no longer installs ROMs automatically, due to licensing issues.
But there's an easy workaround now:
pip install -U gym
pip install -U gym[atari,accept-rom-license]
The accept-rom-license option installs a package called autorom which provides the AutoROM command, and runs it automatically with the --accept-rom-license option.
Then everything just works normally.
Details:
If you run AutoROM without the --accept-license option, this is what you get, so be warned:
AutoROM will download the Atari 2600 ROMs.
They will be installed to:
[...]/site-packages/AutoROM/roms
Existing ROMs will be overwritten.
I own a license to these Atari 2600 ROMs.
I agree to not distribute these ROMs and wish to proceed: [Y/n]:
Run AutoROM --help for more options.
I am starting out working on looking into using Python for some Cisco CUCM automation. I found the plugin ciscoaxl here, I installed it and programed the following script:
from ciscoaxl import axl
cucm = "10.10.20.1"
username = "axlusr"
password = "password1"
version = "12.5"
ucm = axl(username, password, cucm, version)
for phone in ucm.get_phones():
print(phone.name)
I am connected to Cisco's DevNET Sandbox and all the login and configuration for the AXL user appear to be correct, however I get the following output when I attempt to run the script:
Traceback (most recent call last):
File "%home%\AppData\Local\Programs\Python\Python39\axl-test.py", line 7, in <module>
for phone in ucm.get_phones():
File "%home%\AppData\Local\Programs\Python\Python39\lib\site-packages\ciscoaxl\axl.py", line 1877, in get_phones
for each in inner(skip):
File "%home%\AppData\Local\Programs\Python\Python39\lib\site-packages\ciscoaxl\axl.py", line 1869, in inner
res = self.client.listPhone(
File "%home%\AppData\Local\Programs\Python\Python39\lib\site-packages\zeep\proxy.py", line 40, in __call__
return self._proxy._binding.send(
File "%home%\AppData\Local\Programs\Python\Python39\lib\site-packages\zeep\wsdl\bindings\soap.py", line 130, in send
return self.process_reply(client, operation_obj, response)
File "%home%\AppData\Local\Programs\Python\Python39\lib\site-packages\zeep\wsdl\bindings\soap.py", line 195, in process_reply
return self.process_error(doc, operation)
File "%home%\AppData\Local\Programs\Python\Python39\lib\site-packages\zeep\wsdl\bindings\soap.py", line 283, in process_error
raise Fault(
zeep.exceptions.Fault: Unknown fault occured
I have run it on Windows10 in an IDLE enviornment, from the Linux-Subsystem (Ubuntu 20.04) via python and ipython3.
After some additional research this is a know issue with CUCM 12.5. It should be fixed in CU1 see here: https://github.com/mvantellingen/python-zeep/issues/989
I still receive this error on 12.5.1.12900-115, but I receive it when I don't have the appropriate permissions. Fixing user permissions for AXL access resolves it.
I am trying to run the file l2cap_infra.py with Python 2, but I am getting the following error:
Traceback (most recent call last):
File "l2cap_infra.py", line 524, in <module>
main(*sys.argv[1:])
File "l2cap_infra.py", line 508, in main
l2cap_loop, _ = create_l2cap_connection(src_hci, dst_bdaddr, pcap_path=pcap_path)
File "l2cap_infra.py", line 489, in create_l2cap_connection
handle_information_negotiation_process(l2cap_loop)
File "l2cap_infra.py", line 425, in handle_information_negotiation_process
l2cap_loop.send(info_req)
File "l2cap_infra.py", line 142, in send
self._sock.send(packet)
File "l2cap_infra.py", line 213, in send
self.send_fragment(Raw(str(l2cap)[i:i+L2CAP_DEFAULT_MTU]), i == 0)
File "l2cap_infra.py", line 223, in send_fragment
hci = HCI_Hdr() / HCI_ACL_Hdr(handle=scapy_handle, flags=scapy_flags) / frag
File "/usr/local/lib/python2.7/dist-packages/scapy/base_classes.py", line 227, in __call__
i.__init__(*args, **kargs)
File "/usr/local/lib/python2.7/dist-packages/scapy/packet.py", line 135, in __init__
self.fields[f] = self.get_field(f).any2i(self, v)
File "/usr/local/lib/python2.7/dist-packages/scapy/packet.py", line 170, in get_field
return self.fieldtype[fld]
KeyError: 'flags'
This might be a version conflict; I had a similar problem and I had to edit a file in /usr/local/lib/python2.7/.
What code do I have to change in that linked file or in one of my pip libraries to make this code work?
It seems it's a compatibility issue between BlueBorne and Scapy.
You (most likely) have installed the latest Scapy version (v2.4.0), which dropped the fields kwarg from scapy.layers.bluetooth.HCI_ACL_Hdr's initializer, while BlueBorne (l2cap_infra.py, and possibly others) was not updated (or branched) accordingly.
The latest version that still has it is v2.3.3 ([GitHub]: secdev/scapy - (v2.3.3) scapy/scapy/layers/bluetooth.py).
Possible solutions:
Uninstall your current Scapy version (pip uninstall scapy) and install v2.3.3 (pip install scapy==2.3.3). Probably, this is the simplest (and most suitable) for you ([PyPI]: scapy 2.3.3)
Submit a bug to BlueBorne and wait for them to add support for newer Scapy versions
Fix it yourself ("fields" (v2.3.3) to "PB" + "BC" (v2.4.0) kwargs conversion), and maybe submit a patch :)
I am trying to get the usb.find command to work properly in a python script I'm writing on Angstrom for the Beagleboard.
Here is my code:
#!/usr/bin/env python
import usb.core
import usb.util
import usb.backend.libusb01 as libusb
PYUSB_DEBUG_LEVEL = 'debug'
# find our device
# Bus 002 Device 006: ID 1208:0815
# idVendor 0x1208
# idProduct 0x0815
# dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
# iManufacturer 1 TOROBOT.com
dev = usb.core.find(idVendor=0x1208, idProduct=0x0815,
backend=libusb.get_backend() )
I don't know what's missing, but here is what I do know.
When I don't specify the backend, no backend is found. When I do specify the backend "usb.backend.libusb01" I get the following error:
root#beagleboard:~/servo# ./pyServo.py
Traceback (most recent call last):
File "./pyServo.py", line 17, in <module>
dev = usb.core.find(idVendor=0x1208, idProduct=0x0815, backend=libusb.get_backend() )
File "/usr/lib/python2.6/site-packages/usb/core.py", line 854, in find
return _interop._next(device_iter(k, v))
File "/usr/lib/python2.6/site-packages/usb/_interop.py", line 60, in _next
return next(iter)
File "/usr/lib/python2.6/site-packages/usb/core.py", line 821, in device_iter
for dev in backend.enumerate_devices():
File "/usr/lib/python2.6/site-packages/usb/backend/libusb01.py", line 390, in enumerate_devices
_check(_lib.usb_find_busses())
File "/usr/lib/python2.6/ctypes/__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "/usr/lib/python2.6/ctypes/__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: usb_find_busses
What am I missing so that this will work properly?
Thank you.
Python, pyusb, libusb.
I think that's it.
Well libc, ld-linux.so too of course, but those are in your system by default.
Do nm -D /path-to/libusb.so and see if usb_find_busses symbol is really there. There's always a chance that your libusb is outdated or somehow specially compiled.
Check if you get any log, for example missing libusb.so should produce something like 'Error loading libusb 0.1 backend'