Here is a more complete patch, which fixes some things that the patch from Munin's bugtracker didn't.

Best regards.

--
Raphaël HALIMI
diff -ur munin-1.4.5.orig/plugins/node.d/asterisk_channels.in munin-1.4.5/plugins/node.d/asterisk_channels.in
--- munin-1.4.5.orig/plugins/node.d/asterisk_channels.in	2009-11-12 03:27:57.000000000 +0100
+++ munin-1.4.5/plugins/node.d/asterisk_channels.in	2011-11-08 14:16:43.023201722 +0100
@@ -104,7 +104,7 @@
 
 ## Request status of messages.
 $pop->print("Action: command");
-$pop->print("Command: show channels");
+$pop->print("Command: core show channels");
 $pop->print("");
 my $result;
 while (($line = $pop->getline) and ($line !~ /END COMMAND/o))
@@ -117,6 +117,9 @@
 $pop->print("Action: logoff");
 $pop->print("");
 
+## Exhaust buffer before closing (to avoid polluting Asterisk's logs)
+while ($line = $pop->getline) {}
+
 print "channels.value $nb\n";
 
 # vim:syntax=perl
diff -ur munin-1.4.5.orig/plugins/node.d/asterisk_channelstypes.in munin-1.4.5/plugins/node.d/asterisk_channelstypes.in
--- munin-1.4.5.orig/plugins/node.d/asterisk_channelstypes.in	2009-11-12 03:27:57.000000000 +0100
+++ munin-1.4.5/plugins/node.d/asterisk_channelstypes.in	2011-11-08 14:16:43.023201722 +0100
@@ -120,7 +120,7 @@
 
 ## Request status of messages.
 $pop->print("Action: command");
-$pop->print("Command: show channels");
+$pop->print("Command: core show channels");
 $pop->print("");
 
 #Response: Follows
@@ -157,6 +157,9 @@
 $pop->print("Action: logoff");
 $pop->print("");
 
+## Exhaust buffer before closing (to avoid polluting Asterisk's logs)
+while ($line = $pop->getline) {}
+
 $i = 0;
 foreach my $channel (@CHANNELS) {
     print "$channel.value $results[$i]\n";
diff -ur munin-1.4.5.orig/plugins/node.d/asterisk_codecs.in munin-1.4.5/plugins/node.d/asterisk_codecs.in
--- munin-1.4.5.orig/plugins/node.d/asterisk_codecs.in	2009-11-12 03:27:57.000000000 +0100
+++ munin-1.4.5/plugins/node.d/asterisk_codecs.in	2011-11-08 14:16:53.391290348 +0100
@@ -148,19 +148,19 @@
 }
 
 my @fields;
-while (($line = $pop->getline) and ($line !~ /active SIP channel/o))
+while (($line = $pop->getline) and ($line !~ /active SIP dialog/o))
 {
     #print STDERR "SIP: $line\n";
     $i = 0;
     my $found = 0;
     if ($start) {
 	@fields = (split ' ', $line);
-        if ($fields[4] eq '0x0') {
+        if ($fields[3] eq '0x0') {
             $unknown += 1;
             next;
         }
 	foreach my $codec (@CODECSX) {
-	    if ($fields[4] eq "$codec") {
+	    if ($fields[3] eq "$codec") {
 		$results[$i] = $results[$i] + 1;
 		$found = 1;
 		last;
@@ -193,11 +193,11 @@
     my $found = 0;
     if ($start) {
 	@fields = (split ' ', $line);
-        if ($fields[8] eq '0x0') {
+        if ($fields[8] eq 'unknow') {
             $unknown += 1;
             next;
         }
-	foreach my $codec (@CODECSX) {
+	foreach my $codec (@CODECS) {
 	    if ($fields[8] eq "$codec") {
 		$results[$i] = $results[$i] + 1;
 		$found = 1;
@@ -217,6 +217,9 @@
 $pop->print("Action: logoff");
 $pop->print("");
 
+## Exhaust buffer before closing (to avoid polluting Asterisk's logs)
+while ($line = $pop->getline) {}
+
 $i = 0;
 foreach my $codec (@CODECS) {
     print "$codec.value $results[$i]\n";
diff -ur munin-1.4.5.orig/plugins/node.d/asterisk_meetme.in munin-1.4.5/plugins/node.d/asterisk_meetme.in
--- munin-1.4.5.orig/plugins/node.d/asterisk_meetme.in	2009-11-12 03:27:57.000000000 +0100
+++ munin-1.4.5/plugins/node.d/asterisk_meetme.in	2011-11-08 14:16:43.023201722 +0100
@@ -104,7 +104,7 @@
 
 ## Request status of messages.
 $pop->print("Action: command");
-$pop->print("Command: meetme");
+$pop->print("Command: meetme list");
 $pop->print("");
 
 
@@ -129,6 +129,9 @@
 $pop->print("Action: logoff");
 $pop->print("");
 
+## Exhaust buffer before closing (to avoid polluting Asterisk's logs)
+while ($line = $pop->getline) {}
+
 print "confs.value $confs\n";
 
 # vim:syntax=perl
diff -ur munin-1.4.5.orig/plugins/node.d/asterisk_meetmeusers.in munin-1.4.5/plugins/node.d/asterisk_meetmeusers.in
--- munin-1.4.5.orig/plugins/node.d/asterisk_meetmeusers.in	2009-11-12 03:27:57.000000000 +0100
+++ munin-1.4.5/plugins/node.d/asterisk_meetmeusers.in	2011-11-08 14:16:43.027216245 +0100
@@ -106,7 +106,7 @@
 
 ## Request status of messages.
 $pop->print("Action: command");
-$pop->print("Command: meetme");
+$pop->print("Command: meetme list");
 $pop->print("");
 
 my $nb = 0;
@@ -125,6 +125,9 @@
 $pop->print("Action: logoff");
 $pop->print("");
 
+## Exhaust buffer before closing (to avoid polluting Asterisk's logs)
+while ($line = $pop->getline) {}
+
 print "users.value $nb\n";
 
 # vim:syntax=perl
diff -ur munin-1.4.5.orig/plugins/node.d/asterisk_sipchannels.in munin-1.4.5/plugins/node.d/asterisk_sipchannels.in
--- munin-1.4.5.orig/plugins/node.d/asterisk_sipchannels.in	2009-11-12 03:27:57.000000000 +0100
+++ munin-1.4.5/plugins/node.d/asterisk_sipchannels.in	2011-11-08 14:17:13.563766312 +0100
@@ -147,18 +147,18 @@
     $i++;
 }
 
-while (($line = $pop->getline) and ($line !~ /active SIP channel/o))
+while (($line = $pop->getline) and ($line !~ /active SIP dialog/o))
 {
     $i = 0;
     if ($start) {
 	my @fields = (split ' ', $line);
-	if ($fields[4] eq '0x0') {
+	if ($fields[3] eq '0x0') {
 	    $unknown += 1;
 	    next;
 	}
 	my $found = 0;
 	foreach my $codec (@CODECSX) {
-	    if ($fields[4] eq "$codec") {
+	    if ($fields[3] eq "$codec") {
 		$results[$i] = $results[$i] + 1;
 		$found = 1;
 		last;
@@ -176,6 +176,9 @@
 $pop->print("Action: logoff");
 $pop->print("");
 
+## Exhaust buffer before closing (to avoid polluting Asterisk's logs)
+while ($line = $pop->getline) {}
+
 $i = 0;
 foreach my $codec (@CODECS) {
     print "$codec.value $results[$i]\n";
diff -ur munin-1.4.5.orig/plugins/node.d/asterisk_sippeers.in munin-1.4.5/plugins/node.d/asterisk_sippeers.in
--- munin-1.4.5.orig/plugins/node.d/asterisk_sippeers.in	2009-11-12 03:27:57.000000000 +0100
+++ munin-1.4.5/plugins/node.d/asterisk_sippeers.in	2011-11-08 14:16:43.027216245 +0100
@@ -152,6 +152,9 @@
 $pop->print("Action: logoff");
 $pop->print("");
 
+## Exhaust buffer before closing (to avoid polluting Asterisk's logs)
+while ($line = $pop->getline) {}
+
 #print "peers.value $peers\n";
 print "mon.value $monitor_online\n";
 print "moff.value $monitor_offline\n";
diff -ur munin-1.4.5.orig/plugins/node.d/asterisk_voicemail.in munin-1.4.5/plugins/node.d/asterisk_voicemail.in
--- munin-1.4.5.orig/plugins/node.d/asterisk_voicemail.in	2009-11-12 03:27:57.000000000 +0100
+++ munin-1.4.5/plugins/node.d/asterisk_voicemail.in	2011-11-08 14:17:37.431234242 +0100
@@ -109,7 +109,7 @@
 
 ## Request status of messages.
 $pop->print("Action: command");
-$pop->print("Command: show voicemail users");
+$pop->print("Command: voicemail show users");
 $pop->print("");
 
 #Context    Mbox  User                      Zone       NewMsg
@@ -119,7 +119,7 @@
 my ($results,$start)=(0,0);
 
 my @fields;
-while (($line = $pop->getline)  and ($line !~ /--END/o))
+while (($line = $pop->getline)  and ($line !~ /configured\./o))
 {
     if ($start) {
 	@fields = (split ' ', $line);	
@@ -133,5 +133,8 @@
 $pop->print("Action: logoff");
 $pop->print("");
 
+## Exhaust buffer before closing (to avoid polluting Asterisk's logs)
+while ($line = $pop->getline) {}
+
 print "messages.value $results\n";
 # vim:syntax=perl

Reply via email to