GithubHelp home page GithubHelp logo

for-bu's Introduction

README

A starting point for DSOS Python data query.

See https://github.com/ovis-hpc/ldms-containers for the scripts / Dockerfiles that build all ovishpc/ldms-* images.

For Django UI-backend, see https://hub.docker.com/repository/docker/ovishpc/ldms-ui/general

For Grafana + grafana plugin, see https://hub.docker.com/repository/docker/ovishpc/ldms-grafana/general

For Docker Engine installation (Community Edition; CE):

meminfo.csv is the CSV version of the meminfo container.

$ docker pull ovishpc/ldms-agg # this contains sos/dsos libraries
$ tar xzf store.tgz # extract meminf-1 and meminfo-2 stores

# Create 'dsos' overlay network
$ docker network create --scope=swarm --attachable -d overlay dsos

# start dsos-1 and dsos-2;
#   dsos-1 provides `/store/meminfo` container with `store/meminfo-1`
#   dsos-2 provides `/store/meminfo` container with `store/meminfo-2`
$ ./start-dsosd-12.sh
$ docker ps # check if they run

# start `dsos-dev` that also use ovishpc/ldms-agg since it is the smallest image
# containing sos/dsos. Override the entrypoint to '/bin/bash'
$ docker run -it --name dsos-dev --hostname dsos-dev --network dsos \
             --entrypoint /bin/bash ovishpc/ldms-agg

# distributed-sos config file; basically inform Sos.Session a list of hosts to
# look for containers.
(dsos-dev) $ cat >dsos.conf <<EOF
dsos-1
dsos-2
EOF

# query dsos database with Python
(dsos-dev) $ python3 -i
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sosdb import Sos
>>> session = Sos.Session("dsos.conf")
>>> cont = session.open("/store/meminfo") # or "/store/vmstat" or "/store/procstat"
>>> q = cont.query(1024*1024)
>>> q.select('SELECT * FROM meminfo')
>>> data = q.next()
>>> data
                                            timestamp  component_id  job_id  app_id  MemTotal  MemFree  MemAvailable  ...  HugePages_Free  HugePages_Rsvd  HugePages_Surp  Hugepagesize  Hugetlb  DirectMap4k  DirectMap2M
2023-03-13 19:53:02.001765 2023-03-13 19:53:02.001765             1       0       0   2031012  1047256       1631228  ...               0               0               0          2048        0       106432      1990656
2023-03-13 19:53:03.002108 2023-03-13 19:53:03.002108             1       0       0   2031012  1047256       1631228  ...               0               0               0          2048        0       106432      1990656
2023-03-13 19:53:04.001401 2023-03-13 19:53:04.001401             1       0       0   2031012  1047256       1631228  ...               0               0               0          2048        0       106432      1990656
2023-03-13 19:53:05.001651 2023-03-13 19:53:05.001651             1       0       0   2031012  1047256       1631228  ...               0               0               0          2048        0       106432      1990656
2023-03-13 19:53:06.001872 2023-03-13 19:53:06.001872             1       0       0   2031012  1047256       1631228  ...               0               0               0          2048        0       106432      1990656
...                                               ...           ...     ...     ...       ...      ...           ...  ...             ...             ...             ...           ...      ...          ...          ...
2023-03-13 21:06:13.001203 2023-03-13 21:06:13.001203             4       0       0   2031012  1165824       1681988  ...               0               0               0          2048        0       102336      1994752
2023-03-13 21:06:14.001232 2023-03-13 21:06:14.001232             4       0       0   2031012  1165824       1681988  ...               0               0               0          2048        0       102336      1994752
2023-03-13 21:06:15.001314 2023-03-13 21:06:15.001314             4       0       0   2031012  1165824       1681988  ...               0               0               0          2048        0       102336      1994752
2023-03-13 21:06:16.001386 2023-03-13 21:06:16.001386             4       0       0   2031012  1165824       1681988  ...               0               0               0          2048

[17568 rows x 56 columns]
>>> type(data)
<class 'pandas.core.frame.DataFrame'>
>>> next_data = q.next()
>>> next_data
>>> type(next_data)
<class 'NoneType'>
>>> # No more data

for-bu's People

Contributors

narategithub avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.