Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,14 @@ Then you can start and stop it with these commands:

configuration file can be found on the default location "/etc/snmp/snmpd.conf".


### To enable AgentX over tcp
Edit your snmpd.conf file to enable tcp connection
agentXSocket tcp:localhost:705

In your minimal client override the following parameters prior to starting your client

# set the socket family, in this case Internet Protocol v4 Addresses
pyagentx.SOCKET_FAMILY = socket.AF_INET
# set the socket to connect to, in this case localhost on port 705
pyagentx.SOCKET_PATH = ('localhost',705)
2 changes: 2 additions & 0 deletions pyagentx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-

import logging
import socket

from pyagentx.updater import Updater
from pyagentx.agent import Agent
Expand All @@ -21,6 +22,7 @@ def setup_logging(debug=False):
logger.addHandler(ch)

SOCKET_PATH = "/var/agentx/master"
SOCKET_FAMILY = socket.AF_UNIX

AGENTX_EMPTY_PDU = 1
AGENTX_OPEN_PDU = 1
Expand Down
2 changes: 1 addition & 1 deletion pyagentx/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, queue, oid_list, sethandlers):
def _connect(self):
while True:
try:
self.socket = socket.socket( socket.AF_UNIX, socket.SOCK_STREAM )
self.socket = socket.socket(pyagentx.SOCKET_FAMILY, socket.SOCK_STREAM )
self.socket.connect(pyagentx.SOCKET_PATH)
self.socket.settimeout(0.1)
return
Expand Down