All Apps and Add-ons

After upgrading the NMON Performance Monitor app to v1.5.08, why am I seeing nmon_cleaner.py syntax errors?

arcdevil
Path Finder

Good day.

After upgrading to a new version of the application (1.5.08) in the log files appeared a new error message.

03-04-2015 08:01:17.077 +0300 ERROR ExecProcessor - message from "/opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.sh --cleancsv"   File "/opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.py", line 223
03-04-2015 08:01:17.077 +0300 ERROR ExecProcessor - message from "/opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.sh --cleancsv"     WORKING_DIR = {CSV_DIR, CONFIG_DIR}
03-04-2015 08:01:17.077 +0300 ERROR ExecProcessor - message from "/opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.sh --cleancsv"                           ^
03-04-2015 08:01:17.077 +0300 ERROR ExecProcessor - message from "/opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.sh --cleancsv" SyntaxError: invalid syntax
03-04-2015 08:01:17.077 +0300 ERROR ExecProcessor - message from "/opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.sh --cleancsv"     WORKING_DIR = {CSV_DIR, CONFIG_DIR}
03-04-2015 08:01:17.077 +0300 ERROR ExecProcessor - message from "/opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.sh --cleancsv"                           ^
03-04-2015 08:01:17.077 +0300 ERROR ExecProcessor - message from "/opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.sh --cleancsv" SyntaxError: invalid syntax

^ point to comma in WORKING_DIR = {CSV_DIR, CONFIG_DIR}
0 Karma
1 Solution

guilmxm
Influencer

This is the problem, the nmon_cleaner.py requires a Python 2.7.x interpreter.
What i could do is modifying the nmon_cleaner.sh to automatically choose the Perl version if the Python version available is not at least Python 2.7.x

Can you can check if running the Perl version works with no issue in your host: (with the same user that is running the UF)

/opt/splunkforwarder/bin/splunk cmd /opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.pl

View solution in original post

dangtran
Explorer

I have samve issue, But i did fixed it. Pls do it as below here
yum install perl-Time-HiRes
thanks

0 Karma

guilmxm
Influencer

This is the problem, the nmon_cleaner.py requires a Python 2.7.x interpreter.
What i could do is modifying the nmon_cleaner.sh to automatically choose the Perl version if the Python version available is not at least Python 2.7.x

Can you can check if running the Perl version works with no issue in your host: (with the same user that is running the UF)

/opt/splunkforwarder/bin/splunk cmd /opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.pl

arcdevil
Path Finder

After installing cpan + install Time::HiRes

Wed Mar 4 13:06:18 2015 Starting nmon cleaning:
Splunk Root Directory /opt/splunkforwarder nmon_cleaner version: 1.1.0 Perl version: 5.010001
No files found in directory: /opt/splunkforwarder/etc/apps/TA-nmon/var/nmon_repository/*.nmon, no action required.
Elapsed time was: 0.0004 seconds

0 Karma

guilmxm
Influencer

Right,

Currently what you do is deactivation the nmon_helper.sh input script and activating the Perl version (but you will need to install required Perl modules if you have other Linux hosts with missing modules)

In your local/inputs.conf:

[script://./bin/nmon_cleaner.sh --cleancsv]
disabled = true

[script://./bin/nmon_cleaner.pl --cleancsv]
disabled = false
index = nmon
interval = 600
source = nmon_cleaner
sourcetype = nmon_clean

I will try to find a solution for such old Linux hosts

0 Karma

arcdevil
Path Finder

Thank you, guilmxm.
But host is not so old 🙂

[root@test-server-linux ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)

0 Karma

guilmxm
Influencer

Hi,

If this is fine for you, could mark this subject as answered please ?

0 Karma

arcdevil
Path Finder

Ok. We found workaround. 🙂
Plz convert to answer your comment.

0 Karma

ppablo
Retired

Hi @arcdevil

I just converted the comment to an answer. If @guilmxm's workaround solved your question, be sure to accept his answer. If you found your own workaround, can you please share that here for @guilmxm and other users to see?

0 Karma

guilmxm
Influencer

yeah not that old 🙂

0 Karma

arcdevil
Path Finder

After executing command:

[root@test-server-linux ~]# /opt/splunkforwarder/bin/splunk cmd /opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.pl
Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.pl line 17.
BEGIN failed--compilation aborted at /opt/splunkforwarder/etc/apps/TA-nmon/bin/nmon_cleaner.pl line 17.
[root@test-server-linux ~]# perl --version

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

0 Karma

guilmxm
Influencer

Hi,

I am checking this.

Could you please verify which Python version is available on that Linux host ? run: python --version

0 Karma

arcdevil
Path Finder

Hi.
Python 2.6.6

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...