diff --git a/README.md b/README.md
index 215cc69bbe4f663361cf8c7e2fb026cf6cdd57f8..b9188d7fe3cfc576b0f5988ec8f3fedd82ce6692 100644
--- a/README.md
+++ b/README.md
@@ -104,3 +104,7 @@ Installs the radsec plugin.
 ### `checkmk.debian.smart`
 
 Installs the [smart.stats](https://checkmk.com/cms_check_smart.stats.html) agent plugin
+
+### `checkmk.debian.remaining_library_ids`
+
+Install a small local check that asks hshifo about remaining library ids - needs to run on pgdb
diff --git a/checkmk/custom-files/local/remaining_library_ids b/checkmk/custom-files/local/remaining_library_ids
new file mode 100644
index 0000000000000000000000000000000000000000..0376a00b662b85cb7506c49537bf8ffff2d2968e
--- /dev/null
+++ b/checkmk/custom-files/local/remaining_library_ids
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+REMAINNG = $(sudo -u postgres -- psql -qtAX -d hshinfo -c "select (maximum_value::bigint - (SELECT last_value FROM hshinfo.seq_raw_library_id)) from information_schema.sequences where sequence_schema = 'hshinfo' and sequence_name = 'seq_raw_library_id';")
+
+echo "P remaining_library_ids=$REMAINING;400:;200: That many library IDs are available."
\ No newline at end of file
diff --git a/checkmk/debian/remaining_library_ids b/checkmk/debian/remaining_library_ids
new file mode 100644
index 0000000000000000000000000000000000000000..6fe076a75360c090b6a8637ce673548e26cefa0e
--- /dev/null
+++ b/checkmk/debian/remaining_library_ids
@@ -0,0 +1,7 @@
+hsh_checkmk_library_ids_local:
+  file.managed:
+    - name: /usr/lib/check_mk_agent/local/remaining_library_ids
+    - source: salt://checkmk/custom-files/local/remaining_library_ids
+    - mode: 755
+    - user: root
+    - group: root
\ No newline at end of file