nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Python SNMP library ( networking framework )

This is a discussion on Python SNMP library ( networking framework ) within the Coding in General forums, part of the Development/Scripting category; Hi all, i'am using python with snmp to develop an interface with Pygtk, the problem is that i don't know ...


Go Back   nixCraft Linux Forum > Development/Scripting > Coding in General

Linux answers from nixCraft.


Coding in General Discussion on PHP/Perl/Python/Ruby/GNU C or C++. MySQL, PgSQL and (X)HTML or any other programming languages you want.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 13-05-2009, 05:09 PM
Junior Member
User
 
Join Date: May 2009
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
learnmore is on a distinguished road
Post Python SNMP library ( networking framework )

Hi all,

i'am using python with snmp to develop an interface with Pygtk,
the problem is that i don't know how to use python to use snmp commands and which library use for this aim.

i have installed net-snmp.

is there documentation about how to use python with snmp...

Thank you.
Reply With Quote
  #2 (permalink)  
Old 13-05-2009, 06:46 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

You need the following under Debian Linux:
  1. libsnmp-python SNMP (Simple Network Management Protocol) Python support
  2. python-pysnmp2 Python SNMP library for agents and managers
  3. python-pysnmp-common Python SNMP library for agents and managers
Use apt-get to install them.
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 13-05-2009, 07:53 PM
Junior Member
User
 
Join Date: May 2009
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
learnmore is on a distinguished road
Default

i'am using fedora 8 and i can't find these packages, and how can i use them to interact with the equipement.
is there documentation that could help me...
Reply With Quote
  #4 (permalink)  
Old 13-05-2009, 08:19 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Use yum command to install packages. Here are examples and documents:

Python SNMP framework
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #5 (permalink)  
Old 13-05-2009, 09:54 PM
Junior Member
User
 
Join Date: May 2009
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
learnmore is on a distinguished road
Default

is there only this solution to develop an application with python using snmp ?
i'am searching about a simple library to use snmpget, snmpset ...Etc.

Because with pysnmp i find it difficult to do this and you must type a long code juste to run snmpget...

thank you.
Reply With Quote
  #6 (permalink)  
Old 13-05-2009, 11:59 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

It is API thingy, so end up writing a bit more. I'm not sure what you are trying to developer here, but you can just run commands using os.system() or os.popen(). For e.g.
Code:
#!/usr/bin/python
import os
os.system('ls');
os.system('date');
You can replace ls / date with snmpget.
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #7 (permalink)  
Old 14-05-2009, 04:14 AM
Junior Member
User
 
Join Date: May 2009
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
learnmore is on a distinguished road
Default

thank you this is what i'am searching.
Actually, i'am developping an interface using pygtk to control an équipement, then i must store the results given by snmp in a data base.
Do you think that using os is the most appropriate solution and how can i interprete the responses to get something clear on the interface.
Reply With Quote
  #8 (permalink)  
Old 14-05-2009, 01:53 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Use API, if you need to read data and store it to database. os.system() is more suitable; if you just want last shell command exit status but it is not good for processing the data.
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help

Last edited by nixcraft; 14-05-2009 at 04:53 PM.
Reply With Quote
  #9 (permalink)  
Old 14-05-2009, 05:47 PM
Junior Member
User
 
Join Date: May 2009
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
learnmore is on a distinguished road
Default

Thank you....................

Last edited by learnmore; 02-06-2009 at 08:49 AM.
Reply With Quote
  #10 (permalink)  
Old 02-06-2009, 08:48 AM
Junior Member
User
 
Join Date: May 2009
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
learnmore is on a distinguished road
Default

can you tell me wich API is more suitable to read data and store them using SNMP ?

Thank you.
Reply With Quote
Reply

Tags
python , snpm


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
gd library aammiitt CentOS / RHEL / Fedora 3 28-12-2008 08:00 PM
Library wanted dnquynh CentOS / RHEL / Fedora 1 07-07-2008 03:27 PM
static library,dynamic narmadakumari Linux software 0 17-06-2008 12:16 PM
Python with SNMP Supportq rcordeiro Shell scripting 2 16-12-2006 10:48 PM
Library Linking in GCC newbie-wan Coding in General 1 18-10-2006 02:28 AM


All times are GMT +5.5. The time now is 04:36 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38