Nfsen install issue - netflow

Does someone else have issues with nfsen installation on CentOS 6.7?
Every package needed is installed but I still have an error:
<i>[root#eog nfsen-1.3.8]# ./install.pl etc/nfsen.conf
Check for required Perl modules: All modules found.
Setup NfSen:
Version: 1.3.8: $Id: install.pl 71 2017-01-19 16:16:21Z peter $
Perl to use: [/usr/bin/perl]
Setup php and html files.
Copy NfSen dirs etc bin libexec plugins doc ...
Copy config file 'etc/nfsen.conf'
In directory: /data/nfsen/libexec ...
Update script: AbuseWhois.pm
Update script: Log.pm
Update script: Lookup.pm
Update script: NfAlert.pm
Update script: Nfcomm.pm
Update script: NfConf.pm
Update script: NfProfile.pm
Update script: NfSen.pm
Update script: NfSenRC.pm
Update script: NfSenRRD.pm
Update script: NfSenSim.pm
Update script: Nfsources.pm
Update script: Nfsync.pm
Update script: Notification.pm
In directory: /data/nfsen/bin ...
Update script: nfsen
Update script: nfsend
Update script: RebuildHierarchy.pl
Update script: testPlugin
Cleanup old files ...
Setup diretories:
Use UID/GID 500 48
Exists: /data/nfsen/var
Exists: /data/nfsen/var/tmp
Exists: /data/nfsen/var/run
Exists: /data/nfsen/var/filters
Exists: /data/nfsen/var/fmt
Exists: /data/nfsen/profiles-stat
Exists: /data/nfsen/profiles-stat/live
Exists: /data/nfsen/profiles-data
Exists: /data/nfsen/profiles-data/live
Profile live: spool directories:
Exists: stream1
Rename gif RRDfiles ... done.
RRD DB 'stream1.rrd' already exists!
Use existing profile info for profile 'live'
Rebuilding profile stats for './live'
Can't use string ("live") as a HASH ref while "strict refs" in use at libexec/NfProfile.pm line 1238.</i>
code of message I get when try to install nfsen from soruce....
Does anyone have an idea how to solve issue?

Try:
# ./install.pl **./**etc/nfsen.conf

Related

Where is coverage.xml located in Codecov?

I use /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml but I think the path is not correct. My report is not uploading on GitHub Actions.
Full file.
The coverage file is located at /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml. In general, it is /home/runner/work/<project>/<project>/coverage.xml.
I solved it with the following code.
- name: Generate Report
run: |
pip install codecov
pip install pytest-cov
pytest --cov=./ --cov-report=xml
codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action#v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/reports/
env_vars: OS,PYTHON
files: /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml
flags: tests
Full code is here.
From your last run, check if the "Upload coverage to CodeCov" is actually executed.
The workflow seems to stop before that, in the test with pytest step:
/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/distutils/file_util.py:44: DistutilsFileError
=========================== short test summary info ============================
FAILED tests/__main__.py::test_merge_ani - distutils.errors.DistutilsFileErro...
FAILED tests/tests.py::test_merge_ani - distutils.errors.DistutilsFileError: ...
========================= 2 failed, 30 passed in 4.23s =========================
If it does not stop before that, you need to check if the file is indeed created, considering the error message is:
None of the following appear to exist as files: ./coverage.xml

How to re-build a RPM (rpmrebuild) in non-interactive mode?

I need to re-build an RPM using rpmrebuild where I need to modify the Requires: lines in a spec file.
Commands:
rpmrebuild --edit-spec --notest-install --package <rpm-name>
Do you want to continue ? (y/N) y
result: <updated-rpm-name>
Changes in spec file:
Old Spec file generated by rpmbuild -ba <spec-file>:
Requires: python(abi) = 3.8
Once I run rpmrebuild, it opens vi editor, where I need to modify the spec file like this:
### Comment out this line
# Requires: python(abi) = 3.8
### Add this line
Requires: rh-python38
Issue
How can I do run this in non-interactive mode? In other words, I just want to run rpmrebuild without opening the file and just specify the changes in command line itself. Something like:
rpmrebuild --replace-requires --old-requires=python(abi)=3.8 --new-requires=rh-python38 <rpm-name>
I see plugins for rpmrebuild: https://www.mankier.com/1/rpmrebuild#--change-spec-requires
But I am not sure how can I use it here. Please let me know.
I figured out the solution:
We can use sed command to replace and pass it to --change-spec-requires as follows:
rpmrebuild --change-spec-requires='sed "s/Requires:.*python(abi) = 3.8/Requires: rh-python38/g"' --notest-install --package <rpm-name>
This example helped me:
batch change of version tag
rpmrebuild --change-spec-preamble='sed -e "s/^Version:.*/Version: YourVersion/"' YourPackage

gitlab-ci.yml: 'script: -pytest cannot find any tests to check'

I'm having trouble implementing a toy example that runs pytest within .gitlab-ci.yml
gitlab_ci is a repo containing a single file test_hello.py
gitlab_ci/
test_hello.py
test_hello.py
# test_hello.py
import pytest
def hello():
print("hello")
def hello_test():
assert hello() == 'hello'
.gitlab-ci.yml
# .gitlab-ci.yml
pytest:
image: python:3.6
script:
- apt-get update -q -y
- pip install pytest
- pytest # if this is removed, the job outputs 'Success'
CI/CD terminal output
$ pytest
=== test session starts ===
platform linux -- Python 3.6.9, pytest-5.2.0, py-1.8.0, pluggy-0.13.0
rootdir: /builds/kunov/gitlab_ci
collected 0 items
=== no tests ran in 0.02s ===
ERROR: Job failed: exit code 1
I'm not sure why the test did not run... pytest does not seem to recognize test_hello.py
Solution
Put the python file inside the newly creared tests folder:
gitlab_ci/
.gitlab-ci.yml
tests/
test_hello.py
Modify gitlab-ci.yml in the following manner:
# .gitlab-ci.yml
pytest:
image: python:3.6
script:
- apt-get update -q -y
- pip install pytest
- pwd
- ls -l
- export PYTHONPATH="$PYTHONPATH:."
- python -c "import sys;print(sys.path)"
- pytest
And test_hello.py would stay the same as before.
This blog post mentions a similar pipeline, but:
However, this did not work as pytest was unable to find the ‘bild’ module (ie. the source code) to test.
The problem encountered here is that the ‘bild’ module is not able to be found by the test_*.py files, as the top-level directory of the project was not being specified in the system path:
pytest:
stage: Test
script:
- pwd
- ls -l
- export PYTHONPATH="$PYTHONPATH:."
- python -c "import sys;print(sys.path)"
- pytest
The OP kunov confirms in the comments:
It works now! I put the single file inside a newly created folder called 'test'
Manipulation of the PYTHONPATH variable is considered by some to be a bad practice (see e.g., this answer on stackoverflow or this Level Up Coding post). While this is possible not a huge issue in the scope of a GitLab CI job, here is a solution based on Alberto Mardegan's comment at the mentioned blog post without the need to fiddle with PYTHONPATH (also somewhat cleaner):
pytest:
stage: Test
script:
- pwd
- ls -l
- python -m pytest
Why does this work? From the pytest docs:
You can invoke testing through the Python interpreter from the command
line:
python -m pytest [...]
This is almost equivalent to invoking the
command line script pytest [...] directly, except that calling via
python will also add the current directory to sys.path.
test_hello.py
def test_hello():#func name must start with "test_",not "hello_test"

How to force Devel::Cover to ignore a folder when using perl-helpers via Travis CI

The MetaCPAN Travis CI coverage builds are quite slow. See https://travis-ci.org/metacpan/metacpan-web/builds/238884497 This is likely in part because we're not successfully ignoring the /local folder that gets created by Carton as part of our build. See https://coveralls.io/builds/11809290
We're using perl-helpers to help with our Travis configuration. I thought I should be able to use the DEVEL_COVER_OPTIONS environment variable in order to fix this, but I guess I don't have the correct incantation. I've included the entire config below because a few snippets out of context seemed misleading.
language: perl
perl:
- "5.22"
matrix:
fast_finish: true
allow_failures:
- env: COVERAGE=1 USE_CPANFILE_SNAPSHOT=true
- env: USE_CPANFILE_SNAPSHOT=false HARNESS_VERBOSE=1
env:
global:
# Carton --deployment only works on the same version of perl
# that the snapshot was built from.
- DEPLOYMENT_PERL_VERSION=5.22
- DEVEL_COVER_OPTIONS="-ignore ^local/"
matrix:
# Get one passing run with coverage and one passing run with Test::Vars
# checks. If run together they more than double the build time.
- COVERAGE=1 USE_CPANFILE_SNAPSHOT=true
- USE_CPANFILE_SNAPSHOT=false HARNESS_VERBOSE=1
- USE_CPANFILE_SNAPSHOT=true
before_install:
- git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers
- source ~/travis-perl-helpers/init
- npm install -g less js-beautify
# Pre-install from backpan to avoid upgrade breakage.
- cpanm -n http://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/common-sense-3.6.tar.gz
- cpanm -n App::cpm Carton
install:
- cpan-install --coverage # installs converage prereqs, if enabled
- 'cpm install `test "${USE_CPANFILE_SNAPSHOT}" = "false" && echo " --resolver metadb" || echo " --resolver snapshot"`'
before_script:
- coverage-setup
script:
# Devel::Cover isn't in the cpanfile
# but if it's installed into the global dirs this should work.
- carton exec prove -lr -j$(test-jobs) t
after_success:
- coverage-report
notifications:
email:
recipients:
- olaf#seekrit.com
on_success: change
on_failure: always
irc: "irc.perl.org#metacpan-travis"
# Use newer travis infrastructure.
sudo: false
cache:
directories:
- local
The syntax for the Devel::Cover options on the command line is weird. You need to put stuff comma-separated. At least when you use PERL5OPT.
DEVEL_COVER_OPTIONS="-ignore,^local/"
See for example https://github.com/simbabque/AWS-S3/blob/master/.travis.yml#L26, where it's a whole lot of stuff with commas.
PERL5OPT=-MDevel::Cover=-ignore,"t/",+ignore,"prove",-coverage,statement,branch,condition,path,subroutine prove -lrs t

Postgis Extension install PostgreSQL

When I try to enable PostGis extension on my database I receive the following:
postgis=# CREATE EXTENSION postgis;
ERROR: could not load library "/usr/pgsql-9.3/lib/rtpostgis-2.1.so": libhdf5.so.6: cannot open shared object file: No such file or directory
I used find -name to find the files:
[root#digihaul3-pc /]# find -name rtpostgis-2.1.so
./usr/pgsql-9.3/lib/rtpostgis-2.1.so
[root#digihaul3-pc /]# find -name libhdf5.so.6
./usr/lib64/mpich2/lib/libhdf5.so.6
./usr/pgsql-9.3/lib/libhdf5.so.6
./usr/lib/mpich2/lib/libhdf5.so.6
Credit to Thinking Monkey # on this post
it is for fordora 15. But i tried everything else and this actually fixed my issue and allowed me to install the postgis extentions. Doesn't take long to install.
Thinking Monkeys Post:
Checked for whether /etc/ld.so.conf has a reference to the path /usr/lib64/mpich2/lib.
by doing ldconfig -p | grep libhdf5.
Which did not output anything.
On checking that /etc/ld.so.conf had include ld.so.conf.d/*.conf.
Checked for the files in directory ld.so.conf.d. One of the conf file in include ld.so.conf.d was /etc/ld.so.conf.d/atlas-x8664.conf which contained /usr/lib64/atlas.
So I,
created a file called gdal.conf in the directory ld.so.conf.d.
Added the string /usr/lib64/mpich2/lib to the file.
Ran ldconfig.
Now, ldconfig -p | grep libhdf5 had the paths to llibhdf5 files.
After doing the above, postgis raster support installation went smoothly.