OCSInventory-NG / UnixAgent

This is the OCS unified agent for Unix operating systems
http://www.ocsinventory-ng.org/en/
GNU General Public License v2.0
90 stars 83 forks source link

DEVICEID should be generated in other way #234

Closed mariaczi closed 4 years ago

mariaczi commented 4 years ago

General informations

Operating system : Linux OS Perl version :All perl versions

OCS Inventory informations

Unix agent version : 2.6 and probably all earlier versions

Problem's description

When we provision new servers from template with the same hostname and the same time values in crontab (HH:mm) in OCS server we will have only one new machine because the OCS server "think" that it is exactly the same machine, not next new one.

Inventory log file ( optional )

For example, for new servers with slackware OS after clean installation we will have in ocsinv.conf file in ocs cache directory:

<CONF>
  <DEVICEID>darkstar-2019-10-31-13-40-02</DEVICEID>
  <PROLOG_FREQ>24</PROLOG_FREQ>
</CONF>
mariaczi commented 4 years ago

Could we use this module https://metacpan.org/pod/distribution/Data-Uniqid/Uniqid.pm ?

fbomj commented 4 years ago

Hi, You have get some duplicates on ocs inventory web interfaces, no? Have you looked for that? Actually we don't have decided to change the deviceid. Best regards Frank

mariaczi commented 4 years ago

No, don't have duplicates on ocs inventory web interface. In logs from ocs server:

root@ocssrv:~# grep -E "192.168.229.16[6,7]" /var/log/httpd/ocs_access.log
192.168.229.167 - - [24/Nov/2019:08:39:02 +0100] "POST /ocsinventory HTTP/1.1" 401 381 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.167 - ocsagent [24/Nov/2019:08:39:02 +0100] "POST /ocsinventory HTTP/1.1" 200 240 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.167 - ocsagent [24/Nov/2019:08:39:12 +0100] "POST /ocsinventory HTTP/1.1" 200 91 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.166 - - [24/Nov/2019:08:39:27 +0100] "POST /ocsinventory HTTP/1.1" 401 381 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.166 - ocsagent [24/Nov/2019:08:39:27 +0100] "POST /ocsinventory HTTP/1.1" 200 234 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.166 - ocsagent [24/Nov/2019:08:39:37 +0100] "POST /ocsinventory HTTP/1.1" 200 91 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.167 - - [25/Nov/2019:08:39:01 +0100] "POST /ocsinventory HTTP/1.1" 401 381 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.167 - ocsagent [25/Nov/2019:08:39:01 +0100] "POST /ocsinventory HTTP/1.1" 200 234 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.167 - ocsagent [25/Nov/2019:08:39:11 +0100] "POST /ocsinventory HTTP/1.1" 200 91 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.166 - - [25/Nov/2019:08:39:27 +0100] "POST /ocsinventory HTTP/1.1" 401 381 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.166 - ocsagent [25/Nov/2019:08:39:27 +0100] "POST /ocsinventory HTTP/1.1" 200 236 "-" "OCS-NG_unified_unix_agent_v2.6.0"
192.168.229.166 - ocsagent [25/Nov/2019:08:39:37 +0100] "POST /ocsinventory HTTP/1.1" 200 91 "-" "OCS-NG_unified_unix_agent_v2.6.0"

But on OCS web interface: Selection_110

On both servers:

# grep DEVICEID /var/log/ocsinventory/ocsagent.log | uniq

returns

<DEVICEID>darkstar-2019-11-19-09-36-01</DEVICEID>

I know, that here the DEVICEID id different than when I reported this issue. Those are the two next new servers provisioned from template in the same time.

So, on web interface we have the server which communicating with ocs server as the last.

mariaczi commented 4 years ago

The other thing regarded to DEVICEID generated in current way. When we have a physical server inventoried in OCS and we want to switch it to use in other project we need to change his hostname. After this change in consequention... in OCS reports we got a new machine, but in reality it is the same as we have before. I think, that changing hostname on the server shouldn't have impact on DEVICEID (and changing crontab settings for OCS Agent too). I know that we have option to "manage duplicates" but if we need to change the IP too when changing hostname it is a little difficult to have a real-time inventoried all servers without our additional work. If we have other description regardles to each physical (inventoried) server we must do copy-paste, to this not really new server :)

fbomj commented 4 years ago

Hi,

After a team discussion deviceid will not be changed as suggested. We keep the format.

Regards

mariaczi commented 4 years ago

It is very strange in my opinion, but thanks for the info. In that situation this issue excluding OCS to using in production environment because it is not possible to have the real situation (without additional manual work) when we shift the server to other project and must change the hostname on it. In my opinion software should helps us in work not adding tasks to do.