Skip to content
snmp agent
Haskell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Network/Protocol
.gitignore
.travis.yml
LICENSE
README.md
Setup.hs
snmp.cabal
stack.yaml

README.md

snmp

Build Status Gitter chat

SNMP protocol implementation. Supports v1, v2c and v3 versions.

Usage example:

import Network.Protocol.Snmp
import Control.Applicative
import Network.Socket.ByteString (recv, sendAll)
import Network.Socket hiding (recv, sendAll)

-- create new empty packet
v2 :: Packet
v2 = initial Version2

community = Community "hello"

oi = Coupla [1,3,6,1,2,1,1,4,0] Zero

-- set community, oid
packet :: Community -> Coupla -> Packet
packet community oi =
  setCommunityP community . setSuite (Suite [oi]) $ v2

-- here must be code for create udp socket
makeSocket :: Hostname -> Port -> IO Socket
makeSocket = undefined

main :: IO ()
main = do
   socket <- makeSocket "localhost" "161"
   sendAll socket $ encode $ setRequest (GetRequest 1 0 0) packet
   result <- decode <$> recv socket 1500 :: IO Packet
   print $ getSuite result
You can’t perform that action at this time.