I have a snmpd.conf file as below. in "SECTION: Trap Destinations" line I want to add "trap2dest <IP>:162 <com_str>" on a new line. For this I wrote following code
The code runs but the newly added line eats the line which is below in conf file
snmpd.conf before executing above code
Quote:
############################################################################
# SECTION: Trap Destinations
#
# Here we define who the agent will send traps to.
#
# trap2sink: A SNMPv2c trap receiver
# arguments: host [community] [portnum]
#
###########################################################################
The snmpd conf after executing ablve code
Quote:
############################################################################
# SECTION: Trap Destinations trap2sink 192.168.1.10:162 public^@ will send traps to.
#
# trap2sink: A SNMPv2c trap receiver
# arguments: host [community] [portnum]
#
###########################################################################
Please suggest me something so that I can fix this issue. Why the newly added line eats the line char that are next to it?
Hi,
I have a file which has data kind of like this.
Apr 13 08:20:38 uslis10a sendmail: m3DDKSx3006432: usliss26.ca.com
Apr 13 08:20:38 uslis10b sendmail: m3DDKSoK006433: usliss26.ca.com
Apr 13 08:20:38 uslis10b sendmail: m3DDKcSo006442: usliss26.ca.com
Apr 13 08:20:38 uslis10c... (2 Replies)
hi ,
I have a javascript file like this:
function fnValidateId(){
var array_id = new Array("444","7888","6633","555","146562","3333","33332")
var tmp_id = document.form1.id.value;
var num=0;
while(1)
{
if(tmp_id ==... (9 Replies)
I want to look into a folder to see if there are any folders within it. If there are, I need to check inside each folder to see if it contains a .pdf file
So
If /myserver/myfolder/
contains a folder AND that folder conatins a .pdf file
do X
Else
do Z
I may have multiple folders and... (4 Replies)
Hi,
i have created a simple .ksh file in the following manner
cat <<EOF >mfile
#!/bin/ksh
echo "hello world"
EOF
I have 2 questions
1. now i would like to add a second line after the first echo command
e.g. echo "this is line 2"
how can i do that ?
2. I would then like... (1 Reply)
Hi,
I want to convert a file that looks like this
>joe
XXXXXXXXXXXXXXXXXXX
>man
BBBBBBBBBBBBBBBBBBBBBSSSSSSSS
to something that looks like this (where the spacing is tab seperated)
joe XXXXXXXXXXXXXXXXXXX
man BBBBBBBBBBBBBBBBBBBBBSSSSSSSS
I am able to do the reverse but the other... (3 Replies)
Hello,
I have a large amount of data with the following structure:
Word=Transliterated word
I have written a Perl Script (reproduced below) which goes through the full file and identifies all dupes on the right hand side. It creates successfully a new file with two headers: Singletons and Dupes.... (5 Replies)
I have a text file containing some notes and I want to limit the lines to 75 characters.
Tried using fold, however fold will cut words.
Need something in bash, sed or awk to do this. Find the blank space less than 75 ant cut from there (10 Replies)
Hi Pros,
I'm writing a script to modify listener.ora file on multiple hosts. When I ssh to any server from a central server in our environment we are presented with menu to select the instance. I need to set my environment to listener which could be different number on every instance. How can I... (5 Replies)
Discussion started by: humble_learner
5 Replies
LEARN ABOUT MOJAVE
snmp_config
SNMP_CONFIG(5) Net-SNMP SNMP_CONFIG(5)NAME
snmp_config - handling of Net-SNMP configuration files
DESCRIPTION
The Net-SNMP package uses various configuration files to configure its applications. This manual page merely describes the overall nature
of them, so that the other manual pages don't have to.
DIRECTORIES SEARCHED
First off, there are numerous places that configuration files can be found and read from. By default, the applications look for configura-
tion files in the following 4 directories, in order: /etc/snmp, /usr/share/snmp, /usr/lib/snmp, and $HOME/.snmp. In each of these directo-
ries, it looks for files with the extension of both conf and local.conf (reading the second ones last). In this manner, there are 8
default places a configuration file can exist for any given configuration file type.
Additionally, the above default search path can be overridden by setting the environment variable SNMPCONFPATH to a colon-separated list of
directories to search for. The path for the persistent data should be included when running applications that use persistent storage, such
as snmpd.
Applications will read persistent configuration files in the following order of preference:
file in SNMP_PERSISTENT_FILE environment variable
directories in SNMPCONFPATH environment variable
directory defined by persistentDir snmp.conf variable
directory in SNMP_PERSISTENT_DIR environment variable
default /var/db/net-snmp directory
Finally, applications will write persistent configuration files in the following order of preference:
file in SNMP_PERSISTENT_FILE environment variable
directory defined by persistentDir snmp.conf variable
directory in SNMP_PERSISTENT_DIR environment variable
default /var/db/net-snmp directory
Note: When using SNMP_PERSISTENT_FILE, the filename should match the application name. For example, /var/net-snmp/snmpd.conf.
CONFIGURATION FILE TYPES
Each application may use multiple configuration files, which will configure various different aspects of the application. For instance,
the SNMP agent (snmpd) knows how to understand configuration directives in both the snmpd.conf and the snmp.conf files. In fact, most
applications understand how to read the contents of the snmp.conf files. Note, however, that configuration directives understood in one
file may not be understood in another file. For further information, read the associated manual page with each configuration file type.
Also, most of the applications support a -H switch on the command line that will list the configuration files it will look for and the
directives in each one that it understands.
The snmp.conf configuration file is intended to be a application suite wide configuration file that supports directives that are useful for
controlling the fundamental nature of all of the SNMP applications, such as how they all manipulate and parse the textual SNMP MIB files.
SWITCHING CONFIGURATION TYPES IN MID-FILE
It's possible to switch in mid-file the configuration type that the parser is supposed to be reading. Since that sentence doesn't make
much sense, lets give you an example: say that you wanted to turn on packet dumping output for the agent by default, but you didn't want to
do that for the rest of the applications (ie, snmpget, snmpwalk, ...). Normally to enable packet dumping in the configuration file you'd
need to put a line like:
dumpPacket true
into the snmp.conf file. But, this would turn it on for all of the applications. So, instead, you can put the same line in the snmpd.conf
file so that it only applies to the snmpd daemon. However, you need to tell the parser to expect this line. You do this by putting a spe-
cial type specification token inside a [] set. In other words, inside your snmpd.conf file you could put the above snmp.conf directive by
adding a line like so:
[snmp] dumpPacket true
This tells the parser to parse the above line as if it were inside a snmp.conf file instead of an snmpd.conf file. If you want to parse a
bunch of lines rather than just one then you can make the context switch apply to the remainder of the file or until the next context
switch directive by putting the special token on a line by itself:
# make this file handle snmp.conf tokens:
[snmp]
dumpPacket true
logTimestamp true
# return to our original snmpd.conf tokens:
[snmpd]
rocommunity mypublic
COMMENTS
Any lines beginning with the character '#' in the configuration files are treated as a comment and are not parsed.
INCLUDING OTHER CONFIGURATION FILES
It is possible to include other configuration files for processing during normal configuration file processing.:
# include site specific config
include site.conf
This will search every directory in the configuration path for files
named site.conf, and will process those files before returning to the
processing of the original file. Note that if '.conf' is omitted,
it will be appended. That is, all configuration files must end
in '.conf'.
API INTERFACE
Information about writing C code that makes use of this system in either the agent's MIB modules or in applications can be found in the
netsnmp_config_api(3) manual page.
SEE ALSO snmpconf(1), netsnmp_config_api(3), snmp.conf(5), snmpd.conf(5)V5.6.2.1 08 Mar 2010 SNMP_CONFIG(5)