From: Mihamina Rakotomandimby on
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(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/20100309172611.09cc4fa6(a)pbmiha.malagasy.com
From: James Wu on
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(a)gulfsat.mg]
Sent: March 9, 2010 9:26 AM
To: List Debian User; net-snmp-coders(a)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(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact
listmaster(a)lists.debian.org
Archive:
http://lists.debian.org/20100309172611.09cc4fa6(a)pbmiha.malagasy.com


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/FFFA2CACDB4D5C44A24B09301138121801177ED1(a)ersbs2.eyeReturn.local
From: Mihamina Rakotomandimby on

> Then in my /etc/snmp/snmpd.conf, I added:
> exec .1.3.6.1.4.1.2021.254 ocsigen /usr/local/bin/ocsigen_access

grepping the logs:

Mar 10 07:00:11 ns309487 snmpd[12609]:
/etc/snmp/snmpd.conf: line 335:
Error: ERROR:
This output format has been deprecated
Please use the 'extend' directive instead

Using "extend", it works
What stupid I am when I forgot to grep the logs...

--
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(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/20100310092601.2ac82438(a)pbmiha.malagasy.com