Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server-Side Python Module works in CLI but not passing data to Pandora
#1
Hi all,

I have followed these instructions to a tee: https://pandorafms.com/blog/create-remot...ndora-fms/

.. to create a simple python script that print(results) of a SINGLE VALUE sql statement.

Code:
cursor = conn.cursor()
cursor.execute("SELECT DATEDIFF(SECOND, MAX(CreatedDateTime), GETDATE()) FROM Queue WHERE Status = 'Processed'")
data = cursor.fetchone()
for row in data :
       print (row[0])


Returns a simple number like so: 


Code:
[pandora] /usr/bin/python /usr/share/pandora_server/util/msgqueuelatestprocessed.py -s 10.1.x.65
4387



(4387 is the output).

I configured this in Pandora as a simple standard plugin. For testing purposes I have not used any macros and staticallly setting the IP i'm querying in the commands parameters.

I then configured a check as a plugin module using this command. I tried both generic numeric and generic string. When the check runs, I can definitely see the python script running and SQL Server trace is showing my query arriving and being answered. No errors in pandora log files. Yet the module stays uninitialised/blue and with no data.

The docs say my simple output should be piped by Pandora into the modules data field.

I verified that I can logon as the pandora user and access/execute this script as given to me in the command preview.

I feel like I'm missing something simple. Could someone advice what I could possibly be doing wrong?


Pandora FMS status info
Pandora FMS Build
PC190731
Pandora FMS Version
v7.0NG.737

Edit: DEBUG LOG Shows:


Code:
2020-02-04 05:38:45 monitor [V10] Decoding json macros from # 57433 plugin command '/usr/share/pandora_server/util/msgqueuelatestprocessed.py'
2020-02-04 05:38:45 monitor [V9] Executing AM # 57433 plugin command '/usr/share/pandora_server/util/msgqueuelatestprocessed.py -s 10.1.236.65'


Also my plugin_timeout in the UI i tried setting high excessively. I also saw this post: https://pandorafms.org/forum/thread-7088.html    but this does not apply to me. When I test the python script it comes back in less than a second and my plugin_timeout in server.conf is set to 12
 Reply
#2
Figured it out. CentOS 7. I only checked the update manager in pandoras web ui. There was an update available to me via yum (i must have it installed it via the package manager way back when). I installed it and everything started working. (No it wasn't the restart in of itself, I tried that).

Note for lurkers: if this happens to you, ur also gettnig a new websockets service to startup and you need to download "gotty" into /usr/bin for it to startup successfully. Its in the plugin library.
 Reply


Users browsing this thread: 1 Guest(s)


(c) 2006-2018 Artica Soluciones Tecnológicas. Contents of this wiki are under Create Common Attribution v3 licence. | pandorafms.com | pandorafms.org

Theme © MyBB Themes