/usr/bin/ceres-node-read is in python-ceres 0.10.0~git20130913-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #! /usr/bin/python
import sys
import time
from optparse import OptionParser
from ceres import CeresTree, getTree
parser = OptionParser(usage='''%prog [options] <path>
If --tree is specified, <path> is taken as a node path
Otherwise <path> is taken as a filesystem path
''')
parser.add_option('--fromtime', default=int(time.time() - 900), type='int')
parser.add_option('--untiltime', default=int(time.time()), type='int')
parser.add_option('--tree', default=None)
parser.add_option('--batch', action='store_true', help="Use numeric timestamps")
options, args = parser.parse_args()
if not args:
parser.print_usage()
sys.exit(1)
if options.tree:
nodePath = args[0]
tree = CeresTree(options.tree)
else:
fsPath = args[0]
tree = getTree(fsPath)
if not tree:
print "error: %s is not in a ceres tree" % fsPath
sys.exit(1)
nodePath = tree.getNodePath(fsPath)
results = tree.fetch(nodePath, options.fromtime, options.untiltime)
for (timestamp, value) in results:
if options.batch:
print "%d\t%s" % (timestamp, value)
else:
print "%s\t%s" % (time.ctime(timestamp), value)
|