PASS OID and C++ SCRIPT

Hernán Romano <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello Guys!

 

 I have a problem, It’s a new issue that I cannot figure it out and I
couldn’t find any documentation about this.

 

The situation is this,

   In my snmpd.conf file i have this line: " pass .1.3.6.1.4.1.6147.2.1
/usr/share/cacti/scripts/TDP/binarios/ClearCodeGroup2 "

 

Note: "ClearCodeGroup2" is a simple C++ script that have been compiled and
its code is this:

 

         #include <cstdio>

         #include <cstdlib>

         #include <iostream>

         #include <sstream>

         #include <string>

         #include <vector>

         #include <set>

         #include <map>

         #include <fstream>

 

           using namespace std;

 

          int main(int argc, char *argv[])

        {;

           

            cout<<".1.3.6.1.4.1.6147.2.1\n";

             cout<<"Integer32\n";

            cout<<"321224";

         return 0;

       }

 

This little program works EXCELLENT! As you can see:

 

    root@cacti:/usr/share/cacti/scripts/TDP/binarios# snmpget -m TDP-MIB -v
2c -c TM_Com_Pub localhost .1.3.6.1.4.1.6147.2.1

    TDP-MIB::ClearCodeGroup1 = INTEGER: 321224

 

...but when i try to read the value for the OID from a "…/anyfile.txt", 

 

    int main(int argc, char *argv[])

        {

            string comando;

           char valor;

            comando="cat …/anyfile.txt | grep \"ALL GTP PDP context\" | awk
'{pr$

 

            cout<<".1.3.6.1.4.1.6147.2.1\n";

             cout<<"Integer32\n";

            cout<<comando;

         return 0;

       }

 

 

 

…the snmpgetnext doesnt work anymore and gives me this error.

 

    root@cacti:/usr/share/cacti/scripts/TDP/binarios# snmpget -m TDP-MIB -v
2c -c TM_Com_Pub localhost .1.3.6.1.4.1.6147.2.1

    TDP-MIB::PDPContextsNumber = No Such Instance currently exists at this
OID

 

I have test my C++ Script, and it works like i want and return me this:

   root@cacti:/usr/share/cacti/scripts/TDP/binarios# ./ClearCodeGroup2

    .1.3.6.1.4.1.6147.2.1

    Integer32

    321224

 

It's seems that I’m forgetting something!! but i don’t know what. I hope you
can help me out with this.

 

 

Hernán Romano Curo

Network Operation Center (NOC)

Phone: +51 1 6001818 (Opción 4)

Descripción: Descripción: global

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
image001.gif (image/gif, 5.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.