Hi Pierre,

Yes, this seems to be a bug/feature of ucd-snmp maybe net-snmp too.

I use "pass" instead of exec that allows me to specify the type, but its more complex.

And for the Apache Hits, we made an interface type for it, its on todays nightly, and it will be included in 0.7.9. This uses the /server-status? URL to gather information from the remote apache host.

Can you try it? to see if it does the same as you want.

Javier

Pierre-Damien Gatouillat wrote:
Hi,

My shell script is :
#!/bin/bash

DATE=`date +%Y%m%d`
LOG_TEMP="/tmp/log.imss"
grep "Final action" /usr/local/trend/imss/log/log.imss.$DATE* > $LOG_TEMP
TOTAL=`wc -l $LOG_TEMP | awk {'print $1'}`
DELETE=`grep Delete $LOG_TEMP | wc -l`
QUARANTINE=`grep Quarantine $LOG_TEMP | wc -l`

echo $TOTAL
echo $DELETE
echo $QUARANTINE

I don't know how I can return an integer value...

For the momemt, I put $value = str_replace("\"","",$value) in the snmp_counter poller, and it works. (I'm very happy :o)

If you or someone else know how have an integer with this script, it woulb be nice.
I try also with a perl script like this :
#!/usr/bin/perl


$uptime = `uptime`;

$uptime =~ /up (.*?) day/;
$up = int($1);

print "$up\n";

But, same problem with snmpwalk, and the variable $up is an integer :
cerebellum:~# snmpwalk -v 1 localhost public  .1.3.6.1.4.1.2021.51
enterprises.ucdavis.51.1.1 = 1
enterprises.ucdavis.51.2.1 = "uptime"
enterprises.ucdavis.51.3.1 = "/usr/local/mrtg/scripts/uptime.pl"
enterprises.ucdavis.51.100.1 = 0
enterprises.ucdavis.51.101.1 = "53"

The quotes are always here... I think there is a problem with the exec function of ucd-snmp. I have not try with net-snmp.

I will try to write a mini-howto to have graph like uptime, apache stats (hits, trafic), dns requests, ... with this method.

Pierre



Javier Szyszlican a écrit :

Pierre,

You should look into the shell script.
Its returning the type as STRING instead of INTEGER.

To convert it you have to do
$value = str_replace("\"","",$value);

Javier

Pierre-Damien Gatouillat wrote:

Thanks for your reply. But my script returns, for example 872, but the snmp
function return "872" :
[EMAIL PROTECTED] engine]# snmpwalk -v 1 192.168.4.20 public .1.3.6.1.4.1.2021.51
enterprises.ucdavis.51.1.1 = 1
enterprises.ucdavis.51.2.1 = "mail"
enterprises.ucdavis.51.3.1 = "/usr/local/bin/stat_mail.sh"
enterprises.ucdavis.51.100.1 = 0
enterprises.ucdavis.51.101.1 = "872"
enterprises.ucdavis.51.101.2 = "21"
enterprises.ucdavis.51.101.3 = "19"
enterprises.ucdavis.51.102.1 = 0


I try this :
if (is_string($value)) settype ($value, "integer");

But it doesn't work.

Do you know how we can remove the quotes ?

Pierre

_________________
Hi Pierre,

Everything is fine.

Except that the return value is a string, and it has to be a number.

You don't see it in the RRD line because its not a number.

So, you have 3 options.

- Modify the stat_mail.sh to return an INTEGER without the " "
- Create a poller to get this OID and convert it to integer.
- Modify the snmp_counter poller to convert the return value to integer
(remove the quotes)


I think the first option is the best.

I hope this helps.

Javier

Pierre-Damien Gatouillat wrote:


Hello everybody,

I have had a new poller item like that :
ID Description Name (Match RRD Struct DS) Poller Command



(file)

Parameters
10001     Mail Accounting Total     mail_delete     snmp_counter
   .1.3.6.1.4.1.2021.51.101.1

The OID is a private one and exec un shell script via snmpd.conf :
exec .1.3.6.1.4.1.2021.51 mail /usr/local/bin/stat_mail.sh

This OID works good and return a value : #snmpwalk -v 1 localhost public
.1.3.6.1.4.1.2021.51.101.1 :
enterprises.ucdavis.51.101.1 = "1171"


Next add this poller to "Linux/Unix System Info" Interface Types :
ID Description Internal Name Position Interface



Type Field

Type Show Overwritable Tracked Default Value
10007 Mails Total mail_total 130 Linux/Unix System



Info RRDTool

DS Never Type: Gauge Min: 0 Max: 10000 or Use for



Max

Next add an entry in "Poller/Backend Grouping" in Linux/Unix Host:
10006 Linux/Unix Host 75 Mail Accounting Total



Temporal Buffer

And a graphe type :
10001 Mails Linux/Unix System Info mail_stats



500 175

0       0

And a new php script : mail_stats.inc.php with a copy of the rtt graph, change
the value rtt by mail_stats.


When I run php -q poller.php 4 41, the rrd file is created, I can see a graph,
but after new polling, the rrd is not change, and no value in it (rrdtool dump
interface-41-12.rrd)
THe result of the poller :
bash-2.05$ php -q poller.php 4 41
: H 4 : Poller Start : 14 Items.
: H 4 : I 41 : P 10 : snmp_counter:cpu_nice_ticks(.1.3..1.0): 1305 ->
buffer(): 1 (time P:3.19 | 0.34)
: H 4 : I 41 : P 15 : snmp_counter:num_procs(.1.3..6.0): 261 ->
buffer(): 2 (time P:1.4 | 0.12)
: H 4 : I 41 : P 20 : snmp_counter:cpu_user_ticks(.1.3..0.0): 43094 ->
buffer(): 3 (time P:1.12 | 0.12)
: H 4 : I 41 : P 25 : snmp_counter:num_users(.1.3..5.0): 0 ->



buffer():

4 (time P:0.92 | 0.11)
: H 4 : I 41 : P 30 : snmp_counter:cpu_idle_ticks(.1.3..3.0): 6540643



->

buffer(): 5 (time P:1.08 | 0.11)
: H 4 : I 41 : P 35 : snmp_counter:tcp_established(.1.3..9.0): 68 ->
buffer(): 6 (time P:0.84 | 0.11)
: H 4 : I 41 : P 40 : snmp_counter:cpu_system_ticks(.1.3..2.0): 79668



->

buffer(): 7 (time P:1.08 | 0.11)
: H 4 : I 41 : P 45 : snmp_counter:tcp_active(.1.3..5.0): 46088 ->
buffer(): 8 (time P:0.71 | 0.11)
: H 4 : I 41 : P 50 : snmp_counter:load_average_1(.1.3..3.1): 0.06 ->
buffer(): 9 (time P:0.84 | 0.13)
: H 4 : I 41 : P 55 : snmp_counter:tcp_passive(.1.3..6.0): 0 ->
buffer(): 10 (time P:71.5 | 0.19)
: H 4 : I 41 : P 60 : snmp_counter:load_average_5(.1.3..3.2): 0.13 ->
buffer(): 11 (time P:2.81 | 0.19)
: H 4 : I 41 : P 70 : snmp_counter:load_average_15(.1.3..3.3): 0.10 ->
buffer(): 12 (time P:0.97 | 0.18)
: H 4 : I 41 : P 75 : snmp_counter:mail_total(.1.3..1.1): "1179" ->
buffer(): 13 (time P:173.07 | 0.15)
: H 4 : I 41 : P 80 : no_poller(): 0 -> rrd(*): cpu_user_ticks:43094 -
cpu_idle_ticks:6540643 - cpu_nice_ticks:1305 - cpu_system_ticks:79668 -
load_average_1:0.06 - load_average_5:0.13 - load_average_15:0.10 - num_users:0
- num_procs:261 - tcp_active:46088 - tcp_passive:0 - tcp_established:68 (time
P:0.19 | 117.95)
: H 4 : I 41 : P LPD : last_poll_date(): 1094153380 ->
db(last_poll_date): 1 (time P:0.21 | 2.29)
: H 4 : Poller End, Total Time: 392.6 msec.


The problem is at the no_poller() line, no value for mail_total, but I don't



see

what's wrong in my new poller definition.

Thanks for your help.
Pierre





------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_idP47&alloc_id808&op=click _______________________________________________ jffnms-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jffnms-users





-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
jffnms-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jffnms-users

-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Javier Szyszlican, Project Leader, JFFNMS [EMAIL PROTECTED]

I hope JFFNMS or I were helpful to you, if you
can, please donate at http://jffnms.org/donate



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idP47&alloc_id808&op=click
_______________________________________________
jffnms-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jffnms-users

Reply via email to