Solved

Check_traffic.sh not working after migration

  • 14 April 2023
  • 5 replies
  • 116 views

Userlevel 1
Badge +5

Hello,

After having migrated some plugins from an old version of centreon to a new updated installation, one plugin in particular does not want to work anymore.

This one is named check_traffic.sh and is available at the following address: https://exchange.nagios.org/directory/Plugins/Network-Connections%2C-Stats-and-Bandwidth/check_traffic-2Esh/details

The error that appears is always : 

Unknown - Can not find data in the history data file. The file /var/tmp/check_traffic_**.*.*.***_*****__itnms.hist_dat_64 was deleted for a clean retry.

(The check was modified to automatically delete the .hist_dat_64 file for a clean retry)

However, this still does not work.

I specify that data are well present in the file after re-creation

 

I checked the path and file permissions but everything seems ok, I compared with my previous installation where it works but I don't see any difference.

Could one of you assist me in solving this problem please? 

Thanks in advance

icon

Best answer by christophe.niel-ACT 20 April 2023, 20:28

View original

5 replies

Userlevel 5
Badge +14

not to nitpick but the cache file is supposed to never be deleted as it will be created for each new combo of host/interface, but whatever you need, just highlighting the comment of the dev : 

so if you delete the file each time, the check does pretty much nothing, (as it need previous information to know how much traffic happened between the 2 checks)

and if the date in the history is too old it will start anew automatically

 

i’m more focus on this part from your problem : 

it seems you have 2 underscore in your file name, so you may have modified something in the scrtipt between the username and the suffix

and the original message in the code is full of english error and does not match what you pasted, you message does not appear anywhere in the original code:

 

could you please try the original file where there is not deletion, and check/diff your modification for syntax errors?

there is also a debug mode with “-v” which will make a logfile in /tmp, maybe there will be more information

Userlevel 1
Badge +5

Hello and thank you for your answer,

I took the original file and here is the error I have and the content of the target file: 

I'll look at the log file later and get back to you
thanks again

Userlevel 1
Badge +5

This is the content of the log file : 

 

For these tests, I downloaded and did not modify the check_traffic.sh file

Userlevel 1
Badge +5

I'll look at your comment about the double underscore, I actually hadn't noticed. I don't know where it comes from, I'll let you know if I find anything, thanks!

Userlevel 1
Badge +5

Thanks, I solved the problem!

The $Username variable that uses 'id --user --name' was apparently not returning a value in this one.
So I used 'whoami' and it seems to work now!

Thanks a lot for your answer, I couldn't have found it without this one! :)

 

Reply