Overwriting Device Attributes (or not)

 

We have a function in the application that runs every time an attribute has data posted to it. It assigns a weight to the process that is attempting to update the data (an audit result, a user, an snmp discovery, etc).

The weights are below. In this way we only need to store one item for (for example) manufacturer. No more man_manufacturer and manufacturer. This makes for much less confusion and more easily created queries and groups.

This took affect back in 1.12.8, but is documented here for reference.

 

So, for example, if an audit result for a new device returns that the device manufacturer is Blah Company, but the user changes this in the web interface to ABC Company, the next time the audit result is processed, it will see that the user changed this field and it hence will not overwrite it.

 

case 'user':
    $weight = 1000;
    break;


case 'audit':
case 'ssh':
case 'windows':
case 'wmi':
    $weight = 2000;
    break;


case 'snmp':
    $weight = 3000;
    break;


case 'ipmi':
    $weight = 4000;
    break;


case 'ad':
    $weight = 5000;
    break;


case 'nmap':
    $weight = 6000;
    break;


default:
    $weight = 10000;
    break;