[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: custom SNMP for custom graph



I think you want to use sh instead of exec. Quoting from the man page:
"The PROG argument for exec directives must be a full path to a real
binary, as it is executed via the exec() system  call.   To  invoke  a
shell script, use the sh directive instead."

Also, I'd double check to make sure the script has the proper
permissions set so that it is executable by the snmpd daemon.

If all fails, I'd grep /var/log for snmpd and see what sort of errors
you get. They're usually quite helpful.

James

 

-----Original Message-----
From: Mihamina Rakotomandimby [mailto:mihamina@gulfsat.mg] 
Sent: March 9, 2010 9:26 AM
To: List Debian User; net-snmp-coders@lists.sourceforge.net
Subject: custom SNMP for custom graph

Manao ahoana, Hello, Bonjour,

I have an already working MRTG+SNMP+Apache here:
http://srv3.rktmb.org:90/mrtg/

I try to make a custom MRTG graph
First, I need to build SNMP stuff.

Say I want to monitor the access of my web server by counting the number
of lines of my access_log file. Just that simple, to begin.

I have a script:

/usr/local/bin/ocsigen_access containing:

 #!/bin/bash
 echo "ocsigen"
 echo $(wc -l /var/log/ocsigen/access.log | awk '{print $1}')  exit 35

Then in my /etc/snmp/snmpd.conf, I added:

 exec .1.3.6.1.4.1.2021.254 ocsigen /usr/local/bin/ocsigen_access

Then restart SNMPd

 invoke-rc.d snmpd restart

Then on the same host:
 snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.254  (returns
nothing...)

What did I miss?

PS: 

  $ echo $(wc -l /var/log/ocsigen/access.log | awk '{print $1}')
  510502
  $

Misaotra, Thanks, Merci.

-- 
       Architecte Informatique chez Blueline/Gulfsat:
    Administration Systeme, Recherche & Developpement
                +261 34 29 155 34 / +261 33 11 207 36


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org
Archive:
20100309172611.09cc4fa6@pbmiha.malagasy.com">http://lists.debian.org/20100309172611.09cc4fa6@pbmiha.malagasy.com


Reply to: