LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-16-2011, 11:58 AM   #1
creatureofthedark
Member
 
Registered: Jan 2007
Distribution: LFS / Ubuntu / CentOs
Posts: 56

Rep: Reputation: 15
Question problem with snmp and centos 6


hi I'm a 3rd year computing student and I'm currently working on my 3rd year project.

at the moment I'm stuck with what I thought would be a fairly simple task... setting up SNMP...

so far iv managed to get snmpd running on a web-server and snmptrapd working on the monitoring server. [both are running centos 6 and for testing iv took down iptables]


on the server i have the following config.

Code:
/etc/snmp/snmptrapd.conf

# Example configuration file for snmptrapd
#
# No traps are handled by default, you must edit this file!
#
authCommunity   log,execute,net public
traphandle default python /root/project/snmptest.py
# traphandle SNMPv2-MIB::coldStart    /usr/bin/bin/my_great_script cold
the above calls a python script when ever it receives an snmp trap. this python script then simply dumps the trap into a text file [this will be expanded upon when I get the web-server sending traps...

Code:
ef main():
        running = True
        output = open('/tmp/traps', 'a')

        while running:
                try:
                        input = raw_input()
                        output.write(input + "\n")
                except EOFError:
                        running = False


        output.close()

if __name__ == '__main__':
        main()
this system has been tested and works well. it receives traps from my pfsence router fine...

please note that the above i got from this video http://www.youtube.com/watch?v=S0ibDVFnUws


on the webserver i have simply set

Code:
/etc/snmp/snmpd.conf

rocommunity  public
syslocation  "north"
syscontact  [my-email]
this config came from this link...
http://www.it-slav.net/blogs/2008/11...hel-or-centos/


this allows me use snmpwalk and I get all the oids... but it doesn't send any traps..

I have been googleing how to get the server to send traps when say httpd stops but I can't seem to get an answer..

my current approach i sifting threw the default config to see if i can make out what needs to be done..

dose anyone happen to know of any website or book that would help me out here? or dose anyone have any suggested config that would work?

thank you in advanced
 
Old 11-16-2011, 12:41 PM   #2
creatureofthedark
Member
 
Registered: Jan 2007
Distribution: LFS / Ubuntu / CentOs
Posts: 56

Original Poster
Rep: Reputation: 15
Cool

ah ha!!!! iv found my answer!!! well sort-of..... more testing to be done to be shore...

in this link
http://www.schemathings.com/?p=11
i saw the command
Code:
snmpconf -g basic_setup
its a little odd and i only 1/2 understand what its asking... but it just sent a trap telling me the httpd was down [at-least I think that's what its told me.....] :P

Code:
UDP: [192.168.2.41]:44387->[192.168.2.51]
DISMAN-EVENT-MIB::sysUpTimeInstance 0:0:00:00.08
SNMPv2-MIB::snmpTrapOID.0 SNMPv2-MIB::coldStart
SNMPv2-MIB::snmpTrapEnterprise.0 NET-SNMP-MIB::netSnmpAgentOIDs.10
fresh.north.project
UDP: [192.168.2.41]:44387->[192.168.2.51]
DISMAN-EVENT-MIB::sysUpTimeInstance 0:0:00:00.08
SNMPv2-MIB::snmpTrapOID.0 SNMPv2-MIB::coldStart
SNMPv2-MIB::snmpTrapEnterprise.0 NET-SNMP-MIB::netSnmpAgentOIDs.10
here is the config the command generated..

Code:
###########################################################################
#
# snmpd.conf
#
#   - created by the snmpconf configuration program
#
###########################################################################
# SECTION: Monitor Various Aspects of the Running Host
#
#   The following check up on various aspects of a host.

# proc: Check for processes that should be running.
#     proc NAME [MAX=0] [MIN=0]
#
#     NAME:  the name of the process to check for.  It must match
#            exactly (ie, http will not find httpd processes).
#     MAX:   the maximum number allowed to be running.  Defaults to 0.
#     MIN:   the minimum number to be running.  Defaults to 0.
#
#   The results are reported in the prTable section of the UCD-SNMP-MIB tree
#   Special Case:  When the min and max numbers are both 0, it assumes
#   you want a max of infinity and a min of 1.

proc  httpd 1 1

# disk: Check for disk space usage of a partition.
#   The agent can check the amount of available disk space, and make
#   sure it is above a set limit.
#
#    disk PATH [MIN=100000]
#
#    PATH:  mount path to the disk in question.
#    MIN:   Disks with space below this value will have the Mib's errorFlag set.
#           Can be a raw integer value (units of kB) or a percentage followed by the %
#           symbol.  Default value = 100000.
#
#   The results are reported in the dskTable section of the UCD-SNMP-MIB tree

disk  / 10%

# load: Check for unreasonable load average values.
#   Watch the load average levels on the machine.
#
#    load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]
#
#    1MAX:   If the 1 minute load average is above this limit at query
#            time, the errorFlag will be set.
#    5MAX:   Similar, but for 5 min average.
#    15MAX:  Similar, but for 15 min average.
#
#   The results are reported in the laTable section of the UCD-SNMP-MIB tree

load  4 3 3



###########################################################################
# SECTION: Access Control Setup
#
#   This section defines who is allowed to talk to your running
#   snmp agent.

# rwcommunity: a SNMPv1/SNMPv2c read-write access community name
#   arguments:  community [default|hostname|network/bits] [oid]

rwcommunity  public mon.man.project



###########################################################################
# SECTION: Trap Destinations
#
#   Here we define who the agent will send traps to.

# trap2sink: A SNMPv2c trap receiver
#   arguments: host [community] [portnum]

trap2sink  mon.man.project public






###########################################################################
# SECTION: System Information Setup
#
#   This section defines some of the information reported in
#   the "system" mib group in the mibII tree.

# 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  north

# syscontact: The contact information for the administrator
#   Note that setting this value here means that when trying to
#   perform an snmp SET operation to the sysContact.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:  contact_string

syscontact  david@the-ward-network.com

# sysservices: The proper value for the sysServices object.
#   arguments:  sysservices_number

sysservices 12
sysservices 0*1 + 0*2 + 1*4 + 1*8 + 1*64



###########################################################################
# 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  yes
 
Old 11-16-2011, 12:50 PM   #3
creatureofthedark
Member
 
Registered: Jan 2007
Distribution: LFS / Ubuntu / CentOs
Posts: 56

Original Poster
Rep: Reputation: 15
-_- it appears in my surprise that something actually came threw I got a little over excited...

the above dose not show that httpd is down.... [pass on what it dose say other then cold start o_O]

iv tested this by bringing httpd up and down but not more traps are being sent..

any suggestions?
 
  


Reply

Tags
centos, snmpd



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] SNMP Centos albye Linux - Newbie 1 05-19-2011 08:35 AM
[SOLVED] Centos net-snmp rpm problem Wim Sturkenboom Red Hat 2 04-13-2010 01:57 AM
Assistance with SNMP on Redhat/CentOS stuaz Linux - Newbie 2 12-11-2008 09:46 AM
[CentOS] SNMP working on localhost, failing remotely Colosus Linux - Networking 3 03-24-2007 12:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration