Mysql error - SQLSTATE[23000]: Integrity constraint violation

Hi everyone,

I am getting this error in librenms.log, although validate is running just fine.
Has anyone seen this before or know what the authc_status entry stands for?

Error in nac module. SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'authc_status' cannot be null (SQL: insert into `ports_nac` (`port_id`, `mac_address`, `auth_id`, `domain`, `username`, `ip_address`, `host_mode`, `authz_status`, `authz_by`, `timeout`, `time_left`, `vlan`, `authc_status`, `method`, `device_id`) values (28627, 40b034f32a83, 207C910A000001CD67E858FC, data, DOM\\user,, multiAuth, authorizationSuccess, , 0, 0, 229, ?, ?, 465))
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\Database\Connection->runQueryCallback('insert into `po...', Array, Object(Closure))
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(459): Illuminate\Database\Connection->run('insert into `po...', Array, Object(Closure))
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(411): Illuminate\Database\Connection->statement('insert into `po...', Array)
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert('insert into `po...', Array)
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2690): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `po...', Array, 'ports_nac_id')
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1353): Illuminate\Database\Query\Builder->insertGetId(Array, 'ports_nac_id')
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(839): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(804): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(667): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php(252): Illuminate\Database\Eloquent\Model->save()
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php(264): Illuminate\Database\Eloquent\Relations\HasOneOrMany->save(Object(App\Models\PortsNac))
#11 /opt/librenms/LibreNMS/Modules/Nac.php(73): Illuminate\Database\Eloquent\Relations\HasOneOrMany->saveMany(Object(Illuminate\Support\Collection))
#12 /opt/librenms/includes/polling/ LibreNMS\Modules\Nac->poll(Object(LibreNMS\OS\Iosxe))
#13 /opt/librenms/includes/polling/ include('/opt/librenms/i...')
#14 /opt/librenms/poller.php(174): poll_device(Array, false)
#15 {main} execution:

[email protected]:~$ ./
    Updating to latest codebase                        OK
    Updating Composer packages                         OK
    Updating SQL-Schema                                OK
    Updating submodules                                OK
    Cleaning up DB                                     OK
    Fetching notifications                             OK
    Caching PeeringDB data                             OK
    [email protected]:~$
sh: line 1: 12848 Killed sudo -K > /dev/null 2>&1
sh: line 1: 12932 Killed sudo -K > /dev/null 2>&1
sh: line 1: 12996 Killed sudo -K > /dev/null 2>&1
Component | Version
--------- | -------
LibreNMS | 1.61-8-g2c91724
DB Schema | 2020_02_10_223323_create_alert_location_map_table (159)
PHP | 7.2.27
MySQL | 10.4.12-MariaDB
RRDTool | 1.7.2

[OK]    Composer Version: 1.9.3
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[WARN]  Some devices have not been polled in the last 5 minutes. You may have performance issues.
        Check your poll log and see:
[FAIL]  Discovery has not completed in the last 24 hours.
        Check the cron job to make sure it is running and using
[WARN]  IPv6 is disabled on your server, you will not be able to add IPv6 devices.
[FAIL]  Some folders have incorrect file permissions, this may cause issues.
        sudo chown -R librenms:librenms /opt/librenms
        sudo setfacl -d -m g::rwx /database/rrdtool/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
        sudo chmod -R ug=rwX /database/rrdtool/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/


This seems to be related to the NAC monitoring on Cisco C9300 switches, as only this model is presenting errors. I have disabled it for now.


I have the same issue with the C9200 models.

Any suggestions?


Did you try disabling the NAC module?



:slight_smile: the idea is to use the module…Assume it’s a bug.

1048 Column ‘authc_status’ cannot be null,



I can see same error in the logs. All of our Cisco C9K switches respond to snmpwalk through the cafSessionTable of CISCO-AUTH-FRAMEWORK-MIB with “No Such Object” while the C2960X models give a proper answer with all the NAC data.

Point is that C9K do not show the OIDs under iso. where the cafSessionTable (consisting of a sequence of all the cafSessionEntry objects) is normally accessible. snmpwalk goes into
iso. 3 . = INTEGER: 1
iso. 3 . = INTEGER: 1
iso. 3 . = INTEGER: 1
iso. 3 . = INTEGER: 1
and then directly into
iso. 5 .1.0 = INTEGER: 1

So, it is missing the iso. 4 part completely.

As for that error, LibreNSM code might not properly handle the SNMP return code. It should not try to insert NULL data into the DB but consider such switch as “NAC disabled”.