RE: Problème String into OID
Hello, I'm trying to re-build a new installation of net-snmp because we are changing our server. I have compil the package, with this : ./configure --prefix=/usr --with-mibdirs="/usr/share/snmp/mibs" --with-default-snmp-version="2" --with-defaults --with-mib-modules="adsp" make make install prefix=/usr Everything works fine, I don't have error I guess. But when I restart my snmpd services, there is no way to contact server by any community. I have seen that snmpd in /usr/bin change to the date of today, but I dunno whats wrong with it. I'm running it into Centos // net-snmp-5.6.2 Thanks for your help :). Cordialement, Jérôme BELLEGARDE Ingénieur Projets Réseaux ADS Picardie PAE du Haut Villé Rue Hippolyte Bayard 6 Beauvais Tél : 03 60 36 41 16 E-mail : j.bellega...@alpha-direct-services.com Site Web : www.alpha-d-s.net -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problème String into OID
I'm afraid i got a new problem. I can insert any string on my MIB with basic snmpset on my linux OS. I use the NetMgrVb dll to work with windows, so far no problem until now. After some test, it appear that I can't add a string superior to 8 char on m MIB, dunno why. When I debug log message, I found that problem appear : [NetMgrVB.Mod.SnmpAgentRequest][WAPI]=5 On http://msdn.microsoft.com/en-us/library/windows/desktop/aa378241(v=vs.85).aspx, I guess it's the : SNMPAPI_ENTITY_INVALID One or both of the entity parameters is invalid. SNMPAPI_CONTEXT_INVALID The context parameter is invalid. I dunno how to get it work then, can you help me out with that ? --- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : jeudi 2 août 2012 16:05 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problème String into OID On 2 August 2012 14:44, Jérôme BELLEGARDE wrote: > My question is now, how can I store a string into an OID Please see the code in 'agent/mibgroup/examples/watched.c' which does exactly this. Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problème String into OID
Strong :) One last thing, do you know the tool call "Getif" ? Do you know a better tool than it (to browse mib, walk ect ...) on windows 7? Also, I use getif to browse the MIB, and I cannot get the description I added on an OID (into my mib : DESCRIPTION "Test description") Cordialement, Jérôme BELLEGARDE Apprenti ingénieur en Informatique ADS Picardie PAE du Haut Villé Rue Hippolyte Bayard 6 Beauvais Tél : 03.60.36.40.21 E-mail : j.bellega...@alpha-direct-services.com Site Web : www.alpha-d-s.net --- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : jeudi 2 août 2012 17:18 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problème String into OID On 2 August 2012 16:03, Jérôme BELLEGARDE wrote: > ./configure --with-default-snmp-version="2" --with-sys-contact="@@no.where" > --with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log" > --with-persistent-directory="/var/net-snmp" > --with-mibs="SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:HOST-RESOURCES-TYPES:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-FRAMEWORK-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IP-FORWARD-MIB:NET-SNMP-PASS-MIB:NET-SNMP-EXTEND-MIB:UCD-DLMOD-MIB:SNMP-NOTIFICATION-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB:ADSP-MIB" > --with-mib-modules="adspFAFtp adspFASql adspFAConnexionFtp > adspFAFichierPresent adspFARecupFichier adspFAPresenceFacture adspBAYFtp > adspBAYSql adspBAYConnexionFtp adspBAYFichierPresent adspBAYRecupFichier > adspBAYPresenceFacture SupervisionTSEClient" > > By adding all the things, my MIB and my module from my mib > > Is there is a better solution to get this work :) ? Yes Dave Oh - you want to know what it is? :-) Create a file 'agent/mibgroup/adsp.h' containing the following: config_require( adspFAFtp ) config_require( adspFASql ) : config_require( adspBAYPresenceFacture ) config_add_mib( ADSP-MIB ) and then run ./configure --with-default-snmp-version="2" --with-defaults --with-mib-modules=adsp and that should pull in the other modules codes automatically ('config_require') as well as adding the relevant MIB file(s) to the default list. Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problème String into OID
Thank you, work nicely. Just one last things, when i compile my mib each time, I do it like that : ./configure --with-default-snmp-version="2" --with-sys-contact="@@no.where" --with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp" --with-mibs="SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:HOST-RESOURCES-TYPES:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-FRAMEWORK-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IP-FORWARD-MIB:NET-SNMP-PASS-MIB:NET-SNMP-EXTEND-MIB:UCD-DLMOD-MIB:SNMP-NOTIFICATION-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB:ADSP-MIB" --with-mib-modules="adspFAFtp adspFASql adspFAConnexionFtp adspFAFichierPresent adspFARecupFichier adspFAPresenceFacture adspBAYFtp adspBAYSql adspBAYConnexionFtp adspBAYFichierPresent adspBAYRecupFichier adspBAYPresenceFacture SupervisionTSEClient" By adding all the things, my MIB and my module from my mib Is there is a better solution to get this work :) ? Cordialy, -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : jeudi 2 août 2012 16:05 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problème String into OID On 2 August 2012 14:44, Jérôme BELLEGARDE wrote: > My question is now, how can I store a string into an OID Please see the code in 'agent/mibgroup/examples/watched.c' which does exactly this. Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Problème String into OID
Hello, I got the following code found on your wiki to store long and int value into an oid (file .c). #include #include #include #include "adspFAFtp.h" /* * the variable we want to tie an OID to. The agent will handle all * * GET and SET requests to this variable changing it's value as needed. */ static long adspFAFtp = 1; /* * our initialization routine, automatically called by the agent * (to get called, the function name must match init_FILENAME()) */ void init_adspFAFtp(void) { static oid adspFAFtp_oid[] = { 1, 3, 6, 1, 4, 1, 39387, 1, 1 }; /* * a debugging statement. Run the agent with -DnstAgentModuleObject to see * the output of this debugging statement. */ DEBUGMSGTL(("adspFAFtp", "Initializing the adspFAFtp module\n")); /* * the line below registers our variables defined above as * accessible and makes it writable. A read only version of any * of these registration would merely call * register_read_only_int_instance() instead. The functions * called below should be consistent with your MIB, however. * * If we wanted a callback when the value was retrieved or set * (even though the details of doing this are handled for you), * you could change the NULL pointer below to a valid handler * function. */ DEBUGMSGTL(("adspFAFtp", "Initalizing adspFAFtp scalar integer. Default value = %d\n", adspFAFtp)); netsnmp_register_long_instance("adspFAFtp", adspFAFtp_oid, OID_LENGTH(adspFAFtp_oid), &adspFAFtp, NULL); DEBUGMSGTL(("adspFAFtp", "Done initalizing adspFAFtp module\n")); } My question is now, how can I store a string into an OID (like 500/1000 char or so). If you can give me an exemple of it. Thank you :) Cordialy -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problem installing a MIB
Hey, >> Try putting your snmpd.conf file in /usr/local/etc/snmp Have try, but it didn't work, so I run the based command, and now I got my snmp working. Now, I'm able to do : snmpget -v2c -c tutget localhost: NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 >>NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = INTEGER: 1 But : snmpset -v2c -c tutset localhost: NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 5 Return me : Reason: wrong Length (The set value has an illegal length from what the agent expects) Failed object: NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 This is because I'm running on Ubunu x64 I guess. I found this thread : http://sourceforge.net/mailarchive/forum.php?thread_name=CAKoMtGY7YiMM9L4UmcFEFim23sp7YWxAdQiLPVf-EhwsLicmzQ%40mail.gmail.com&forum_name=net-snmp-users And I'm actually trying our solution (long instead of int). I compile back net snmp (./configure // make // make install (do I have to do that all the time ?). Restart snmpd But still getting : snmpset -v2c -c Dialog localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 5 Error in packet. Reason: wrongLength (The set value has an illegal length from what the agent expects) Failed object: NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 snmpset -v2c -c Dialog localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 s 5 No log handling enabled - using stderr logging NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0: Bad variable type (Type of attribute is Integer32, not OCTET STRING) Cordialement, --- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : vendredi 18 mai 2012 11:33 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problem installing a MIB On 18 May 2012 08:43, Jérôme BELLEGARDE wrote: >>>What is in your snmpd.conf file? > > My snmpd.conf file is locate on /etc/snmp/ > (which is the basic way of the Ubuntu server). That's the location for the Ubuntu-provided agent - yes. But if you're running a self-compiled agent, then that does *not* look in /etc/snmp. It typically looks in /usr/local/etc/snmp instead See the FAQ entry My new agent is ignoring the old snmpd.conf file. Why? (http://www.net-snmp.org/wiki/index.php/FAQ:Agent_28) > Or else there is another one in /var/net-snmp. No - ignore that one. > When I run : > > net-snmp-config --snmpconfpath >>>>/usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/home/ >>>>dialog/.snmp:/var/net-snmp > > /usr/local/etc/snmp => not exist > /usr/local/share/snmp => exist but no file snmpd.conf, only snmp.conf > /usr/local/lib/snmp => not exist > When I try to put my snmpd.conf in /var/net-snmp, I restart snmpd service, > and it overwrite it with info on top. Try putting your snmpd.conf file in /usr/local/etc/snmp Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problem installing a MIB
Hey, >> How have you configured the access control for this agent? What do you mean ? >>What is in your snmpd.conf file? My snmpd.conf file is locate on /etc/snmp/ (which is the basic way of the Ubuntu server). Or else there is another one in /var/net-snmp. In /var/net-snmp/snmpd.conf : # # net-snmp (or ucd-snmp) persistent data file. # # STOP STOP STOP STOP STOP STOP STOP STOP STOP # # DO NOT EDIT THIS FILE # # STOP STOP STOP STOP STOP STOP STOP STOP STOP # # DO NOT STORE CONFIGURATION ENTRIES HERE. # Please save normal configuration tokens for snmpd in SNMPCONFPATH/snmpd.conf. # Only "createUser" tokens should be placed here by snmpd administrators. # (Did I mention: do not edit this file?) # usmUser 1 3 0x80001f88803d1bf03c2f0cb14f 0x76335f75736572 0x76335f75736572 NULL .1.3.6.1.6.3.10.1.1.2 0xa1a7448a30e2db676795814e6b27cc7e .1.3.6.1.6.3.10.1.2.2 0x4600cb1b7beca9fe43e5c1aeedbdb511 0x psyslocation Unknown setserialno 216543670 ## # # snmpNotifyFilterTable persistent data # ## ## # # ifXTable persistent data # ifXTable .1 14:0 18:0x $ ifXTable .2 14:0 18:0x $ ## engineBoots 10 oldEngineID 0x80001f88803d1bf03c2f0cb14f When I run : net-snmp-config --snmpconfpath >>>/usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/home/dialog/.snmp:/var/net-snmp /usr/local/etc/snmp => not exist /usr/local/share/snmp => exist but no file snmpd.conf, only snmp.conf /usr/local/lib/snmp => not exist /home/dialog/.snmp => not exist /var/net-snmp => snmpd.conf wrote on top of this message. When I try to put my snmpd.conf in /var/net-snmp, I restart snmpd service, and it overwrite it with info on top. Thx fo our help. Cordialement, Jérôme BELLEGARDE --- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : jeudi 17 mai 2012 09:35 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problem installing a MIB On 16 May 2012 10:05, Jérôme BELLEGARDE wrote: > And when I try : /usr/local/sbin/snmpd -f -L -d -p > > I got : > > Warning: no access control information configured. > (Config search path: > /usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/home/dialog/.snmp) How have you configured the access control for this agent? What is in your snmpd.conf file? More particularly, *where* is your snmpd.conf file? Note the list of locations that the agent is looking in. Do you have a suitable snmpd.conf file in any of these places? (Hint: the answer is almost certainly "no") Remember that you are now running a self-compiled version of the agent, and not a vendor-supplied one. So the agent will be looking in a different set of locations for the config files. It won't automatically pick up the original snmpd.conf files. This is covered in the FAQ Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problem installing a MIB
Hey, I worked on it some time. Now its running the agent from /usr/local/sbin. ps -ef | grep snmp => snmp 57859 1 0 10:51 ?00:00:00 /usr/local/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid But, when I try now an snmpget -v2c -c Dialog localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject => Timeout: No Response from localhost. snmpget -v2c -c locahost localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject => Timeout: No Response from localhost. I have compiled with info like that for testing : ./configure --with-default-snmp-version="2" --with-sys-contact="@@no.where" --with-sys-location="Unknown" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp" --with-mibs="SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:HOST-RESOURCES-TYPES:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-FRAMEWORK-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IP-FORWARD-MIB:NET-SNMP-PASS-MIB:NET-SNMP-EXTEND-MIB:UCD-DLMOD-MIB:SNMP-NOTIFICATION-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB:NET-SNMP-TUTORIAL-MIB" --with-mib-modules="nstAgentModuleObject" And when I try : /usr/local/sbin/snmpd -f -L -d -p I got : Warning: no access control information configured. (Config search path: /usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/home/dialog/.snmp) It's unlikely this agent can serve any useful purpose in this state. Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for this agent. Error opening specified endpoint "" Server Exiting with code 1 Thx for your help Cordialement, Jérôme BELLEGARDE --- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : mardi 15 mai 2012 16:53 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problem installing a MIB On 15 May 2012 15:25, Jérôme BELLEGARDE wrote: > Now the file is like this : > export PATH=/usr/local/sbin Argh! That's why you're having problems. You only needed to change the references to /usr/sbin/snmpd to read /usr/local/sbin/snmpd (and similarly for snmptrapd). You shouldn't have changed the PATH setting. Now the script is *only* looking in /usr/local/sbin and hence can't find any of the usual Linux commands. Put this line back to the way it was before export PATH=/sbin:/usr/sbin:/bin:/usr/bin and try again Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problem installing a MIB
Hey, >> Put this line back to the way it was before export PATH=/sbin:/usr/sbin:/bin:/usr/bin Agh ! Did it, ok nice so now the restart is working /etc/init.d/snmpd restart Then : snmptranslate -M+. -mNET-SNMP-TUTORIAL-MIB -Tp -IR nstAgentModuleObject => +-- -RW- Integer32 nstAgentModuleObject(1) snmpget -v 2c -c Dialog localhost .1.3.6.1.4.1.2021.2.1.2.2 => UCD-SNMP-MIB::prNames.2 = STRING: ntalkd snmpget -v2c -c Dialog localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 => NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = No Such Object available on this agent at this OID That's not solved the problem :s Cordialement, Jérôme BELLEGARDE --- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : mardi 15 mai 2012 16:53 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problem installing a MIB On 15 May 2012 15:25, Jérôme BELLEGARDE wrote: > Now the file is like this : > export PATH=/usr/local/sbin Argh! That's why you're having problems. You only needed to change the references to /usr/sbin/snmpd to read /usr/local/sbin/snmpd (and similarly for snmptrapd). You shouldn't have changed the PATH setting. Now the script is *only* looking in /usr/local/sbin and hence can't find any of the usual Linux commands. Put this line back to the way it was before export PATH=/sbin:/usr/sbin:/bin:/usr/bin and try again Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problem installing a MIB
Hey, >> What do the following command report: which ln => /bin/ln ls -l /bin/ln /usr/bin/ln => ls: cannot access /usr/bin/ln: No such file or directory -rwxr-xr-x 1 root root 47680 2011-02-23 15:24 /bin/ln >>Try tweaking this line of the /etc/init.d/snmpd script to use the full path >>(i.e. /bin/ln -sf /var/agentx/master /var/run/agentx ) Sounds like he pass throught it, but I got another error then : /etc/init.d/snmpd: 97: start-stop-daemon: not found Hx for your help. Cordialement, Jérôme BELLEGARDE --- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : mardi 15 mai 2012 16:35 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problem installing a MIB On 15 May 2012 15:25, Jérôme BELLEGARDE wrote: > But when I'm doing /etc/init.d/snmpd restart, I got this error : > /etc/init.d/snmpd: 39: ln: not found Hmmm... I'd expect 'ln' to be a fairly standard command in any Linux distribution. What do the following command report: which ln ls -l /bin/ln /usr/bin/ln Try tweaking this line of the /etc/init.d/snmpd script to use the full path (i.e. /bin/ln -sf /var/agentx/master /var/run/agentx ) Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
RE: Problem installing a MIB
Thx for this solution. I have made the changement of the link destination on my /etc/init.d/snmpd Now the file is like this : set -e . /lib/lsb/init-functions export PATH=/usr/local/sbin test -x /usr/local/sbin/snmpd || exit 0 test -x /usr/local/sbin/snmptrapd || exit 0 # Defaults export MIBDIRS=/usr/share/mibs/netsnmp SNMPDRUN=yes SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid' TRAPDRUN=no TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid' # Reads config file (will override defaults above) [ -r /etc/default/snmpd ] && . /etc/default/snmpd # Cd to / before starting any daemons. cd / # Create compatibility link to old AgentX socket location if [ "$SNMPDCOMPAT" = "yes" ] && [ "$1" != status ]; then ln -sf /var/agentx/master /var/run/agentx fi case "$1" in start) log_daemon_msg "Starting network management services:" if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then start-stop-daemon --quiet --start --oknodo --exec /usr/local/sbin/snmpd \ -- $SNMPDOPTS log_progress_msg " snmpd" fi if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then start-stop-daemon --quiet --start --oknodo --exec /usr/local/sbin/snmptrapd \ -- $TRAPDOPTS log_progress_msg " snmptrapd" fi ;; stop) log_daemon_msg "Stopping network management services:" start-stop-daemon --quiet --stop --oknodo --exec /usr/local/sbin/snmpd log_progress_msg " snmpd" start-stop-daemon --quiet --stop --oknodo --exec /usr/local/sbin/snmptrapd log_progress_msg " snmptrapd" ;; restart) log_daemon_msg "Restarting network management services:" start-stop-daemon --quiet --stop --oknodo --exec /usr/local/sbin/snmpd start-stop-daemon --quiet --stop --oknodo --exec /usr/local/sbin/snmptrapd # Allow the daemons time to exit completely. sleep 2 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then start-stop-daemon --quiet --start --exec /usr/local/sbin/snmpd -- $SNMPDOPTS log_progress_msg " snmpd" fi if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then # Allow snmpd time to start up. sleep 1 start-stop-daemon --quiet --start --exec /usr/local/sbin/snmptrapd -- $TRAPDOPTS log_progress_msg " snmptrapd" fi ;; reload|force-reload) log_daemon_msg "Reloading network management services:" if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then start-stop-daemon --quiet --stop --signal 1 \ --pidfile /var/run/snmpd.pid --exec /usr/local/sbin/snmpd log_progress_msg " snmpd" fi ;; status) status=0 status_of_proc /usr/local/sbin/snmpd snmpd || status=$? status_of_proc /usr/local/sbin/snmptrapd snmptrapd || status=$? exit $status ;; *) echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload|status}" exit 1 esac exit 0 (I have change every /usr/sbin by /usr/local/sbin). But when I'm doing /etc/init.d/snmpd restart, I got this error : /etc/init.d/snmpd: 39: ln: not found That's the line if [ "$SNMPDCOMPAT" = "yes" ] && [ "$1" != status ]; then ln -sf /var/agentx/master /var/run/agentx fi but I don't know how to pass throught it ? simply delete it ? Cordialement, Jérôme BELLEGARDE --- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : mardi 15 mai 2012 15:52 À : Jérôme BELLEGARDE Cc : Net-SNMP users Objet : Re: Problem installing a MIB [ First - *please* don't mail me privately, without copying any responses to the mailing list. I don't have the time or inclination to offer private, unpaid, SNMP consultancy. Keep discussions to the list, where others can both learn and offer advice. Thanks. ] On 15 May 2012 13:51, Jérôme BELLEGARDE wrote: > Hey, > >>> So the binary was installed into /usr/local/sbin/snmpd - yes? > > Yes, inded I have a snmpd file and a snmptrapd file into that folder. Good. >>> If you want to query this object, then you need to be running the >>> new version of the agent, not the original one. > > Ok I get it, so I put the file in right folder (mean I saved > /usr/sbin/snmpd, and then I put the file from /usr/local/sbin/ into > /usr/sbin/). No. What I mean is that you should tweak the /etc/init.d/snmpd script so that it runs the binary /usr/local/sbin/snmpd, rather than /usr/sbin/snmpd (And similarly for the tra
TR: Problem installing a MIB
Hello, Thanks for your fast answer. I have download the tar package on the snmp-website / mirror. I have kept all defaut parameters while ./configure, only changed the snmp version to 2c. (2) >> Have you tweaked this script to work with your locally compiled version of the agent? Or is it still running the Ubuntu-provided agent binary (which therefore won't include your changes). This means ? I have installed snmp package by apt-get install snmp. Then, I change it and modify the snmpd.conf to write my community ect. (in my previous mail I have joined all the snmpd.conf file.) The snmpd in /etc/init.d is the basic one Here the snmpd file in /etc/init.d : set -e . /lib/lsb/init-functions export PATH=/sbin:/usr/sbin:/bin:/usr/bin test -x /usr/sbin/snmpd || exit 0 test -x /usr/sbin/snmptrapd || exit 0 # Defaults export MIBDIRS=/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp SNMPDRUN=yes SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid' TRAPDRUN=no TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid' # Reads config file (will override defaults above) [ -r /etc/default/snmpd ] && . /etc/default/snmpd # Cd to / before starting any daemons. cd / # Create compatibility link to old AgentX socket location if [ "$SNMPDCOMPAT" = "yes" ] && [ "$1" != status ]; then ln -sf /var/agentx/master /var/run/agentx fi case "$1" in start) log_daemon_msg "Starting network management services:" if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmpd \ -- $SNMPDOPTS log_progress_msg " snmpd" fi if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmptrapd \ -- $TRAPDOPTS log_progress_msg " snmptrapd" fi ;; stop) log_daemon_msg "Stopping network management services:" start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmpd log_progress_msg " snmpd" start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmptrapd log_progress_msg " snmptrapd" ;; restart) log_daemon_msg "Restarting network management services:" start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmpd start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmptrapd # Allow the daemons time to exit completely. sleep 2 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS log_progress_msg " snmpd" fi if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then # Allow snmpd time to start up. sleep 1 start-stop-daemon --quiet --start --exec /usr/sbin/snmptrapd -- $TRAPDOPTS log_progress_msg " snmptrapd" fi ;; reload|force-reload) log_daemon_msg "Reloading network management services:" if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then start-stop-daemon --quiet --stop --signal 1 \ --pidfile /var/run/snmpd.pid --exec /usr/sbin/snmpd log_progress_msg " snmpd" fi ;; status) status=0 status_of_proc /usr/sbin/snmpd snmpd || status=$? status_of_proc /usr/sbin/snmptrapd snmptrapd || status=$? exit $status ;; *) echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload|status}" exit 1 esac exit 0 thanks for your help. Cordialement, Jérôme BELLEGARDE ----------- -Message d'origine- De : Dave Shield [mailto:d.t.shi...@liverpool.ac.uk] Envoyé : mardi 15 mai 2012 11:54 À : Jérôme BELLEGARDE Cc : net-snmp-users@lists.sourceforge.net Objet : Re: Problem installing a MIB On 15 May 2012 10:22, Jérôme BELLEGARDE wrote: > ./configure --with-mib-modules="nstAgentModuleObject" > Make > Make install This is presumably installing a source-compiled version of the agent. Where was it installed to? ( /usr/local/sbin/snmpd would be the usual location. ) > Restart /etc/init.d/snmpd restart (Ubuntu server). Have you tweaked this script to work with your locally compiled version of the agent? Or is it still running the Ubuntu-provided agent binary (which therefore won't include your changes). Dave -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will inclu
Problem installing a MIB
Hello everyone, I'm currently trying to install a MIB for my enterprise (got IANA number),but it seems I got some problem. So I try to use this : http://net-snmp.sourceforge.net/wiki/index.php/TUT:Writing_a_MIB_Module So i have : ./configure --with-mib-modules="nstAgentModuleObject" Make Make install Added community in snmpd.conf. Restart /etc/init.d/snmpd restart (Ubuntu server). When i do : snmptranslate -m +NET-SNMP-TUTORIAL-MIB -IR -On nstAgentModuleObject Answer is : .1.3.6.1.4.1.8072.2.4.1.1.1 snmptranslate -Td -M+. -mNET-SNMP-TUTORIAL-MIB -IR nstAgentModuleObject I got : NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject nstAgentModuleObject OBJECT-TYPE -- FROM NET-SNMP-TUTORIAL-MIB SYNTAXInteger32 MAX-ACCESSread-write STATUScurrent DESCRIPTION "This is an object that simply supports a writable integer when compiled into the agent. See http://www.net-snmp.org/tutorial-5/toolkit/XXX for further implementation details." DEFVAL{ 1 } ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) netSnmp(8072) netSnmpExamples(2) netSnmpTutorialMIB(4) nstMIBObjects(1) nstAgentModules(1) 1 } snmptranslate -M+. -mNET-SNMP-TUTORIAL-MIB -Tp -IR nstAgentModuleObject +-- -RW- Integer32 nstAgentModuleObject(1) But once i try : snmpget -v2c -c Dialog localhost NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 =>NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = No Such Object available on this agent at this OID Here is my snmpd.conf located in /etc/snmp/ agentAddress udp:161,udp6:[::1]:161 view all included .1 rocommunity Dialog default rouser authOnlyUser sysLocationSitting on the Dock of the Bay sysContact Me # Application + End-to-End layers sysServices72 proc mountd # No more than 4 'ntalkd' processes - 0 is OK proc ntalkd4 # At least one 'sendmail' process, but no more than 10 proc sendmail 10 1 disk / 1 disk /var 5% includeAllDisks 10% trapsink localhost public iquerySecName internalUser rouser internalUser # generate traps on UCD error conditions defaultMonitors yes # generate traps on linkUp/Down linkUpDownNotifications yes extendtest1 /bin/echo Hello, world! extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35 master agentx And my snmp.conf locate in /etc/snmp/ mibdirs /usr/local/share/snmp/mibs/ Thx for your help. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users