Giter VIP home page Giter VIP logo

snmp's Introduction

SNMP Server

This Python script implements a Simple Network Management Protocol (SNMP) trap receiver that can handle SNMP traps sent by various network devices. The script uses pysnmp library to listen for SNMP traps on a specified IP address and port. It also integrates with Discord and MongoDB to send notifications and store the received SNMP traps. This server is part of a larger project, which includes several microservices and other components that collectively provide tools to manage on-premise networking devices. The view the cluster architecture and the CI/CD pipeline for deployment, refer to the Cluster Manifest Repository.

Prerequisites

  • Python 3.7 or later
  • A MongoDB database
  • A Discord channel

Getting Started

To run this application, follow these steps:

  • Clone this repository
  • Install the required packages using pip install -r requirements.txt
  • Run the application using python server.py
  • The application will listen on port 162 for SNMP traps

MongoDB Storage

Each incoming SNMP trap is stored in its own collection within the snmp database, the trap data is stored in the following format:

{
    "system_up_time_instance": <System Up Time Instance>,
    "source_address": <Source IP Address>,
    "module_id": <Trap OID>,
    "message": <Trap Message>,
}

Discord Alerting

When a trap message is received an alert will be sent to the Discord channel specified in the DISCORDURL environment variable. The alert will include the device IP address, OID, and the message.

Environmental Variables

Create a .env file in the root directory of the project and set the following environment variables:

MONGOURL=<MongoDB URL>
DISCORDURL=https://discord.com/api/webhooks/<your_webhook_url>

snmp's People

Contributors

steffensenchyna avatar

Watchers

 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.