Librenms codebase and cronjob

Hi everyone, my librenms operates on centos 7.
When I run ./daily.sh, everything is good except the codebase:

[root@localhost librenms]# ./daily.sh
Re-running /opt/librenms/daily.sh as librenms user
Updating to latest codebase FAIL
fatal: unable to access ‘https://github.com/librenms/librenms.git/’: Could not resolve host: github.com; Unknown error
Updating Composer packages OK
Updating SQL-Schema OK
Updating submodules OK
Cleaning up DB OK
Fetching notifications OK
Caching PeeringDB data OK

I have tried to disable firewall using systemctl disable firewalld, however the error remains. What should I do now ?

And when I run ./validate.php, there’s something wrong with the cron job.

[root@localhost librenms]# ./validate.php

====================================

Component Version
LibreNMS 1.40-22-g45f9887
DB Schema 252
PHP 7.2.6
MySQL 5.5.56-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2

====================================

[OK] Composer Version: 1.6.5
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] Discovery has never run. Check the cron job
[WARN] Your install is over 24 hours out of date, last update: Sat, 16 Jun 2018 13:32:28 +0000
[FIX] Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.

Have you followed the installation guide https://docs.librenms.org/#Installation/Installation-CentOS-7-Apache/ where SELinux is mentioned?

systemctl disable firewalld

just disables it on next boot. I think you also have to stop the ervice via
service firewalld stop

Is your server running behind another firewall?

Seems like it doesn’t have working DNS.

Yes Jarod2801, I do follow the install guide on docs.librenms.org using Nginx not Apache. But I still follow the guides in the SELinux step. I’ve tried to use service firewalld stop and restart Centos but no impact.

I have no idea if my server running behind another firewall or not. How to get that information ?

Hi murrant,
I’m still new in this field so I don’t get your point. What should I do to have working DNS ?

When you ping GitHub.com from CLI, what is the result?

Thanks Jarod2801, I can’t ping github.com at first and it turns out that the Wired Connection was off. After turning on the Wired Connection on Centos, the ./daily.sh runs smoothly:

[root@localhost librenms]# ./daily.sh
Re-running /opt/librenms/daily.sh as librenms user
Updating to latest codebase OK
Updating Composer packages OK
Updated from 45f9887 to 5af520a OK
Updating SQL-Schema OK
Updating submodules OK
Cleaning up DB OK
Fetching notifications OK
Caching PeeringDB data OK

However, when I try to ping github.com again:

[root@localhost librenms]# ping github.com
PING github.com (13.250.177.223) 56(84) bytes of data.

^C
github.com ping statistics —
1113 packets transmitted, 0 received, 100% packet loss, time 1113916ms

I’ve been waiting for 20mins but nothing happen. If you have any suggestion for this issue or the cronjob error as well, please tell me.

A little update for the cronjob error:

[root@localhost librenms]# ./validate.php

====================================

Component Version
LibreNMS 1.40-29-g5af520a
DB Schema 252
PHP 7.2.6
MySQL 5.5.56-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2

====================================

[OK] Composer Version: 1.6.5
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] Discovery has never run. Check the cron job
[root@localhost librenms]# crontab -l
no crontab for root

So I need config the cronjob base on the guide again or something else ?

Have you checked /etc/cron.d on the file librenms.
Is it in there?

Yes Jarod2801, here is the librenms profile:

[root@localhost /]# cd /etc/cron.d
[root@localhost cron.d]# ls
0hourly librenms raid-check sysstat
[root@localhost cron.d]# cat /etc/cron.d/librenms

#Using this cron file requires an additional user on your system, please see install docs.
33 */6 * * * librenms /opt/librenms/cronic /opt/librenms/discovery-wrapper.py 1
*/5 * * * * librenms /opt/librenms/discovery.php -h new >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/cronic /opt/librenms/poller-wrapper.py 16
15 0 * * * librenms /opt/librenms/daily.sh >> /dev/null 2>&1
** * * * librenms /opt/librenms/alerts.php >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/poll-billing.php >> /dev/null 2>&1
01 * * * * librenms /opt/librenms/billing-calculate.php >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/check-services.php >> /dev/null 2>&1

Is LibreNMS installed in /opt/librenms?

Can you post the logfiles of Cron?

Hi Jarod2801,
I think it was installed in opt/librenms cause I follow the installation guide on https://docs.librenms.org/#Installation/Installation-CentOS-7-Nginx/.
How to show the logfiles of Cron, where is this Cron locate at ?

Here is my log files. I’m having the same problem.

sudo tail /var/log/cron
Nov 21 11:28:01 localhost CROND[29519]: (librenms) CMD (   /opt/librenms/alerts.php >> /dev/null 2>&1)
Nov 21 11:29:01 localhost CROND[29531]: (librenms) CMD (   /opt/librenms/alerts.php >> /dev/null 2>&1)
Nov 21 11:30:01 localhost CROND[29548]: (librenms) CMD (   /opt/librenms/check-services.php >> /dev/null 2>&1)
Nov 21 11:30:01 localhost CROND[29551]: (librenms) CMD (   /opt/librenms/poll-billing.php >> /dev/null 2>&1)
Nov 21 11:30:01 localhost CROND[29552]: (librenms) CMD (   /opt/librenms/cronic /opt/librenms/poller-wrapper.py 16)
Nov 21 11:30:01 localhost CROND[29553]: (librenms) CMD (   /opt/librenms/discovery.php -h new >> /dev/null 2>&1)
Nov 21 11:30:01 localhost CROND[29550]: (librenms) CMD (   /opt/librenms/alerts.php >> /dev/null 2>&1)
Nov 21 11:31:01 localhost CROND[31912]: (librenms) CMD (   /opt/librenms/alerts.php >> /dev/null 2>&1)
Nov 21 11:32:01 localhost CROND[31980]: (librenms) CMD (   /opt/librenms/alerts.php >> /dev/null 2>&1)
Nov 21 11:33:01 localhost CROND[32010]: (librenms) CMD (   /opt/librenms/alerts.php >> /dev/null 2>&1)

What’s the output of the validate.php?

./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 1.45-59-gc5bb609
DB Schema | 271
PHP       | 7.2.10
MySQL     | 5.5.60-MariaDB
RRDTool   | 1.4.8
SNMP      | NET-SNMP 5.7.2
====================================

[OK]    Composer Version: 1.7.3
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[FAIL]  Discovery has not completed in the last 24 hours.
	[FIX]:
	Check the cron job to make sure it is running and using discovery-wrapper.py
[WARN]  Your install is over 24 hours out of date, last update: Thu, 22 Nov 2018 15:05:38 +0000
	[FIX]:
	Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.

Ok, please post the content of your cron

cat /etc/cron.d/librenms
# Using this cron file requires an additional user on your system, please see install docs.

33   */6  * * *   librenms    /opt/librenms/cronic /opt/librenms/discovery-wrapper.py 1
*/5  *    * * *   librenms    /opt/librenms/discovery.php -h new >> /dev/null 2>&1
*/5  *    * * *   librenms    /opt/librenms/cronic /opt/librenms/poller-wrapper.py 16
*    *    * * *   librenms    /opt/librenms/alerts.php >> /dev/null 2>&1
*/5  *    * * *   librenms    /opt/librenms/poll-billing.php >> /dev/null 2>&1
01   *    * * *   librenms    /opt/librenms/billing-calculate.php >> /dev/null 2>&1
*/5  *    * * *   librenms    /opt/librenms/check-services.php >> /dev/null 2>&1

# Daily maintenance script. DO NOT DISABLE!
# If you want to modify updates:
#  Switch to monthly stable release: https://docs.librenms.org/General/Releases/
#  Disable updates: https://docs.librenms.org/General/Updating/
15   0    * * *   librenms    /opt/librenms/daily.sh >> /dev/null 2>&1

I have ran the sudo ./daily.sh (all “OK” in output) and reran sudo ./validate here is the output:

====================================
Component | Version
--------- | -------
LibreNMS  | 1.45-60-g36ea8a0
DB Schema | 271
PHP       | 7.2.10
MySQL     | 5.5.60-MariaDB
RRDTool   | 1.4.8
SNMP      | NET-SNMP 5.7.2
====================================

[OK]    Composer Version: 1.7.3
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[FAIL]  Discovery has not completed in the last 24 hours.
	[FIX]:
	Check the cron job to make sure it is running and using discovery-wrapper.py