Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
1
answers
2798
views
snmptt running as non-root, writting to file as root
I'm running `snmptt` as a SNMP trap handler for `snmptrapd`, with the aim being to write to a trap file that can be read and processed by Zabbix. I have set up snmptt to run as the `zabbix` user by changing the `init` script. # grep daemon /etc/init.d/snmptt # description: SNMP Trap Translator daemo...
I'm running
snmptt
as a SNMP trap handler for snmptrapd
, with the aim being to write to a trap file that can be read and processed by Zabbix.
I have set up snmptt to run as the zabbix
user by changing the init
script.
# grep daemon /etc/init.d/snmptt
# description: SNMP Trap Translator daemon
# Short-Description: SNMP Trap Translator daemon
OPTIONS="--daemon"
daemon --user=zabbix /usr/sbin/snmptt $OPTIONS
snmpttt
is running as expected as the zabbix
user, the same user which is running the Zabbix server.
# ps -ef | grep snmp
root 3796 1 0 Jun19 ? 00:13:04 /usr/sbin/snmpd -LS0-6d -Lf /dev/null -p /var/run/snmpd.pid
zabbix 4444 1 0 15:00 ? 00:00:00 /usr/bin/perl /usr/sbin/snmptt --daemon
zabbix 4445 4444 0 15:00 ? 00:00:00 /usr/bin/perl /usr/sbin/snmptt --daemon
root 9300 29899 0 15:25 pts/2 00:00:00 grep snmp
zabbix 16576 16511 0 Aug16 ? 00:00:11 /path/to/sbin/zabbix_server: snmp trapper [processed data in 0.000007 sec, idle 1 sec]
root 16600 1 0 Aug16 ? 00:00:07 /usr/sbin/snmptrapd -A -Lf /var/log/snmptrapd.log -D -p /var/run/snmptrapd.pid
The log file to send traps caught is /var/tmp/zabbixtest/zabbix_traps.tmp
# egrep "^(log_file|pid)" /etc/snmp/snmptt.ini
pid_file = /var/run/snmptt/snmptt.pid
log_file=/var/tmp/zabbixtest/zabbix_traps.tmp
However, the trap log file is being written to, and owned by the root
user, not as the zabbix
user as expected. Moreover, the permissions on the file are 0640
, meaning that the zabbix user running the server is not able to read the file.
# service snmptt stop
Stopping snmptt: [ OK ]
# rm /var/tmp/zabbixtest/zabbix_traps.tmp
rm: remove regular file `/var/tmp/zabbixtest/zabbix_traps.tmp'? y
# ls -lia /var/tmp/zabbixtest/zabbix_traps.tmp
ls: cannot access /var/tmp/zabbixtest/zabbix_traps.tmp: No such file or directory
# ls -lia /var/tmp/zabbixtest/
total 24
263224 drwxrwxr-x 2 root zabbix 4096 Aug 17 15:32 .
262145 drwxrwxrwt 7 root root 4096 Aug 17 14:53 ..
# service snmptt start
Starting snmptt: PID file: /var/run/snmptt/snmptt.pid
[ OK ]
# ps -ef | grep snmptt
zabbix 9944 1 0 15:32 ? 00:00:00 /usr/bin/perl /usr/sbin/snmptt --daemon
zabbix 9945 9944 0 15:32 ? 00:00:00 /usr/bin/perl /usr/sbin/snmptt --daemon
root 9981 29899 0 15:32 pts/2 00:00:00 grep snmptt
# ps -ef | grep snmp
root 3796 1 0 Jun19 ? 00:13:04 /usr/sbin/snmpd -LS0-6d -Lf /dev/null -p /var/run/snmpd.pid
zabbix 9944 1 0 15:32 ? 00:00:00 /usr/bin/perl /usr/sbin/snmptt --daemon
zabbix 9945 9944 0 15:32 ? 00:00:00 /usr/bin/perl /usr/sbin/snmptt --daemon
root 9986 29899 0 15:32 pts/2 00:00:00 grep snmp
zabbix 16576 16511 0 Aug16 ? 00:00:11 /path/to/sbin/zabbix_server: snmp trapper [processed data in 0.000079 sec, idle 1 sec]
root 16600 1 0 Aug16 ? 00:00:07 /usr/sbin/snmptrapd -A -Lf /var/log/snmptrapd.log -D -p /var/run/snmptrapd.pid
# ls -lia /var/tmp/zabbixtest/zabbix_traps.tmp
262265 -rw-r----- 1 root root 122 Aug 17 15:32 /var/tmp/zabbixtest/zabbix_traps.tmp
Note the file permissions and ownership of /var/tmp/zabbixtest/zabbix_traps.tmp
.
Accordingly, the zabbix
user is unable to read the file and is hence unable to process it.
I can fix by manually modifying the mode of the trap file /var/tmp/zabbixtest/zabbix_traps.tmp
to 0644
, for example, but I am hoping there is a better way, e.g. via a configuration file, since the file location will most likely change. (There are some blog sites recommending to change the mode to 0777, obviously that is not the correct solution).
I guess it is due to the snmptrapd
configuration, running as root, but not sure the best way to fix this.
**My questions:**
Why is the trap log file being written to as the root
user with 0640
permissions, instead of as zabbix
user running snmptt
?
How can/should I configure snmptt
and/or snmptrapd
to have the trap file be owned and readable by the zabbix
user instead of root user.
**Other relevant info:**
snmptrapd config file:
# grep -v '^#' /etc/snmp/snmptrapd.conf
disableAuthorization yes
traphandle default /usr/sbin/snmptthandler
Running RHEL 6.6
hilcharge
(359 rep)
Aug 17, 2017, 06:54 AM
• Last activity: Jul 19, 2025, 05:00 PM
0
votes
1
answers
2110
views
Systemd does not seem to be generating the Main PID properly
I modified the /lib/systemd/system/snmpd.service file as needed. Below is the contents of the snmpd.service file that I modified. ``` [Unit] Description=Simple Network Management Protocol (SNMP) Daemon. After=network.target ConditionPathExists=/etc/snmp/snmpd.conf [Service] Type=notify RuntimeDirect...
I modified the /lib/systemd/system/snmpd.service file as needed.
Below is the contents of the snmpd.service file that I modified.
[Unit]
Description=Simple Network Management Protocol (SNMP) Daemon.
After=network.target
ConditionPathExists=/etc/snmp/snmpd.conf
[Service]
Type=notify
RuntimeDirectory=agentx
ExecStart=/usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
After daemon-reload, I entered the command "systemctl start snmpd".
And I got the error below.
× snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
Loaded: loaded (/lib/systemd/system/snmpd.service; enabled; vendor preset: enabled)
Active: failed (Result: protocol) since Thu 2023-03-16 11:39:21 KST; 12min ago
Process: 3046725 ExecStart=/usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid (code=exited, status=0/SUCCESS)
Main PID: 3046725 (code=exited, status=0/SUCCESS)
CPU: 48ms
Mar 16 11:39:21 esm-dev systemd: Starting Simple Network Management Protocol (SNMP) Daemon....
Mar 16 11:39:21 esm-dev snmpd: Turning on AgentX master support.
Mar 16 11:39:21 esm-dev snmpd: NET-SNMP version 5.9.1
Mar 16 11:39:21 esm-dev systemd: snmpd.service: Got notification message from PID 3046727, but reception only permitted for main PID which is currently not known
Mar 16 11:39:21 esm-dev snmpd: Received TERM or STOP signal... shutting down...
Mar 16 11:39:21 esm-dev systemd: snmpd.service: Failed with result 'protocol'.
Mar 16 11:39:21 esm-dev systemd: Failed to start Simple Network Management Protocol (SNMP) Daemon..
According to the error, it seems that the main PID and the PID that delivered the notification message are different.
Main PID: 3046725
Got notification message from PID 3046727
...
and
The /run/snmpd.pid file contained 3046727
One interesting thing is that the difference between the MainPID and the PID that delivered the notification message is always 2.
When I entered systemctl start snmpd again,
× snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
Loaded: loaded (/lib/systemd/system/snmpd.service; enabled; vendor preset: enabled)
Active: failed (Result: protocol) since Thu 2023-03-16 11:58:30 KST; 2s ago
Process: 3047690 ExecStart=/usr/sbin/snmpd -Lsd -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -p /run/snmpd.pid (code=exited, status=0/SUCCESS)
Main PID: 3047690 (code=exited, status=0/SUCCESS)
CPU: 41ms
Mar 16 11:58:30 esm-dev systemd: Starting Simple Network Management Protocol (SNMP) Daemon....
Mar 16 11:58:30 esm-dev snmpd: Turning on AgentX master support.
Mar 16 11:58:30 esm-dev snmpd: NET-SNMP version 5.9.1
Mar 16 11:58:30 esm-dev snmpd: Received TERM or STOP signal... shutting down...
Mar 16 11:58:30 esm-dev systemd: snmpd.service: Got notification message from PID 3047692, but reception only permitted for main PID which is currently not known
Mar 16 11:58:30 esm-dev systemd: snmpd.service: Failed with result 'protocol'.
Mar 16 11:58:30 esm-dev systemd: Failed to start Simple Network Management Protocol (SNMP) Daemon..
MainPID: 3047690
Got notification message from PID 3047692
I wonder why MainPID and notification message from PID are different. And I wonder how to run snmpd normally with systemctl.
anyone help me?
monster-dev
(19 rep)
Mar 16, 2023, 03:58 AM
• Last activity: Jul 18, 2025, 03:03 AM
0
votes
1
answers
3383
views
SNMPWalk module not found
I am currently trying to get extended output on SNMPWalk. I have installed snmp-mibs downloader and have been running download-mibs. I am using the following command: snmpwalk -v2c -c public [ip] -m NET-SNMP-EXTEND-MIB::nsExtendObjects and get the following error: MIB search path: /usr/share/snmp/mi...
I am currently trying to get extended output on SNMPWalk.
I have installed snmp-mibs downloader and have been running download-mibs.
I am using the following command:
snmpwalk -v2c -c public [ip] -m NET-SNMP-EXTEND-MIB::nsExtendObjects
and get the following error:
MIB search path:
/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/var/lib/mibs:/var/lib/mibs/ietf:/var/lib/mibs/iana
Cannot find module (nsExtendObjects): At line 1 in (none)
I can confirm that my modules are in the right place, as I have verified manually.
I have tried using -M to specify the location of modules.
I use NET-SNMP version: 5.9
After the error, I get the same output as if I did not use extended mode.
I can also confirm that there should be a different output, as another machine using the same configuration is able to get extended output. The "public" string is the right one.
Thank you for any help :)
Ixiliae
(1 rep)
May 16, 2021, 12:57 PM
• Last activity: Jul 12, 2025, 08:03 PM
2
votes
2
answers
8037
views
Unable to view traps through snmptrad?
I've been unable to view traps through `snmptrapd`. I generated a SNMP trap manually using the below provided `snmptrap` command: snmptrap -c public -v 2c -n "" localhost 0 uptime But I'm unable to capture the trap using the below provided `snmptrapd` command: snmptrapd -f -M /usr/share/snmp/mibs -m...
I've been unable to view traps through
snmptrapd
. I generated a SNMP trap manually using the below provided snmptrap
command:
snmptrap -c public -v 2c -n "" localhost 0 uptime
But I'm unable to capture the trap using the below provided snmptrapd
command:
snmptrapd -f -M /usr/share/snmp/mibs -m inUnixPlatformApp-MIB -Os
**Question:** How can I capture the snmptrap
in snmptrapd
?
### Installed software
I have the following RPM packages installed on the RHEL 6.3 server:
# rpm -qa|grep -i snmp
net-snmp-libs-5.5-41.el6.x86_64,
net-snmp-libs-5.5-41.el6.i686,
net-snmp-devel-5.5-41.el6.x86_64,
net-snmp-5.5-41.el6.x86_64,
net-snmp-perl-5.5-41.el6.x86_64,
net-snmp-utils-5.5-41.el6.x86_64,
perl-SNMP_Session-1.12-4.el6.noarch
### System info
- Linux Rhel: 6.3
- SNMP Master Agent version: 5.5
- SNMP Protocol version: v2C
user57619
(21 rep)
Jan 25, 2014, 06:29 PM
• Last activity: Jun 10, 2025, 08:05 PM
5
votes
1
answers
17963
views
How to properly configure snmpd?
I installed `snmp` on CentOS `7.2`, like so: yum -y install net-snmp net-snmp-utils I made a backup of my `snmpd.conf` file: cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig then I cleared the text, with this: echo "" > /etc/snmp/snmpd.conf and added to the `snmpd.conf`, the following: rocommunity...
I installed
snmp
on CentOS 7.2
, like so:
yum -y install net-snmp net-snmp-utils
I made a backup of my snmpd.conf
file:
cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
then I cleared the text, with this:
echo "" > /etc/snmp/snmpd.conf
and added to the snmpd.conf
, the following:
rocommunity "#random$" monitoring_server_ip
The monitoring_server_ip
is the server that that is allowed to connect to this snmpd server.
Restarted snmpd
/bin/systemctl restart snmpd
When I run snmpwalk on my CentOS 7.2 server
snmpwalk -v2c -c public localhost system
I then get:
> Timeout: No Response from localhost
Which is accurate, because there is only one IP address that can do that, as we have defined before.
ps
shows that snmp
is running
/usr/sbin/snmpd -LS0-6d -f
This is my first time playing with snmp
and any help is greatly appreciated!
Output of iptables -L -n | grep udp
shows this:
...
Chain IN_public_allow (1 references)
94 target prot opt source destination
95 ACCEPT udp -- XX.XXX.XXX.XXX 0.0.0.0/0 udp dpt:161 ctstate NEW
...
All of the destination was too 0.0.0.0/0
?
Netstat shows the following port:
netstat -ulnp | grep 161
udp 0 0 0.0.0.0:161 0.0.0.0:* 19062/snmpd
also this:
netstat -lu | grep snmp
udp 0 0 0.0.0.0:snmp 0.0.0.0:*
Also, in my firewall, added that only one IP address can access my snmp server:
firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4" source address="XX.XXX.XXX.XX" port protocol="udp" port="161" accept"
blade19899
(577 rep)
Mar 10, 2016, 04:02 PM
• Last activity: Mar 14, 2025, 12:04 PM
1
votes
1
answers
4698
views
How to understand SNMP MIB?
As I understand, SNMP Management Information Base databases are used by Network Management Stations to translate data from SNMP agents into understandable form. For example in case of *sysUpTimeInstance*: $ snmpwalk -v 2c -c public 10.10.10.1 sysUpTimeInstance DISMAN-EVENT-MIB::sysUpTimeInstance = T...
As I understand, SNMP Management Information Base databases are used by Network Management Stations to translate data from SNMP agents into understandable form. For example in case of *sysUpTimeInstance*:
$ snmpwalk -v 2c -c public 10.10.10.1 sysUpTimeInstance
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (28267576) 3 days, 6:31:15.76
$
..I guess it is thanks to MIB that 28267576 is converted into 3 days, 6 hours, 31 minutes, 15.76 seconds? Now I searched for the correct MIB file to see this translation:
$ grep -ir sysUpTimeInstance /usr/local/share/smi/mibs/
/usr/local/share/smi/mibs/ietf/DISMAN-EVENT-MIB:sysUpTimeInstance OBJECT IDENTIFIER ::= { sysUpTime 0 }
/usr/local/share/smi/mibs/ietf/DISMAN-EVENT-MIB: DEFVAL { sysUpTimeInstance }
/usr/local/share/smi/mibs/ietf/DISMAN-EXPRESSION-MIB:sysUpTimeInstance OBJECT IDENTIFIER ::= { sysUpTime 0 }
/usr/local/share/smi/mibs/ietf/DISMAN-EXPRESSION-MIB: DEFVAL { sysUpTimeInstance }
$
..and looks like it is defined in
/usr/local/share/smi/mibs/ietf/DISMAN-EVENT-MIB
file. How should I understand this sysUpTimeInstance OBJECT IDENTIFIER ::= { sysUpTime 0 }
?
Martin
(8156 rep)
Jul 3, 2015, 03:01 PM
• Last activity: Mar 7, 2025, 03:45 PM
0
votes
0
answers
45
views
SNMPD Not Starting After Adding agentAddress in Metasploitable 2
I am facing an issue with SNMPD in Metasploitable 2. Initially, SNMPD was running fine, but after manually adding an agentAddress line in snmpd.conf, the service fails to start. There are no error messages, and ps aux | grep snmp does not show any running process. Here are the details: 🖥️ Sy...
I am facing an issue with SNMPD in Metasploitable 2. Initially, SNMPD was running fine, but after manually adding an agentAddress line in snmpd.conf, the service fails to start. There are no error messages, and ps aux | grep snmp does not show any running process. Here are the details:
🖥️ System Information:
OS: Metasploitable 2 (Ubuntu 8.04-based)
SNMP Version: (default version in Metasploitable 2)
Changes Made: Manually added the following line in /etc/snmp/snmpd.conf:
- agentAddress udp:192.168.X.Y:161
Expected Behavior: SNMP should start and listen on 192.168.X.Y:161.
Actual Behavior: SNMPD does not start, and there are no errors in logs.
⚡ What I Have Tried So Far
1. Checked for running SNMP processes:
- ps aux | grep snmp
-> No active SNMP process found after adding agentAddress.
2. Tried restarting SNMPD:
- sudo /etc/init.d/snmpd restart
--> Restarting network management services
3. Checked system logs:
- sudo tail -f /var/log/syslog | grep snmp
--> No errors or relevant logs found.
4. Checked if port 161 is occupied:
- sudo netstat -tulnp | grep 161
--> No Output
5. Commented the agentAddress line and restarted:
- \# agentAddress udp:192.168.X.Y:161
- sudo /etc/init.d/snmpd restart
--> SNMPD works again when agetAddress is removed but on localhost
--------------------------------------------------------------
1. Questions for the Community
2. Is there a known issue with agentAddress binding in Metasploitable 2 (Ubuntu 8.04)?
3. Is there a different way to bind SNMPD to a specific IP without breaking the service?
4. How can I debug why SNMPD silently fails with no error logs?
Any help would be appreciated! Thanks in advance. 😊
Akhilesh Prajapati
(1 rep)
Feb 25, 2025, 10:08 AM
• Last activity: Feb 25, 2025, 10:38 AM
1
votes
1
answers
84
views
Linux server VLAN tags using SNMP
I have a number of Linux servers than I need to monitor. Each have configured a number of VLAN interfaces. Is there any way to read VLAN tags for interfaces for a Linux server using SNMP? Anything I need to install? Which MIB applies? I have been unable to find any info on this online.
I have a number of Linux servers than I need to monitor. Each have configured a number of VLAN interfaces. Is there any way to read VLAN tags for interfaces for a Linux server using SNMP? Anything I need to install? Which MIB applies?
I have been unable to find any info on this online.
Astronaut
(11 rep)
Jan 28, 2025, 12:41 PM
• Last activity: Jan 30, 2025, 07:30 AM
0
votes
1
answers
125
views
SNMP doesn't seem to register pass-through configuration directive
SNMP doesn't seem to register pass-through configuration directive, here is my configuration file: **snmpd.conf** ########################################################################### # # snmpd.conf An example configuration file for configuring the Net-SNMP agent ('snmpd') See snmpd.conf(5) ma...
SNMP doesn't seem to register pass-through configuration directive, here is my configuration file:
**snmpd.conf**
###########################################################################
#
# snmpd.conf An example configuration file for configuring the Net-SNMP agent ('snmpd') See snmpd.conf(5) man
# page for details
#
###########################################################################
# SECTION: System Information Setup
#
# syslocation: The [typically physical] location of the system.
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysLocation.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: location_string
sysLocation Sitting on the Dock of the Bay
sysContact Me
# sysservices: The proper value for the sysServices object.
# arguments: sysservices_number
sysServices 72
###########################################################################
# SECTION: Agent Operating Mode
#
# This section defines how the agent will operate when it
# is running.
# master: Should the agent operate as a master agent or not.
# Currently, the only supported master agent type for this token
# is "agentx".
#
# arguments: (on|yes|agentx|all|off|no)
master agentx
# agentaddress: The IP address and port number that the agent will listen on.
# By default the agent listens to any and all traffic from any
# interface on the default SNMP port (161). This allows you to
# specify which address, interface, transport type and port(s) that you
# want the agent to listen on. Multiple definitions of this token
# are concatenated together (using ':'s).
# arguments: [transport:]port[@interface/address],...
agentaddress 161
###########################################################################
# SECTION: Access Control Setup
#
# This section defines who is allowed to talk to your running
# snmp agent.
# Views
# arguments viewname included [oid]
# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1
# rocommunity: a SNMPv1/SNMPv2c read-only access community name
# arguments: community [default|hostname|network/bits] [oid | -V view]
# Read-only access to everyone to the systemonly view
rocommunity public
#rocommunity public default -V systemonly
#rocommunity6 public default -V systemonly
#rocommunity public localhost
#view all included .1.3.6.1.4.1
#extend .1.3.6.1.4.1.9999.1 checkcommand /bin/sh /home/pi/snmp/snmp-cpu-temp
# SNMPv3 doesn't use communities, but users with (optionally) an
# authentication and encryption string. This user needs to be created
# with what they can view with rouser/rwuser lines in this file.
#
# createUser username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES] [privpassphrase]
# e.g.
# createuser authPrivUser SHA-512 myauthphrase AES myprivphrase
#
# This should be put into /var/lib/snmp/snmpd.conf
#
# rouser: a SNMPv3 read-only access username
# arguments: username [noauth|auth|priv [OID | -V VIEW [CONTEXT]]]
#rouser authPrivUser authpriv -V systemonly
#rouser authOnlyUser
#
# Process Monitoring
#
# At least one 'mountd' process
proc mountd
# No more than 4 'ntalkd' processes - 0 is OK
proc ntalkd 4
# At least one 'sendmail' process, but no more than 10
proc sendmail 10 1
# Walk the UCD-SNMP-MIB::prTable to see the resulting output
# Note that this table will be empty if there are no "proc" entries in the snmpd.conf file
#
# Disk Monitoring
#
# 10MBs required on root disk, 5% free on /var, 10% free on all other disks
disk / 10000
disk /var 5%
includeAllDisks 10%
# Walk the UCD-SNMP-MIB::dskTable to see the resulting output
# Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
#
# System Load
#
# Unacceptable 1-, 5-, and 15-minute load averages
load 12 10 5
# Walk the UCD-SNMP-MIB::laTable to see the resulting output
# Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
###############################################################################
#
# ACTIVE MONITORING
#
# send SNMPv1 traps
trapsink localhost public
# send SNMPv2c traps
#trap2sink localhost public
# send SNMPv2c INFORMs
#informsink localhost public
# Note that you typically only want *one* of these three lines
# Uncommenting two (or all three) will result in multiple copies of each notification.
#
# Event MIB - automatically generate alerts
#
# Remember to activate the 'createUser' lines above
iquerySecName internalUser
rouser internalUser
# generate traps on UCD error conditions
#defaultMonitors yes
# generate traps on linkUp/Down
linkUpDownNotifications yes
###############################################################################
#
# EXTENDING THE AGENT
#
#
# Arbitrary extension commands
#
extend test1 /bin/echo Hello, world!
extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
pass .1.3.6.1.2.1.25.1.8 /bin/sh /home/pi/snmp/snmp-cpu-temp
# include a all *.conf files in a directory
includeDir /etc/snmp/snmpd.conf.d
/etc/snmp/snmpd.conf.d
is empty, I've restarted the snmpd service.
$ snmpget -v 2c localhost -c public .1.3.6.1.2.1.25.1.8
iso.3.6.1.2.1.25.1.8 = No Such Instance currently exists at this OID
$ sh /home/pi/snmp/snmp-cpu-temp -g .1.3.6.1.2.1.25.1.8
.1.3.6.1.2.1.25.1.8
gauge
62322
Dinamo
(3 rep)
Oct 24, 2024, 04:28 PM
• Last activity: Oct 25, 2024, 04:26 AM
2
votes
1
answers
1169
views
Where can I find net-snmp MIB's included on linux
I'm running AlmaLinux 9 (a RedHat 9 clone), and have net-snmp installed. I thought this would automatically include a generic linux MIB. But it doesn't and the information online says I should use my package manager (DNF) to download one. But I can't find one! Should a MIB have been installed by the...
I'm running AlmaLinux 9 (a RedHat 9 clone), and have net-snmp installed. I thought this would automatically include a generic linux MIB. But it doesn't and the information online says I should use my package manager (DNF) to download one.
But I can't find one! Should a MIB have been installed by the package manager when I installed net-snmp? If not, where can I download a generic Linux MIB? The only available packages that relate are shown below:
dnf list | grep net-snmp
net-snmp.x86_64 1:5.9.1-13.el9_4.3 appstream
net-snmp-agent-libs.i686 1:5.9.1-13.el9_4.3 appstream
net-snmp-agent-libs.x86_64 1:5.9.1-13.el9_4.3 appstream
net-snmp-devel.i686 1:5.9.1-13.el9_4.3 appstream
net-snmp-devel.x86_64 1:5.9.1-13.el9_4.3 appstream
net-snmp-libs.i686 1:5.9.1-13.el9_4.3 appstream
net-snmp-libs.x86_64 1:5.9.1-13.el9_4.3 appstream
net-snmp-perl.x86_64 1:5.9.1-13.el9_4.3 appstream
net-snmp-utils.x86_64 1:5.9.1-13.el9_4.3 appstream
python3-net-snmp.x86_64 1:5.9.1-13.el9_4.3 appstream
TSG
(1983 rep)
Oct 9, 2024, 03:43 PM
• Last activity: Oct 9, 2024, 06:03 PM
-1
votes
1
answers
2693
views
Python and snmpset with netsnmp
On the linux command line, centos 7, I can to do this to change an snmp setting on a device. snmpset -v 2c -c private 172.16.1.2 .1.3.6.1.2.1.1.5.0 s new_name With python and netsnmp I can read the values I just cannot seem to change them. import netsnmp line = "172.16.1.2" snmp_string = "private" o...
On the linux command line, centos 7, I can to do this to change an snmp setting on a device.
snmpset -v 2c -c private 172.16.1.2 .1.3.6.1.2.1.1.5.0 s new_name
With python and netsnmp I can read the values I just cannot seem to change them.
import netsnmp
line = "172.16.1.2"
snmp_string = "private"
oid = netsnmp.Varbind('.1.3.6.1.2.1.1.5.0')
result = netsnmp.snmpget(oid, Version = 2, DestHost=line, Community=snmp_string)
print result
The above works fine to read the value can anyone tell me how to write to the value with python preferably using netsnmp?
Matt
(49 rep)
Apr 2, 2017, 07:49 PM
• Last activity: Aug 9, 2024, 12:01 AM
9
votes
3
answers
50165
views
How to let the Firewall of RHEL7 the SNMP connection passing?
How to let the Firewall of RHEL7 the SNMP connection passing? When I did this command on the computer: systemctl stop firewalld All the SNMP packet are passing well. When I restarted firewalld all the packet arre blocked. I tried several connfigruation with the firewall running of course, like: ipta...
How to let the Firewall of RHEL7 the SNMP connection passing?
When I did this command on the computer:
systemctl stop firewalld
All the SNMP packet are passing well. When I restarted firewalld all the packet arre blocked.
I tried several connfigruation with the firewall running of course, like:
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 161 -j ACCEPT
or
firewall-cmd --zone=public --add-port=161/tcp --permanent
I've not get any error message but the SNMP still in TIMEOUT.
dubis
(1480 rep)
Jul 7, 2015, 01:55 PM
• Last activity: Mar 28, 2024, 12:57 PM
2
votes
1
answers
523
views
How to restore configurations files ? (SNMP)
I wanted to know what should I do to restore the configuration files if I've modified or accidentally deleted a file. In my case, I'm talking about `/etc/snmp/snmpd.conf`, what command should I use to reinstall it?
I wanted to know what should I do to restore the configuration files if I've modified or accidentally deleted a file.
In my case, I'm talking about
/etc/snmp/snmpd.conf
, what command should I use to reinstall it?
Kuroro
(23 rep)
Jan 18, 2023, 04:37 AM
• Last activity: Mar 28, 2024, 09:44 AM
0
votes
1
answers
306
views
How to run snmpwalk using linux script
Basically i am new in the field of shell scripting and i want to run snmpwalk using linux script **here is the script i have created:** echo "Starting SnmpWalk" var = `snmpwalk -v2c CS IP 1.3.6.1.4.1.1563.10.1.4.2.1.1.1.1.7` echo {var} **(I have entered the community String and Ip Correct.)** but i...
Basically i am new in the field of shell scripting and i want to run snmpwalk using linux script
**here is the script i have created:**
echo "Starting SnmpWalk"
var =
snmpwalk -v2c CS IP 1.3.6.1.4.1.1563.10.1.4.2.1.1.1.1.7
echo {var}
**(I have entered the community String and Ip Correct.)**
but i am getting a error as :
Starting SnmpWalk
No community name specified.
USAGE: snmpwalk [OPTIONS] AGENT [OID]
Version: 5.9.1
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net
Anubhav Kumar Panda
(1 rep)
Feb 16, 2024, 06:15 AM
• Last activity: Feb 16, 2024, 09:54 AM
1
votes
0
answers
127
views
snmp issue:Two similar servers returning different output
I am having issue with SNMP OID's . I have two similar servers (hardware and software) Which is Dell server with RHEL 5.3 X86_64. The issue is when I run the `SNMPWALK` for one server it shows proper data while the other server returns > No Such Instance currently exists at this OID Both have net-sn...
I am having issue with SNMP OID's .
I have two similar servers (hardware and software) Which is Dell server with RHEL 5.3 X86_64. The issue is when I run the
SNMPWALK
for one server it shows proper data while the other server returns
> No Such Instance currently exists at this OID
Both have net-snmp version as: 5.3.2.2
OID seems to be custom and only for Dell machines "1.3.6.1.4.1.674
" (SNMPv2-SMI::enterprises.674
), but both machines are Dell based and follow the same architecture and components.
Can someone trace on cause of this issue?
Kratos
(381 rep)
Feb 11, 2013, 06:57 PM
• Last activity: Jan 30, 2024, 11:25 PM
0
votes
3
answers
2761
views
parse snmpwalk output to array
Im trying to get network interfaces by doing a snmpwalk, but cannot separate in array, the variable stores all in element 0 ifname=(\$(snmpwalk -Oqv -v2c -c comm xxx.xxx.xxx.xxx 1.3.6.1.2.1.2.2.1.2)) This is inside a heredoc How can i do that?
Im trying to get network interfaces by doing a snmpwalk, but cannot separate in array, the variable stores all in element 0
ifname=(\$(snmpwalk -Oqv -v2c -c comm xxx.xxx.xxx.xxx 1.3.6.1.2.1.2.2.1.2))
This is inside a heredoc
How can i do that?
postrocker
(1 rep)
Jul 4, 2016, 06:53 PM
• Last activity: Jan 18, 2024, 08:00 AM
1
votes
1
answers
98
views
Nagios/SNMP - devices alerting when ppp/tun connections cycle
Sorry if this is a repeat. I searched, but with no luck. I'm using SNMPd on an openwrt/wr host with some ppp and tun connections. These connections get IDs in the if table, and will actually get a new ID whenever the tunnels reconnect. Nagios (check_mk), when that happens, complains that an interfac...
Sorry if this is a repeat. I searched, but with no luck.
I'm using SNMPd on an openwrt/wr host with some ppp and tun connections. These connections get IDs in the if table, and will actually get a new ID whenever the tunnels reconnect.
Nagios (check_mk), when that happens, complains that an interface went down; oh, and a different one with the same name came up right afterward. In the meantime, it's iterating over so many interfaces that the reports are of 'interface 4933 down'; and an snmpwalk shows close to 4932 datapoints before it.
How are the helpful folks here handling a monitoring situation like that?
user2066657
(629 rep)
Dec 14, 2016, 05:57 PM
• Last activity: Sep 13, 2023, 02:40 PM
0
votes
1
answers
410
views
Why does snmpwalk show only numerical OIDs in some situations?
I have several Debian 11 systems from which I query network appliances over SNMP - these are the snmp packages: ``` # dpkg -l | grep -i snmp ii libsnmp-base 5.9+dfsg-4+deb11u1 all SNMP configuration script, MIBs and documentation ii libsnmp40:amd64 5.9+dfsg-4+deb11u1 amd64 SNMP (Simple Network Manag...
I have several Debian 11 systems from which I query network appliances over SNMP - these are the snmp packages:
# dpkg -l | grep -i snmp
ii libsnmp-base 5.9+dfsg-4+deb11u1 all SNMP configuration script, MIBs and documentation
ii libsnmp40:amd64 5.9+dfsg-4+deb11u1 amd64 SNMP (Simple Network Management Protocol) library
ii python3-pysmi 0.3.2-2 all SNMP SMI/MIB Parser
ii python3-pysnmp4 4.4.12-1 all Python SNMP library for agents and managers (Python 3 module)
ii python3-snimpy 0.8.13-2+b2 amd64 high-level SNMP bindings for Python 3
ii snimpy 0.8.13-2 all interactive SNMP tool with Python
ii snmp 5.9+dfsg-4+deb11u1 amd64 SNMP (Simple Network Management Protocol) applications
ii snmp-mibs-downloader 1.5 all install and manage Management Information Base (MIB) files
ii snmpsim 0.4.5-1 all SNMP agent simulator
If I run this, I get the OIDs translated:
root@vogon:~# snmpwalk -v 2c -c netgear netgear1 SNMPv2-MIB::sysORID
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-SMI::mib-2.96
SNMPv2-MIB::sysORID.2 = OID: SNMPv2-SMI::mib-2.32.2
SNMPv2-MIB::sysORID.3 = OID: SNMPv2-SMI::mib-2.32.1
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-SMI::mib-2.16.29
SNMPv2-MIB::sysORID.5 = OID: SNMPv2-SMI::mib-2.16.20.5
SNMPv2-MIB::sysORID.6 = OID: SNMPv2-SMI::mib-2.78
SNMPv2-MIB::sysORID.7 = OID: SNMPv2-SMI::mib-2.72
SNMPv2-MIB::sysORID.8 = OID: SNMPv2-SMI::mib-2.154
SNMPv2-MIB::sysORID.9 = OID: SNMPv2-SMI::mib-2.30
SNMPv2-MIB::sysORID.10 = OID: SNMPv2-SMI::mib-2.76
SNMPv2-MIB::sysORID.11 = OID: iso.2.840.10006.300.43
SNMPv2-MIB::sysORID.12 = OID: iso.0.8802.1.1.2.1.5.4623
SNMPv2-MIB::sysORID.13 = OID: iso.0.8802.1.1.2.1.5.4795
SNMPv2-MIB::sysORID.14 = OID: iso.0.8802.1.1.2
SNMPv2-MIB::sysORID.15 = OID: SNMPv2-SMI::mib-2.26.6
SNMPv2-MIB::sysORID.16 = OID: SNMPv2-SMI::enterprises.4526.11.61
SNMPv2-MIB::sysORID.17 = OID: SNMPv2-SMI::enterprises.4526.11.43
SNMPv2-MIB::sysORID.18 = OID: SNMPv2-SMI::enterprises.4526.11.31
SNMPv2-MIB::sysORID.19 = OID: SNMPv2-SMI::enterprises.4526.11.100
SNMPv2-MIB::sysORID.20 = OID: SNMPv2-SMI::enterprises.4526.11.37
But if I do this, I don't:
root@vogon:~# snmpwalk -Os -v 2c -c netgear netgear1
iso.3.6.1.2.1.1.1.0 = STRING: "GS324T S350 Series 24-Port Gigabit Ethernet Smart Managed Pro Switch with 2 SFP Ports"
iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.4526.100.4.54
iso.3.6.1.2.1.1.3.0 = Timeticks: (1256215400) 145 days, 9:29:14.00
iso.3.6.1.2.1.1.4.0 = ""
iso.3.6.1.2.1.1.5.0 = STRING: "NEATGEAR1"
iso.3.6.1.2.1.1.6.0 = STRING: "Network rack"
iso.3.6.1.2.1.1.7.0 = INTEGER: 2
iso.3.6.1.2.1.1.8.0 = Timeticks: (1900) 0:00:19.00
iso.3.6.1.2.1.1.9.1.2.1 = OID: iso.3.6.1.2.1.96
iso.3.6.1.2.1.1.9.1.2.2 = OID: iso.3.6.1.2.1.32.2
iso.3.6.1.2.1.1.9.1.2.3 = OID: iso.3.6.1.2.1.32.1
...
What makes the difference?
j4nd3r53n
(779 rep)
Aug 22, 2023, 09:04 AM
• Last activity: Aug 22, 2023, 11:27 AM
2
votes
1
answers
1130
views
Get all writable OIDs from snmpwalk
It's easy to do a `snmpwalk` to get a list of all the valid OIDs for a system. How can I tell which of those OIDs are read only, and which are writeable? $ snmpwalk -v1 -c testing 256.256.256.256 SNMPv2-MIB::sysDescr.0 = STRING: Testing Device DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (116040...
It's easy to do a
snmpwalk
to get a list of all the valid OIDs for a system. How can I tell which of those OIDs are read only, and which are writeable?
$ snmpwalk -v1 -c testing 256.256.256.256
SNMPv2-MIB::sysDescr.0 = STRING: Testing Device
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (1160403) 3:13:24.03
...
Questionmark
(4095 rep)
Feb 14, 2019, 08:46 PM
• Last activity: Jul 5, 2023, 11:02 AM
0
votes
1
answers
44
views
SNMP forwarder to reduce load of switch
I have a core switch and running SNMPv3 on this. I need to reduce load of my switch. So if I have a SNMP Forwarder and do snmp on my core switch and other server snmp on my SNMP Forwarder, Do you know same application? I found https://github.com/inexio/snmpfwd But may be it's discontinue.
I have a core switch and running SNMPv3 on this.
I need to reduce load of my switch. So if I have a SNMP Forwarder and do snmp on my core switch and other server snmp on my SNMP Forwarder, Do you know same application? I found https://github.com/inexio/snmpfwd But may be it's discontinue.
I need to reduce load of my switch. So if I have a SNMP Forwarder and do snmp on my core switch and other server snmp on my SNMP Forwarder, Do you know same application? I found https://github.com/inexio/snmpfwd But may be it's discontinue.
PersianGulf
(11308 rep)
May 1, 2023, 02:40 PM
• Last activity: May 2, 2023, 04:26 AM
Showing page 1 of 20 total questions