Skip to main content

Hi ,

I know that the question is allready in topic but , I changed the howner of the file, and it doesn’t change anything :

stat /var/lib/centreon/centplugins/cache_snmpstandard_10.180.64.253_161_interfaces
 Size: 2129            Blocks: 8          IO Block: 4096   regular file
Device: fd02h/64770d Inode: 13432329 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2023-08-23 11:29:41.963775378 +0200
Modify: 2023-08-23 11:29:41.962775378 +0200
Change: 2023-08-23 11:29:41.962775378 +0200
Birth: 2023-06-23 13:00:10.271024300 +0200

So I changed howner (and group)

chown centreon-engine:centreon-engine /var/lib/centreon/centplugins/cache_snmpstandard_10.180.64.253_161_interfaces

Then stat

 

stat /var/lib/centreon/centplugins/cache_snmpstandard_10.180.64.253_161_interfaces
File: /var/lib/centreon/centplugins/cache_snmpstandard_10.180.64.253_161_interfaces
Size: 2129 Blocks: 8 IO Block: 4096 regular file
Device: fd02h/64770d Inode: 13440314 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 991/centreon-engine) Gid: ( 988/centreon-engine)
Access: 2023-08-31 09:48:43.736652070 +0200
Modify: 2023-08-31 09:48:38.259652422 +0200
Change: 2023-08-31 09:48:38.259652422 +0200
Birth: 2023-08-31 09:48:38.259652422 +0200

 

Then change user :

su centreon-engine
bash-4.4$ /usr/lib/centreon/plugins//centreon_cisco_standard_snmp.pl --plugin=network::cisco::standard::snmp::plugin

And finally =>

UNKNOWN: Cannot write statefile '/var/lib/centreon/centplugins/snmpstandard_10.180.64.253_161_interfaces_a181a603769c1f98ad927e7367c7aa51_4fd4a56c435d5c26b3c3c366f51b074e_5a1e5f7836ebffa35ded40cf7acb2b4a'. Need write permissions on file.

But =>

stat /var/lib/centreon/centplugins/cache_snmpstandard_10.180.64.253_161_interfaces
File: /var/lib/centreon/centplugins/cache_snmpstandard_10.180.64.253_161_interfaces
Size: 2129 Blocks: 8 IO Block: 4096 regular file
Device: fd02h/64770d Inode: 13440314 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 991/centreon-engine) Gid: ( 988/centreon-engine)
Access: 2023-08-31 10:03:44.449594063 +0200
Modify: 2023-08-31 10:03:37.482594512 +0200
Change: 2023-08-31 10:03:37.482594512 +0200
Birth: 2023-08-31 10:03:37.482594512 +0200

Do I have change the howner on the directory ?

hello

normally the command :  ls -l /var/lib/centreon/ will get you that, “centplugins” with a centreon:centreon ownership

and all the files in that folder are created by the engine and should be “centreon-engine:centreon-engine”

 

the most common problem is to run commands in shell root on the poller, that will create files in the cache with root:root ownership and cause problem, 

also there is not only 1 cache file per host/service, there can be multiple files, so you would need to chown for each errors.

(I usually delete everything that is root owned in this folder after debugging a check/plugin, and I always forget to su centreon-engine to run the check)

that’s most likely what happened but there may be some other issue

 

I guess you could reset that folder to make sure

chown centreon:centreon /var/lib/centreon/centplugins
chmod 775 /var/lib/centreon/centplugins
chown centreon-engine:centreon-engine /var/lib/centreon/centplugins/*
chmod 664 /var/lib/centreon/centplugins/*

(you could also delete all the files in the folder, it’s “cache” but it should not be a real problem as all plugin using cache will know how to recreate it, it’s transient data, and at most you will get some check saying “buffer in creation” for a cycle of check)

 

to verify all is ok, you could check the group membership for centreon-engine

normally centreon-engine is in the centreon group

p]# groups centreon
centreon : centreon centreon-broker centreon-engine centreon-gorgone

 


you can do:

chmod gu+w /var/lib/centreon/centplugins/cache_snmpstandard_10.180.64.253_161_interfaces

 


hello

normally the command :  ls -l /var/lib/centreon/ will get you that, “centplugins” with a centreon:centreon ownership

and all the files in that folder are created by the engine and should be “centreon-engine:centreon-engine”

 

the most common problem is to run commands in shell root on the poller, that will create files in the cache with root:root ownership and cause problem, 

also there is not only 1 cache file per host/service, there can be multiple files, so you would need to chown for each errors.

(I usually delete everything that is root owned in this folder after debugging a check/plugin, and I always forget to su centreon-engine to run the check)

that’s most likely what happened but there may be some other issue

 

I guess you could reset that folder to make sure

chown centreon:centreon /var/lib/centreon/centplugins
chmod 775 /var/lib/centreon/centplugins
chown centreon-engine:centreon-engine /var/lib/centreon/centplugins/*
chmod 664 /var/lib/centreon/centplugins/*

(you could also delete all the files in the folder, it’s “cache” but it should not be a real problem as all plugin using cache will know how to recreate it, it’s transient data, and at most you will get some check saying “buffer in creation” for a cycle of check)

 

to verify all is ok, you could check the group membership for centreon-engine

normally centreon-engine is in the centreon group

>]# groups centreon
centreon : centreon centreon-broker centreon-engine centreon-gorgone

 

Ah ok , thanks .

That the reason why, they tell us to don’t run a script as root ….

I’ve some files as root howner.

I try to find few minutes to checks all files.

Thx.


WIP ...


still in progres?


Done.

Thank you all.


Reply