plugin:mikrotik - PHP escape character

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

plugin:mikrotik - PHP escape character

Post by proohu01 »

Dear Cacti users,

I am using http://docs.cacti.net/plugin:mikrotik#mikrotik with cacti Version 0.8.8b.

I am seeing the following on the cacti.log file
10/24/2013 07:25:01 AM - SPINE: Poller[0] Host[798] Description[APXXX001] ERROR: Empty result [APXXX001.bla.local]: '/usr/bin/snmpwalk APXXX001.bla.local -Cc -v 1 -c nevermind 1.3.6.1.2.1.4.22.1.2 | /bin/wc -l | /bin/awk \'{printf$0}\''
10/24/2013 07:25:01 AM - SPINE: Poller[0] Host[798] Description[APXXX001] ERROR: Empty result [APXXX001.bla.local]: '/usr/bin/snmpwalk APXXX001.bla.local -Cc -v 1 -c nevermind .1.3.6.1.4.1.14988.1.1.1.2.1.3 | /bin/wc -l | /bin/awk \'{printf$0}\''
I found out that the problem is with the \'{printf$0}\' bit. I should be '{printf$0}'

When I look at the "Console -> Data Input Methods -> Unix - Count Oids", the input string says: "/usr/bin/snmpwalk <ip> -Cc -v <ver> -c <comm> <oid> | /bin/wc -l | /bin/awk '{printf$0}'". The PHP escape characters are added automatically by Cacti in a later stage but should not end up at the final prompt as it does now.

Can someone provide a workaround or even a fix for this problem?
Cacti Version - 0.8.8b
CentOS 6.4
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

Re: plugin:mikrotik - PHP escape character

Post by proohu01 »

:o Anyone...
Please...

This is a new and fresh installation of Cacti and CentOS. I have a ton of plugins installed so far and everything seems oke except for the problem mentioned above.
Cacti Version - 0.8.8b
CentOS 6.4
User avatar
proohu01
Posts: 45
Joined: Mon Dec 20, 2004 3:13 am
Location: The Netherlands

Re: plugin:mikrotik - PHP escape character

Post by proohu01 »

I fixed it myself the dirty way :-?

Placed a bash script in the cacti scripts directory.

Code: Select all

#!/bin/bash
#
# Cacti Data Input Method: Unix - Count Oids
# Origional command: /usr/bin/snmpwalk <ip> -Cc -v <ver> -c <comm> <oid> | /bin/wc -l | /bin/awk '{printf$0}'

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

/usr/bin/snmpwalk $1 -Cc -v $2 -c $3 $4 | /bin/wc -l | /bin/awk '{printf$0}'
Then, changed the "Unix - Count Oids" to

Code: Select all

"bash <path_cacti>/scripts/unix_count_oids_fix.sh <ip> <ver> <comm> <oid>"
Cacti Version - 0.8.8b
CentOS 6.4
grillotron
Posts: 2
Joined: Mon Jul 18, 2016 7:41 am

Re: plugin:mikrotik - PHP escape character

Post by grillotron »

Gracias :lol: me sirvió
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests