Coder Social home page Coder Social logo

etingof / snmpsim-control-plane Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 5.0 381 KB

SNMP simulator control plane

Home Page: http://snmplabs.com/snmpsim/

License: BSD 2-Clause "Simplified" License

Python 92.08% Shell 7.92%
snmp-simulator snmpv3 rest-api monitoring snmpsim

snmpsim-control-plane's Introduction

SNMP Simulator Control Plane

PyPI Python Versions Build status GitHub license

SNMP Simulator Control Plane is a set of tools facilitating automated, distributed and remotely controlled SNMP Simulator deployment.

Features

  • Facilitates distributed SNMP Simulator deployment
  • Groups simulated SNMP agents into virtual labs
  • Makes SNMP simulator remotely controllable
  • Collects and serves performance and operational metrics
  • REST API is compliant to OpenAPI 3.0.0

Docs & Downloads

SNMP Simulator Control Plane tool is freely available for download from PyPI or GitHub.

User documentation is maintained at snmplabs.com.

Getting help

If something does not work as expected, open an issue at GitHub or post your question on Stack Overflow.

Everyone is welcome to fork the repo and propose a feature or a fix!

Copyright (c) 2019-2020, Ilya Etingof. All rights reserved.

snmpsim-control-plane's People

Contributors

etingof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

snmpsim-control-plane's Issues

Improve docstrings

Add proper docstrings throughout the code, with all the regular sections.

Add supervisor process

Add a supervisor process which should invoke, tear down and maintain running SNMP simulator command responder processes based on watching changes in SNMP simulator invocation scripts.

Add SNMP engine ID generation and persistence

So far SNMP engine ID can be set via REST API. If not set (the default), it will be up to snmpsimd to chose and use one. The problem is that SNMP engine ID becomes invisible to REST API and less persistent.

PostgreSQL ENUM type requires a name

Hi Elya,
I've been trying to set up the snmpsim-ui angular app but am having a hard time.
I understand it relies on the snmpsim-control-plane / snmp-mgmt-api tools (both?) but am failing at the db.create_all() stage in
snmpsim_control_plane/commands/management.py
stack-trace.txt

This is with PostgreSQL version 13.1 and Python 3.8.5.

Add supervisor metrics generation

The supervisor process is capable of herding its children, however it does not produce any runtime insights onto how the children are doing.

We need to make it collecting the items that Metrics API is designed to expose.

Add unit test coverage

We should have a unit test coverage to ensure the code is not broken upon further changes.

Add recording tagging feature

Presently, simulation data recording is reflected directly on the file system and has no ties with the DB. This makes it impossible to tag the recording in the same way as other Management REST API items are tagged.

Running Control Plane inside a docker

Hello
I have a problems with installing control plane inside the docker container connected with the snmp simulator that is running on the different docker container. I have already working solution with SNMP Simulator and need to run control plane to be able to change the values for specific OID in runtime from automation tests/demo purposes.

I tried to develop this based on this document https://docs.lextudio.com/snmpsim-control-plane/deployment and reach a wall just on the beginning when I am trying to run this step with bootstrap databases.
snmpsim-mgmt-restapi --config /etc/snmpsim/snmpsim-management.conf --recreate-db

So this is how my dockerfile is looks like

FROM python:3.11-slim

RUN pip install snmpsim-control-plane-lextudio
RUN pip install gunicorn

RUN mkdir -p /var/snmpsim /etc/snmpsim /var/run/snmpsim /var/log/snmpsim/metrics

COPY --chmod=777 data /etc/snmpsim/

RUN snmpsim-mgmt-restapi --config /etc/snmpsim/snmpsim-management.conf --recreate-db
RUN snmpsim-metrics-restapi --config /etc/snmpsim/snmpsim-metrics.conf --recreate-db

RUN snmpsim-mgmt-supervisor \
  --watch-dir /var/snmpsim/supervised \
  --daemonize \
  --pid-file /var/run/snmpsim/supervisor.pid \
  --logging-method file:/var/log/snmpsim/supervisor.log \
  --reporting-method jsondoc:/var/log/snmpsim/metrics

EXPOSE 5000/tcp

CMD gunicorn -b 0.0.0.0:5000 --env "SNMPSIM_MGMT_CONFIG=/etc/snmpsim/snmpsim-management.conf" --access-logfile /var/log/snmpsim/mgmt-access.log --error-logfile /log/snmpsim/mgmt-error.log --daemon snmpsim_control_plane.wsgi.management:app

Inside the data folder I have these two .conf files.

What I am getting while building docker image is:

 => ERROR [6/8] RUN snmpsim-mgmt-restapi --config /etc/snmpsim/snmpsim-management.conf --recreate-db                                                                                                               0.5s ------
 > [6/8] RUN snmpsim-mgmt-restapi --config /etc/snmpsim/snmpsim-management.conf --recreate-db:
0.421 Traceback (most recent call last):
0.421   File "/usr/local/bin/snmpsim-mgmt-restapi", line 5, in <module>
0.421     from snmpsim_control_plane.commands.management import main
0.421   File "/usr/local/lib/python3.11/site-packages/snmpsim_control_plane/commands/management.py", line 13, in <module>
0.421     from snmpsim_control_plane.management import app
0.421   File "/usr/local/lib/python3.11/site-packages/snmpsim_control_plane/management/__init__.py", line 11, in <module>
0.421     from flask import Flask
0.421   File "/usr/local/lib/python3.11/site-packages/flask/__init__.py", line 14, in <module>
0.421     from jinja2 import escape
0.421 ImportError: cannot import name 'escape' from 'jinja2' (/usr/local/lib/python3.11/site-packages/jinja2/__init__.py)
------
Dockerfile:10
--------------------
   8 |     COPY --chmod=777 data /etc/snmpsim/
   9 |
  10 | >>> RUN snmpsim-mgmt-restapi --config /etc/snmpsim/snmpsim-management.conf --recreate-db
  11 |     RUN snmpsim-metrics-restapi --config /etc/snmpsim/snmpsim-metrics.conf --recreate-db
  12 |
--------------------
ERROR: failed to solve: process "/bin/sh -c snmpsim-mgmt-restapi --config /etc/snmpsim/snmpsim-management.conf --recreate-db" did not complete successfully: exit code: 1

Is there anything you can do @lextm with this topic?

I saw the jinja2 within version 3.10 drops escape from the package and it needs to be imported from MarkupSafe
https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-0

I remember what you told in my different issue related with SNMP Simulator itself but really would like to have this working. Thanks!

Invalid cross-device-link errors

I have a machine where /tmp is on a different filesystem than root. This causes
2020-05-13T18:29:27.65 snmpsim_control_plane.commands.supervisor: ERROR Failure while dumping metrics into /var/log/snmpsim/metrics/jsondoc/1589387367.json: [Errno 18] Invalid cross-device link: '/tmp/tmp5mke_umz' -> '/var/log/snmpsim/metrics/jsondoc/1589387367.json' errors. The reason i believe is that os.rename is not working in this scenario.

Add multiprocess configuration support

Add a capability of spreading desired SNMP simulator command responder configuration across N instances to improve overall performance and concurrency of the simulated SNMP agents.

Update online documentation

This issue is to add more detailed documentation (also covering the new metrics feature) along with example configurations.

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.