commx / python-rrdtool Goto Github PK
View Code? Open in Web Editor NEWPython bindings for rrdtool
License: GNU Lesser General Public License v2.1
Python bindings for rrdtool
License: GNU Lesser General Public License v2.1
On Debian Stretch
---> 1 import rrdtool
ImportError: librrd.so.4: cannot open shared object file: No such file or directory
locate librrd:
/usr/lib/x86_64-linux-gnu/librrd.a
/usr/lib/x86_64-linux-gnu/librrd.so
/usr/lib/x86_64-linux-gnu/librrd.so.8
/usr/lib/x86_64-linux-gnu/librrd.so.8.0.0
/usr/lib/x86_64-linux-gnu/pkgconfig/librrd.pc
Describe the bug
This is not really a bug, but we could use Python Wheels as part of python-rrdtool distribution
Environment: Centos7.3 Python2.7.5
Collecting rrdtool
Using cached rrdtool-0.1.11.tar.gz
Building wheels for collected packages: rrdtool
Running setup.py bdist_wheel for rrdtool ... error
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-QPpgMw/rrdtool/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpWNznqJpip-wheel- --python-tag cp27:
tmp/tmp_python_rrdtoolZwdfwE/test_rrdtool.o: In function `main':
/tmp/tmp_python_rrdtoolZwdfwE/test_rrdtool.c:6: undefined reference to `rrd_fetch_cb_register'
collect2: error: ld returned 1 exit status
Warning: Seems like your rrdtool version does not support fetch callbacks, recompiling.running bdist_wheel
running build
running build_ext
building 'rrdtool' extension
creating build
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPACKAGE_VERSION="0.1.11" -I/tmp/pip-build-QPpgMw/rrdtool -I/usr/local/include -I/usr/include/python2.7 -c rrdtoolmodule.c -o build/temp.linux-x86_64-2.7/rrdtoolmodule.o
creating build/lib.linux-x86_64-2.7
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/rrdtoolmodule.o -L/usr/local/lib -L/usr/lib64 -lrrd -lpython2.7 -o build/lib.linux-x86_64-2.7/rrdtool.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(capsule.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
I am running windows 7 64 bit, Python v2.7.10 and pip v9.0.1
I ran the installation using pip repository but get error
` PS C:\Users\person\Downloads> pip install python-rrdtool
Collecting python-rrdtool
Using cached python-rrdtool-1.4.7.tar.gz
Installing collected packages: python-rrdtool
Running setup.py install for python-rrdtool ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\person\
\appdata\\local\\temp\\pip-build-ykegvz\\python-rrdtool\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.re
ad().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\person\appdata\lo
cal\temp\pip-w44bef-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
running build_configure
building 'rrdtoolmodule' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\rrdtool-1.4.7
creating build\temp.win-amd64-2.7\Release\rrdtool-1.4.7\bindings
creating build\temp.win-amd64-2.7\Release\rrdtool-1.4.7\bindings\python
C:\Users\person\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /O
x /MD /W3 /GS- /DNDEBUG -Irrdtool-1.4.7/src -Ic:\python27\include -Ic:\python27\PC /Tcrrdtool-1.4.7/bindings/python/rrdt
oolmodule.c /Fobuild\temp.win-amd64-2.7\Release\rrdtool-1.4.7/bindings/python/rrdtoolmodule.obj
rrdtoolmodule.c
rrdtool-1.4.7/bindings/python/rrdtoolmodule.c(41) : fatal error C1083: Cannot open include file: '../../rrd_config.h
': No such file or directory
error: command 'C:\\Users\\person\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin
\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\person\\appdata\\local\\temp\\p
ip-build-ykegvz\\python-rrdtool\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n
');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\person\appdata\local\temp\pip-w44bef-reco
rd\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\person\appdat
a\local\temp\pip-build-ykegvz\python-rrdtool\`
I tried with the tar.gz file as well and got the same error
PS C:\Users\person\Downloads> pip install .\python-rrdtool-1.4.7.tar.gz
Processing c:\users\person\downloads\python-rrdtool-1.4.7.tar.gz
Installing collected packages: python-rrdtool
Running setup.py install for python-rrdtool ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\person\
\appdata\\local\\temp\\pip-hpkobh-build\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r
\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\person\appdata\local\temp\pip-b3z
3rd-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
running build_configure
building 'rrdtoolmodule' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\rrdtool-1.4.7
creating build\temp.win-amd64-2.7\Release\rrdtool-1.4.7\bindings
creating build\temp.win-amd64-2.7\Release\rrdtool-1.4.7\bindings\python
C:\Users\person\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /O
x /MD /W3 /GS- /DNDEBUG -Irrdtool-1.4.7/src -Ic:\python27\include -Ic:\python27\PC /Tcrrdtool-1.4.7/bindings/python/rrdt
oolmodule.c /Fobuild\temp.win-amd64-2.7\Release\rrdtool-1.4.7/bindings/python/rrdtoolmodule.obj
rrdtoolmodule.c
rrdtool-1.4.7/bindings/python/rrdtoolmodule.c(41) : fatal error C1083: Cannot open include file: '../../rrd_config.h
': No such file or directory
error: command 'C:\\Users\\person\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin
\\amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\person\\appdata\\local\\temp\\p
ip-hpkobh-build\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exe
c(compile(code, __file__, 'exec'))" install --record c:\users\person\appdata\local\temp\pip-b3z3rd-record\install-recor
d.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\person\appdata\local\temp\pip
-hpkobh-build\
I cannot figure what the problem is installing this on windows.
I will appreciate if I can get some help with this.
Hi,
thanks for providing this useful library. I'm using it on a Raspberry PI to plot temperature data over a webpage. However, after upgrading to version 0.1.2 using pip the library does not work and my small app logs messages like this
AttributeError: 'module' object has no attribute 'graph'
I figured out that this problem could be related to a change in rrdtoolmodule.c in line 431 (see https://github.com/commx/python-rrdtool/blob/master/rrdtoolmodule.c#L431).
Is there a way to be able to upgrade to version 0.1.2 while having the possibility to use the graph function?
Best regards and thanks in advance
Hi,
I've installed the rrdtool on a virtualenv (python 3.4) and when I try to import it I get the error below:
In [1]: import rrdtool
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-71e14b967e40> in <module>()
----> 1 import rrdtool
ImportError: .../lib/python3.4/site-packages/rrdtool.cpython-34m.so: undefined symbol: rrd_fetch_cb_register
If you need any other information, please ask me.
Hi,
is it possible to create trends / prediction with the tool? Something similar to this?
Thanks a lot
platform:
Linux-3.10.0-327.el7.x86_64-x86_64-with-centos-7.2.1511-Core
python:
2.7.5
rrdtool:
1.4.8
==========================================
[root@dev-linux ~]# gstack 2176
#0 0x00007f9015fd0fd0 in dictresize () from /lib64/libpython2.7.so.1.0
#1 0x00007f9015fe22a1 in PyString_InternInPlace () from /lib64/libpython2.7.so.1.0
#2 0x00007f9015fd3768 in PyDict_SetItemString () from /lib64/libpython2.7.so.1.0
#3 0x00007f9006408fef in PyDict_FromInfo () from /usr/lib64/python2.7/site-packages/rrdtoolmodule.so
#4 0x00007f900640911e in PyRRD_updatev () from /usr/lib64/python2.7/site-packages/rrdtoolmodule.so
#5 0x00007f9016031aa4 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#6 0x00007f9016031860 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#7 0x00007f90160330bd in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#8 0x00007f9015fc005d in function_call () from /lib64/libpython2.7.so.1.0
#9 0x00007f9015f9b0b3 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#10 0x00007f901602e2f7 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#11 0x00007f90160330bd in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#12 0x00007f9015fc005d in function_call () from /lib64/libpython2.7.so.1.0
#13 0x00007f9015f9b0b3 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#14 0x00007f901602e2f7 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#15 0x00007f90160330bd in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#16 0x00007f9015fbff68 in function_call () from /lib64/libpython2.7.so.1.0
#17 0x00007f9015f9b0b3 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#18 0x00007f9015faa0a5 in instancemethod_call () from /lib64/libpython2.7.so.1.0
#19 0x00007f9015f9b0b3 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#20 0x00007f9015ff23f7 in slot_tp_call () from /lib64/libpython2.7.so.1.0
#21 0x00007f9015f9b0b3 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#22 0x00007f901602f25c in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#23 0x00007f90160330bd in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#24 0x00007f901603176f in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#25 0x00007f9016031860 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#26 0x00007f9016031860 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#27 0x00007f90160330bd in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#28 0x00007f90160331c2 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0
#29 0x00007f901604c5ff in run_mod () from /lib64/libpython2.7.so.1.0
#30 0x00007f901604d7be in PyRun_FileExFlags () from /lib64/libpython2.7.so.1.0
#31 0x00007f901604ea49 in PyRun_SimpleFileExFlags () from /lib64/libpython2.7.so.1.0
#32 0x00007f901605fb9f in Py_Main () from /lib64/libpython2.7.so.1.0
#33 0x00007f901528cb15 in __libc_start_main () from /lib64/libc.so.6
#34 0x0000000000400721 in _start ()
I installed python-rrdtool via the standard Gentoo ebuild way (cf. https://bugs.gentoo.org/show_bug.cgi?id=575582 for the ebuild). it works, but the "graph" functionality does not show up:
>>> import rrdtool
>>> dir(rrdtool)
['OperationalError', 'ProgrammingError', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '__version__', 'create', 'dump', 'fetch', 'first', 'flushcached', 'info', 'last', 'lastupdate', 'lib_version', 'resize', 'tune', 'update', 'updatev']
This is the case both for v0.1.2 and git master here. Does something "special" have to be done to get the "graph" function? Thanks for the help in advance :-)
The 0.1.10 package released to pypi at https://pypi.python.org/pypi/rrdtool/0.1.10 does not have "rrdtoolmodule.h" included. Can someone please help? Thanks.
In the original rrdtool it is possible to get the graph as string via the stdout
. This behavior is possible in python-rrdtool
too when i pass the "-" as filename, but it returns the image via the stdout
and not as return value. For now it is not possible (or not documented) how to get it as Python string, e.g.:
image = rrdtool.graph(...)
# do something with image
Please, can you add this feature or describe how to do it?
There is an issue with the rrdtool.info
function which causes a memory leak. This was already reported in #25 and closed, but it is not fixed. I managed to reproduce the issue locally by running the test script provided in #25 and got similar values in valgrind report.
Test script:
import rrdtool
for i in range(1000):
rrdtool.info("file.rrd")
Valgrind report:
==1957== HEAP SUMMARY:
==1957== in use at exit: 771,052 bytes in 683 blocks
==1957== total heap usage: 381,965 allocs, 381,282 frees, 35,060,855 bytes allocated
==1957==
==1957== LEAK SUMMARY:
==1957== definitely lost: 0 bytes in 0 blocks
==1957== indirectly lost: 0 bytes in 0 blocks
==1957== possibly lost: 7,296 bytes in 29 blocks
==1957== still reachable: 763,756 bytes in 654 blocks
==1957== of which reachable via heuristic:
==1957== newarray : 1,536 bytes in 16 blocks
==1957== suppressed: 0 bytes in 0 blocks
==1957== Rerun with --leak-check=full to see details of leaked memory
==1957==
If the test script is run in an infinite loop, the memory usage keeps rising until no more available memory is left.
rrdtool.lib_version()
: 1.7.1
python-rrdtool
: 0.1.15
python
: 3.7.3
Describe the bug
Getting this error
rrdtool.OperationalError: bad CF: MAXCDEF
To Reproduce
Steps to reproduce the behavior:
something as simple as the followng
rrdtool.graph(
'/tmp/out.png',
'--start',
'1546296957',
'--end',
'1573426557',
'DEF:outoctets=/tmp/port-668.rrd:OUTOCTETS:AVERAGE',
'DEF:inoctets=/tmp/port-668.rrd:INOCTETS:AVERAGE',
'DEF:outoctets_max=/tmp/port-668.rrd:OUTOCTETS:MAX',
'DEF:inoctets_max=/tmp/port-668.rrd:INOCTETS:MAX'
'CDEF:octets=inoctets,outoctets,+',
'CDEF:outbits=outoctets,8,*',
'CDEF:inbits=inoctets,8,*',
'CDEF:highbits=inoctets,outoctets,MAX,8,*',
)
**Expected behavior**
For it to work, it does in cmd line
**Screenshots**
If applicable, add screenshots and/or console outputs to help explain your problem.
![image](https://user-images.githubusercontent.com/597545/68554100-017a9f00-048b-11ea-9fe8-119e619ebcb2.png)
**Desktop (please complete the following information):**
- Python version:
- RRDtool version:
- python-rrdtool version:
**Additional context**
Add any other context about the problem here.
Running the following code (which is just the example from the README) I get a segfault.
#!/usr/bin/env python3
import rrdtool
# Create Round Robin Database
rrdtool.create('test.rrd', '--start', 'now', '--step', '300',
'RRA:AVERAGE:0.5:1:1200',
'DS:temp:GAUGE:600:-273:5000')
# Feed updates to the RRD
rrdtool.update('test.rrd', 'N:32')
I ran the python interpreter in gdb and got the following:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff65e52a7 in convert_args (
command=command@entry=0x7ffff65e774a "create", args=0x7ffff7ed85f8,
rrdtool_argv=rrdtool_argv@entry=0x7fffffffde20,
rrdtool_argc=rrdtool_argc@entry=0x7fffffffde1c) at rrdtoolmodule.c:160
160 rrdtoolmodule.c: No such file or directory.
Any ideas on what went wrong there?
Versions:
RRDtool 1.7.0
Python 3.6.4
python-rrdtool 0.1.13
easy_install rrdtool
/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py:2510: PEP440Warning: 'python-debian (0.1.21-nmu2ubuntu2)' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommend to migrate to PEP 440 compatible versions.
PEP440Warning,
Searching for rrdtool
Reading https://pypi.python.org/simple/rrdtool/
Best match: rrdtool 0.1.1
Downloading https://pypi.python.org/packages/source/r/rrdtool/rrdtool-0.1.1.tar.gz#md5=7aa3e68728f21c21ff66bb8176a46ec3
Processing rrdtool-0.1.1.tar.gz
Writing /tmp/easy_install-00j8i4/rrdtool-0.1.1/setup.cfg
Running rrdtool-0.1.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-00j8i4/rrdtool-0.1.1/egg-dist-tmp-iTQN1z
rrdtoolmodule.c:26:17: fatal error: rrd.h: Datei oder Verzeichnis nicht gefunden
#include <rrd.h>
^
compilation terminated.
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
The package librrd-dev should be added as a dependency, otherwise installation fails with a message saying rrd.h is missing.
When creating a graph via python-rrdtool, the locale is apparently not passed. The resulting graph contains C locale month/day/etc names instead of the translated ones (e. g. I use a German locale here and get "Monday" instead of "Montag").
When rrdtool graph is called from a console directly, the translated strings are used here. Same if the "graph" call is replaced by subprocess.call (and of course, all arguments are listed in [ ] and 'rrdtool', 'graph' is prefixed).
Is this a bug or do I miss something?
Thanks for all Help!
Hello,
Regarding python 2/3 version, using rrdtool crashes my script. Here you can find isolated case:
import rrdtool
RRD_PATH = 'database.rrd'
if __name__ == '__main__':
rrdtool.create(
RRD_PATH,
"--step", "5",
'DS:temp1:GAUGE:300:U:U',
'DS:temp2:GAUGE:300:U:U',
'RRA:AVERAGE:0.5:1:60',
)
rrdtool.update(RRD_PATH, 'N:22.3:U')
i = 0
while True:
print(i)
print(rrdtool.lastupdate(RRD_PATH))
i += 1
if i > 100000:
break
At some iteration it throws:
2062
{'ds': {'temp1': 22.3, 'temp2': None}, 'date': datetime.datetime(2017, 11, 17, 18, 35, 38)}
Fatal Python error: deallocating None
With making more inputs in database (e.g. instead 1 unknown, make 4 unknowns) it throws ~4 times quicker.
Thanks,
Maciej
Importing python-rrdtool
crashes on my with the following error:
# cd "$(mktemp -d)"
# virtualenv --python=python3.7 py37
# source py37/bin/activate
# pip install rrdtool==0.1.15
# python -c 'import rrdtool'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: /tmp/tmp.a7JJOSEC25/py37/lib/python3.7/site-packages/rrdtool.cpython-37m-x86_64-linux-gnu.so: undefined symbol: rrd_xport
Happens with:
Is this a known problem?
Hi,
I installed rrdtool using pip:
$ pip install rrdtool
Requirement already satisfied (use --upgrade to upgrade): rrdtool in /usr/local/lib/python2.7/dist-packages
But as you can see above only the python2 bindings are installed. Both python2 and python3 are installed on the system. Any suggestions? Thanks.
More system information:
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
$ uname -a
Linux mavros 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
I have Lubuntu 15.04, with librrd-dev
package already installed.
I used a Python 2.7 virtualenv and then tried installing this module using pip install rrdtool
. The resulting module, however, did not have graph
support.
I then manually cloned the repository, manually edited the C source file to include #define HAVE_RRD_GRAPH
, and then used setup.py
to build and install it in the virtualenv. The module worked fine afterwards, WITH graph
support.
So… Where is HAVE_RRD_GRAPH
defined? After a quick look, I believe it gets defined only in rrd_config.h
, which is only available during the compilation of rrdtool
, which means this C definition is not exported anywhere. If this is the case, maybe we should open an issue at https://github.com/oetiker/rrdtool-1.x asking to expose this definition. Alternatively, we can work around it in this module source code or in this module build logic.
I believe there is an issue with the rrdtool.info
function where each time the function is called, new variables are created, and stay referenced, thus preventing them from being collected by the garbage collector once the function has returned.
This causes a long-running python script from eating up all my memory eventually.
test script:
import rrdtool
for i in xrange(1000):
rrdtool.info("file.rrd")
valgrind report
$ valgrind python test.py
==29843== HEAP SUMMARY:
==29843== in use at exit: 642,456 bytes in 628 blocks
==29843== total heap usage: 3,550 allocs, 2,922 frees, 3,461,571 bytes allocated
==29843==
==29843== LEAK SUMMARY:
==29843== definitely lost: 0 bytes in 0 blocks
==29843== indirectly lost: 0 bytes in 0 blocks
==29843== possibly lost: 2,424 bytes in 20 blocks
==29843== still reachable: 640,032 bytes in 608 blocks
==29843== of which reachable via heuristic:
==29843== newarray : 1,536 bytes in 16 blocks
==29843== suppressed: 0 bytes in 0 blocks
Running the loop 10000 times in the above script, the valgrind report is:
$ valgrind python test.py
==9514== HEAP SUMMARY:
==9514== in use at exit: 1,585,292 bytes in 1,579 blocks
==9514== total heap usage: 694,613 allocs, 693,034 frees, 44,926,181 bytes allocated
==9514==
==9514== LEAK SUMMARY:
==9514== definitely lost: 0 bytes in 0 blocks
==9514== indirectly lost: 0 bytes in 0 blocks
==9514== possibly lost: 2,424 bytes in 20 blocks
==9514== still reachable: 1,582,868 bytes in 1,559 blocks
==9514== of which reachable via heuristic:
==9514== newarray : 1,536 bytes in 16 blocks
==9514== suppressed: 0 bytes in 0 blocks
$ rrdtool info file.rrd
filename = "file.rrd"
rrd_version = "0003"
step = 60
last_update = 1537536481
header_size = 584
ds[metric7].index = 0
ds[metric7].type = "GAUGE"
ds[metric7].minimal_heartbeat = 120
ds[metric7].min = 0.0000000000e+00
ds[metric7].max = 1.0000000000e+04
ds[metric7].last_ds = "10"
ds[metric7].value = 1.1767510000e+01
ds[metric7].unknown_sec = 0
rra[0].cf = "MAX"
rra[0].rows = 1500
rra[0].cur_row = 70
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
rrdtool.lib_version()
: 1.6.0
python-rrdtool
: 0.1.14
python
: 2.7.13
I see lots of old questions on this - but nothing recent or definitive.
I am trying to install rrd/rrdtools on windows.
There is a long thread back to 2008 on this, but I can't find any recent working solutions.
"pip install rrdtools"
fails with: missing rrd.h
That should come from:
pip install rrdtools-devel,
which fails with:
could not find a version
python-rrdtool install fails:
os.chmod(executable, 0777)
^
SyntaxError: leading zeros in decimal integer literals are not permitted;
use an 0o prefix for octal integers
Downloading the "current" (2012 V1.4.7) version and trying to install, same error on chmod.
The build from source instructions do not include Windows.
Does the rrd system & tools run on windows?
PS C:\Users\Gregory Guthrie\Desktop\rrd-redo> pip install rrdtool
Collecting rrdtool
Using cached rrdtool-0.1.16.tar.gz (22 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
¦ exit code: 1
?-> [3 lines of output]
test_rrdtool.c
C:\Users\GREGOR~1\AppData\Local\Temp\tmp_python_rrdtoolcyqpeidj\test_rrdtool.c(2): fatal error C1083: Cannot open include file: 'rrd.h': No such file or directory
Error: Unable to compile the binary module. Do you have the rrdtool header and libraries installed?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
?-> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
PS C:\Users\Gregory Guthrie\Desktop\rrd-redo> pip install python-rrdtool
Collecting python-rrdtool
Using cached python-rrdtool-1.4.7.tar.gz (1.4 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
¦ exit code: 1
?-> [7 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\Gregory Guthrie\AppData\Local\Temp\pip-install-46cgxtm8\python-rrdtool_81e606f4140c4924958eaa9061fb5b44\setup.py", line 61
os.chmod(executable, 0777)
^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
?-> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Under some circumstances, graphing functions are not available within librrd as it's possible to build rrdtool without all the graphics stuff. Add a test build routine to figure out whether these functions are available and only build the functions into the module if the presence is given. Otherwise, nasty build errors could occur.
To make this module reproducible, please include the LICENSE file in its PyPI package.
Describe the bug
rrdtool.fetch with wrong argument cause segmentation fault
To Reproduce
This one works well:
rrdtool.fetch("/var/lib/munin/localdomain/localhost.localdomain-cpu-user-d.rrd", "AVERAGE")
but this one cause a segmentation fault:
rrdtool.fetch("/var/lib/munin/localdomain/localhost.localdomain-cpu-user-d.rrd", "invalid")
Expected behavior
Getting an error message instead of a segmentation fault
Desktop (please complete the following information):
on Ubuntu 18.04
now it only supports linux, how can we use it in windows ? thanks
Version lib: 0.1.16
Python: 3.9
OS: Ubuntu 22.04
I`ve got code below
run_time = 1663778930
STEP = 300
rrdtool.create(
"test.rrd",
"--start",
f"{run_time}",
# "--step", f"{STEP}",
"DS:lo_int:GAUGE:600:0:1000000",
"RRA:AVERAGE:0.5:1:288",
)
for i in range(1, 100):
new_val = run_time + (STEP * i)
val = random.randint(0, 10)
rrdtool.update("test.rrd", f"{new_val}:{val}")
xport = rrdtool.xport("-t","DEF:inbound=test.rrd:lo_int:AVERAGE", 'XPORT:inbound:"out bytes"')
print(xport['data'])
So, my result is
[(None,), (2.466666666666667,), (4.466666666666667,), (4.6,), (0.9333333333333333,), (4.7,)]
rrdtool xport -t DEF:inbound=ping.rrd:lo_int:AVERAGE XPORT:inbound:"out bytes"
But this result for rrdtool xport looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xport>
<meta>
<start>1663749900</start>
<end>1663836300</end>
<step>300</step>
<rows>289</rows>
<columns>1</columns>
<legend>
<entry>out bytes</entry>
</legend>
</meta>
<data>
<row><t>1663749900</t><v>NaN</v></row>
<row><t>1663750200</t><v>NaN</v></row>
<row><t>1663750500</t><v>NaN</v></row>
<row><t>1663750800</t><v>NaN</v></row>
<row><t>1663751100</t><v>NaN</v></row>
<row><t>1663751400</t><v>NaN</v></row>
<row><t>1663751700</t><v>NaN</v></row>
<row><t>1663752000</t><v>NaN</v></row>
<row><t>1663752300</t><v>NaN</v></row>
<row><t>1663752600</t><v>NaN</v></row>
<row><t>1663752900</t><v>NaN</v></row>
<row><t>1663753200</t><v>NaN</v></row>
<row><t>1663753500</t><v>NaN</v></row>
<row><t>1663753800</t><v>NaN</v></row>
<row><t>1663754100</t><v>NaN</v></row>
Describe the bug
The tests performed during pip install, which attempt to build a small amount of source code including rrd.h only use /usr/include/ and /usr/lib/ as include and lib directories.
Under OSX / Macports, these directories should be /opt/local/include and /opt/local/lib .
As a result, rrdtool cannot be installed via pip within a Macports system.
Collecting rrdtool
Using cached rrdtool-0.1.15.tar.gz (21 kB)
ERROR: Command errored out with exit status 1:
command: /Users/darkside/Dev/kiwisnr/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/g5/f1sl_t4x2yn65bnb66pkwssm0000gn/T/pip-install-47rqsze7/rrdtool/setup.py'"'"'; __file__='"'"'/private/var/folders/g5/f1sl_t4x2yn65bnb66pkwssm0000gn/T/pip-install-47rqsze7/rrdtool/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/g5/f1sl_t4x2yn65bnb66pkwssm0000gn/T/pip-pip-egg-info-qwj88vz5
cwd: /private/var/folders/g5/f1sl_t4x2yn65bnb66pkwssm0000gn/T/pip-install-47rqsze7/rrdtool/
Complete output (5 lines):
/var/folders/g5/f1sl_t4x2yn65bnb66pkwssm0000gn/T/tmp_python_rrdtool0a8kjkfx/test_rrdtool.c:2:10: fatal error: 'rrd.h' file not found
#include <rrd.h>
^~~~~~~
1 error generated.
Error: Unable to compile the binary module. Do you have the rrdtool header and libraries installed?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
To Reproduce
Steps to reproduce the behaviour:
Desktop (please complete the following information):
"PYTHON": "3.7.3",
"RRDTOOL": "1.7.1",
"PYTHON_RRDTOOL": "0.1.16",
This is just a small thing, but it took me some time to understand why my program was not working properly.
Normally I always leave a space between option and argument. But for the options -a and -n the space must be omitted exceptionally, otherwise RRDTool will return an error.
Example:
'-a SVG', # unsupported graphics format ' SVG'
'-n DEFAULT:10', # invalid text property format
'-n TITLE:14:Times', #invalid text property format
Invoking RRDTool from bash with spaces works properly.
Here is the pip console output:
rrdtool compile error.txt
I hope that helps.
Edit: when changing gcc default behavior by generating and editing the spec file it compiles without any complaints.
Hi,
It looks like the update function results in lines that are not smooth.
I am using the rrdtool.update function with the following arguments:
rrdtool.update(dfile, '--daemon', RRDCACHEDSOCK, 'N:'+str(bytesreceived)+':'+str(bytessent))
Lines appear smooth though if they are updated via the command line:
subprocess.check_output([RRDTOOL, 'update', dfile, '--daemon', RRDCACHEDSOCK,
'N:'+str(bytesreceived)+':'+str(bytessent)])
(ie, I am using the same script with the same arguments to update the RRD).
Is there something I am doing wrong?
I've been using your rrdtool
library for some time. On systems running Ubuntu 14.04.4 LTS and rrdtool v0.1.1. reading 1000+ files for data, it works flawlessly.
On Ubuntu 16.04.1 LTS it works flawlessly on v0.1.1 for the same files, but gets the following intermittent errors on v0.1.5.
The code I'm using is below, where filename
is the RRD filename and start_at
is UTC time.
results = rrdtool.fetch(filename, 'MAX', '-s', start_at, '-e', 'now')
In version 0.1.5 I get the following errors:
Traceback: Traceback (most recent call last):
File "/mysterious/rrd_reader.py", line 579, in get_rrd_data
filename, 'MAX', '-s', start_at, '-e', 'now')
rrdtool.OperationalError: Usage: rrdtool fetch <file> <CF> [options]
Traceback: Traceback (most recent call last):
File "/mysterious/rrd_reader.py", line 579, in get_rrd_data
filename, 'MAX', '-s', start_at, '-e', 'now')
rrdtool.OperationalError: Usage: rrdtool (null) <file> <CF> [options]
Traceback (most recent call last):
File "/mysterious/rrd_reader.py", line 579, in get_rrd_data
filename, 'MAX', '-s', start_at, '-e', 'now')
rrdtool.OperationalError
Traceback: Traceback (most recent call last):
File "/mysterious/rrd_reader.py", line 579, in get_rrd_data
filename, 'MAX', '-s', start_at, '-e', 'now')
rrdtool.OperationalError: unknown consolidation function '1474497600'
Sometimes it doesn't recognize the timestamp, other times it doesn't seem to know I'm doing a fetch
and messages (null)
instead.
The errors are repeatable by just upgrading to v0.1.5 on Ubuntu 16.04.1 LTS. They go away when downgraded to v0.1.1
Typically no more than 20 minutes of 300s RRD step data is read per RRD file as the script runs three times per hour.
The script also sometimes fails with a segmentation fault on the newer code like this. Works perfectly on the older v0.1.1 code.
Segmentation fault (core dumped)
Is there any chance of getting this merged upstream (https://github.com/oetiker/rrdtool-1.x/tree/master/bindings/python)? It's a little frustrating that the two are incompatible but share the same name. For example, "rrdtool" on PyPI is this, but the rrdtool-python package on Fedora (provides python-rrdtool) is the other.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.