Overview
We will also go over different SNMPD startup options as per the business / IT Operations requirements.
We will also get to know as to how we can configure logging levels based on the "Logging Facility" and when to utilize it.
Applies To
- Ubuntu
- RHEL 6.5
- RHEL 7
Pre-Requisites
- Net-SNMP packages are installed on the server.
SNMP Daemon – Configuration File – Startup Options
Listed below is the configuration file “snmpd.conf” location on different operating systems.Operating System | File Location |
---|---|
Ubuntu | /etc/default/snmpd |
RHEL / CentOS | /etc/sysconfig/snmpd |
SNMP Daemon – Configuration File – View
Once you configure the snmp daemon startup options you can also validate / view configuration by running the below command;On Ubuntu – run the command;
lsb_release -d
cat /etc/default/snmpd | grep SNMPDOPTS
On RHEL / CentOS – run the command;
cat /etc/redhat-release
cat /etc/sysconfig/snmpd | grep OPTIONS
SNMP Daemon – Configuration File – Reconfiguration
In case the default / custom configuration file is missing or corrupted, you can recreate a new snmp.conf configuration file; to reconfigure / re-create run the command below;snmpconf
With this command you can also reconfigure / create new configuration file(s); When you run the command, it will read the current configuration file;
- /etc/snmp/snmp.conf
- /etc/snmp/snmpd.conf
- /etc/snmp/snmptrapd.conf
- overwrite
- rename
- append
- skip
SNMP Daemon – Startup Options
By default, SNMP daemon is started with the configuration file “/etc/default/snmpd”, “/etc/sysconfig/snmp” in Ubuntu, RHEL OS respectively with startup options as below;# RHEL OS
cat /etc/sysconfig/snmp
# OPTIONS="-LS0-6d"
# Ubuntu OS
cat /etc/default/snmpd
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -g root 0.0.0.0'
Startup Options Purpose
SNMP daemon startup attribute(s) purpose are shown below table.Options | Purpose |
---|---|
L | Logging |
S | Syslog |
D | Daemon |
-Ls | Log messages via syslog |
-Lf | Log messages to the specified file |
U | User |
I | Initialize |
smux | SNMP Multiplexing Protocol (disabled by default) |
P | Process ID |
G | Group ID |
Syslog Daemon Options
Syslog daemon startup can be configured with different options, few of them are listed in the below table;Logging Options | Purpose |
---|---|
-Lsd | Log Syslog Daemon (default) |
-Lsd | Log Syslog Warning Message |
-LSwd or -Ls4d | Log Syslog Error Message |
-Lf /dev/null | Redirect to Null file |
Logging Facility Table
Table below gives logging facility that can be configured.Numeric Value | Character Value | Log Type | Logging Scenario / Purpose |
---|---|---|---|
0 | ! | LOG_EMERG | Emergencies – System is unusable |
1 | a | LOG_ALERT | Alerts – Immediate action needed |
2 | b | LOG_CRIT | Critical – Critical conditions |
3 | c | LOG_ERR | Error – Error conditions |
4 | e | LOG_WARNING | Warnings – Warning conditions |
5 | n | LOG_NOTICE | Notifications – Informational messages |
6 | i | LOG_INFO | Informational – Normal but significant conditions |
7 | d | LOG_DEBUG | Debug – Debugging messages |
SNMP Daemon Management
To manage snmpd daemon, run the command based on the SysVinit or Service Manager enabled on the server(s);SysVinit Enabled OS | Systemd Enabled OS |
---|---|
service snmpd start | systemctl start snmpd |
service snmpd stop | systemctl stop snmpd |
service snmpd restart | systemctl restart snmpd |
service snmpd status | systemctl status snmpd |
Managing SNMPD Daemon
SNMP Daemon – Start
To start snmpd daemon, run the command;systemctl start snmpd
SNMP Daemon – Stop
To stop snmpd daemon, run the command;systemctl stop snmpd
SNMP Daemon – Restart
To restart snmpd daemon, run the command;systemctl restart snmpd
SNMP Daemon – Status
To know the stuats of snmpd daemon, run the command;systemctl status snmpd
Awesome. Thank you.
ReplyDelete