The poller has never run or you are not using poller-wrapper.py, check the cron job

Hello,
I’ve got subj error on wrappers


LibreNMS on Ubuntu 16.04


$ /opt/librenms/cronic /opt/librenms/poller-wrapper.py 4
Cronic detected failure or error output for the command:
/opt/librenms/poller-wrapper.py 4

RESULT CODE: 1

ERROR OUTPUT:
Traceback (most recent call last):
File “/opt/librenms/poller-wrapper.py”, line 82, in
db_port = int(config[‘db_port’])
ValueError: invalid literal for int() with base 10: ‘’

STANDARD OUTPUT:


/opt/librenms/cronic /opt/librenms/discovery-wrapper.py 1
Cronic detected failure or error output for the command:
/opt/librenms/discovery-wrapper.py 1

RESULT CODE: 1

ERROR OUTPUT:
Traceback (most recent call last):
File “/opt/librenms/discovery-wrapper.py”, line 92, in
db_port = int(config[‘db_port’])
ValueError: invalid literal for int() with base 10: ‘’

STANDARD OUTPUT:

I’m new here. Thx for help.

I’ve got it.

I use socket to connect to DB

$config[‘db_host’] = ‘localhost’;
$config[‘db_port’] = ‘’;
$config[‘db_user’] = ‘librenms’;
$config[‘db_name’] = ‘librenms’;
$config[‘db_socket’] = ‘/var/run/mysqld/mysqld.sock’;

php poller works fine. I’ve just added
*/5 * * * * librenms /opt/librenms/poller.php -h all >> /dev/null 2>&1
to cron.

But python scripts need
$config[‘db_port’] = ‘3306’;
Even if socket used.

Add default value to python pollers plz.
Regards

1 Like

Why offer to use the socket if this is still an issue… just remove it then. Took me quiet some time to figure this out. Thanks for the hint!

Sometimes the difference between Python2.x and Python3.x that leads to this ValueError: invalid literal for int() with base 10 . With Python2.x , int(str(3/2)) gives you “1”. With Python3.x , the same gives you (“1.5”): ValueError: invalid literal for int() with base 10: “1.5”. You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False .

val = "10.10"
if val.isdigit():
  print(int(val))

The other way to overcome this issue is to wrap your code inside a Python try…except block to handle this error.