Bug 54927 - mails from cron every 5 minutes if Prometheus isn't installed
mails from cron every 5 minutes if Prometheus isn't installed
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Monitoring (Prometheus or Nagios)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-2-errata
Assigned To: Florian Best
Siavash Sefid Rodi
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-07-04 09:22 CEST by Moritz Bunkus
Modified: 2022-07-06 17:03 CEST (History)
2 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): External feedback
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Bunkus 2022-07-04 09:22:54 CEST
Since installing univention-monitoring-client via automatic errata upgrades I receive one mail from cron every five minutes as I don't have Prometheus installed (and don't want it installed either) for each of my UCS nodes:

From: root@brattain.bs.linet-services.de (Cron Daemon)                                                                                                                                                                                  
Subject: Cron <root@brattain> run-parts /usr/share/univention-monitoring-client/scripts/                                                                                                                                                
To: root@brattain.bs.linet-services.de                                                                                                                                                                                                  
Date: Sun,  3 Jul 2022 17:45:03 +0200 (CEST) (15 hours, 34 minutes ago)                                                                                                                                                                 
Flags: seen                                                                                                                                                                                                                             
Maildir: /ls/admin                                                                                                                                                                                                                      
                                                                                                                                                                                                                                        
Traceback (most recent call last):                                                                                                                                                                                                      
  File "/usr/share/univention-monitoring-client/scripts//check_univention_dns", line 46, in <module>                                                                                                                                    
    DNS.main()                                                                                                                                                                                                                          
  File "/usr/lib/python3/dist-packages/univention/monitoring/__init__.py", line 73, in main                                                                                                                                             
    with open(os.path.join(NODE_EXPORTER_DIR, '%s.prom' % (plugin,)), 'w') as self._fd:                                                                                                                                                 
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/prometheus/node-exporter/check_univention_dns.prom'                                                                                                                   
run-parts: /usr/share/univention-monitoring-client/scripts//check_univention_dns exited with return code 1                                                                                                                              
Traceback (most recent call last):                                                                                                                                                                                                      
  File "/usr/share/univention-monitoring-client/scripts//check_univention_i2o_raid", line 96, in <module>                                                                                                                               
    I2O_RAIDCheck.main()                                                                                                                                                                                                                
  File "/usr/lib/python3/dist-packages/univention/monitoring/__init__.py", line 73, in main                                                                                                                                             
    with open(os.path.join(NODE_EXPORTER_DIR, '%s.prom' % (plugin,)), 'w') as self._fd:                                                                                                                                                 
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/prometheus/node-exporter/check_univention_i2o_raid.prom'                                                                                                              
run-parts: /usr/share/univention-monitoring-client/scripts//check_univention_i2o_raid exited with return code 1                                                                                                                         
Traceback (most recent call last):                                                                                                                                                                                                      
  File "/usr/share/univention-monitoring-client/scripts//check_univention_joinstatus", line 170, in <module>                                                                                                                            
    JoinStatusCheck.main()                                                                                                                                                                                                              
  File "/usr/lib/python3/dist-packages/univention/monitoring/__init__.py", line 73, in main                                                                                                                                             
    with open(os.path.join(NODE_EXPORTER_DIR, '%s.prom' % (plugin,)), 'w') as self._fd:                                                                                                                                                 
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/prometheus/node-exporter/check_univention_joinstatus.prom'                                                                                                            
…

I can deactivate those cron jobs via the UCR variable, true, but the scripts MUST check if they can actually do something & avoid creating all that spam.

After the automatic upgrades yesterday morning I've received more than 2000 of those mails.
Comment 1 Florian Best univentionstaff 2022-07-04 10:34:33 CEST
This should be fixed by doing `mkdir /var/lib/prometheus/node-exporter/` ?!
Comment 2 Florian Best univentionstaff 2022-07-05 17:33:47 CEST
The package univention-monitoring-client now ships the missing directory.

univention-monitoring-client.yaml
2939c7c000c8 | Bug #54927: prevent errors if prometheus node exporter is not installed

univention-monitoring-client (1.0.0-3)
2939c7c000c8 | Bug #54927: prevent errors if prometheus node exporter is not installed
Comment 3 Siavash Sefid Rodi univentionstaff 2022-07-06 14:00:54 CEST
Ok, Error does not occur anymore with 2939c7c000c8