How to check last linux update

I would like to check last linux update date.

I see, on our linux hosts, the file /var/log/apt/history.log
that stores last date.

How could I check it inside icinga to have a service that checks last date?

Thanks a lot


you can use the apt check plugin which is provided by the Monitoring Plugins package. A template for the apt check plugin is integrated into the Icinga Template Library.

Best regards

Thanks a lot
But check_apt doesn’t return the last date, it is only to execute apt-get update etc.

I need to check the date when last update was executed (as last Windows Update date)


I’ve written an appropriate plugin since I couldn’t find one in the internet. Unfortunately, I still haven’t been able to find a person/department/process that allows me to make it public available. However, it is not that difficult and you’ll find many hints about getting desired information here.


I think for this specific use case there is no ready to use plugin out there. You have to write one yourself, but this should be straightforward.

Create a Bash script that greps the file /var/log/apt/history.log for the last End-Date entry. For example:

cat /var/log/apt/history.log | grep 'End-Date' | tail -1

Now you have the end date and can do what ever you want with it in your check plugin i.e. calcuate the days since the last update.

@rsx You are referring to Windows Update I think his question is related to the Linux apt packaging tool. Nonetheless a good link for information about Windows Update. :slight_smile:

Best regards

1 Like

Thanks, a lot!
Yes, I nees to use for linux, I already made the Windows check.

A question, which plugin could I use to calcuate the days since the last update ?

@mcktr: You are right. I was referring to:

/var/log/apt/history.log does not only contain updates. Hence, when someone have installed a new package, the last End-Date refers to that installation date.



The question is, which updates you want to check?

  • Any update of any package? Meaning: An update at all
  • A specific package?

Edit: A quick google-search offered external link: this script. It reports the last updates and the number of overall updated packages.
A quick test worked. But since it is not a monitoring-script, it would require some adjustments. Maybe it is a good starting point.


Any update

The command: cat /var/log/apt/history.log | grep ‘End-Date’ | tail -1 is good, I have to understand how to use in Icinga on remote host

  1. As @mcktr wrote, create a bash script with the suggested bash command.
  2. Save this in your plugin directory (the standard directory which is defined under /etc/icinga2/constants.conf or if exists in your custom directory).
  3. Create a check command like mentioned here:
  4. Create a new serice check like mentiond here:
1 Like

I created bash script, to check last update.

After, I will call it by check_by_ssh

The script, if could be useful.
check_linux_lastupd.txt (3.4 KB)

1 Like