Updates and uptime, cmd and playbooks etc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tl;dr There is now a command installed on batcave01 called
`updates-uptime-cmd.py` to help track which machines needs updates
and/or reboots.


 So ... I've started leading the semi-regular update/reboot outages
that happen in Fedora infra. and like any normal sysadmin person I
thought it would be a great idea to spend hours writing a script to
save me a few minutes every 2-3 months. Hopefully it'll make more than
just my life easier ;)

 The core part of it is a pretty simple ansible playbook that uses
ansible.builtin.lineinfile, after going go to all our managed hosts and
gets and stores the hostname, number of updates available, the uptime,
and the OS name/version.

Main playbook:

https://pagure.io/fedora-infra/ansible/blob/main/f/playbooks/generate-updates-uptimes-per-host-file.yml

...on it's own this is pretty useful, as you can fairly quickly look at
the file directly to see things ... but the python cmd makes it a lot
easier/prettier, and makes it much easier to see data about groups of
machines (also it will dynamically update the uptime for the non-
history data).

 Updating the data should happen automatically (like virt-list). But
all the data is viewable by anyone with login access to batcave.
 You can also copy the data to your laptop, just alter the conf_path
file to point to a dir. you copied the data from batcave to. There are
also a few config. options you can change, if you do this.

 It should be easy to setup for CentOS (or anywhere else) to do a
similar task in other environments, feel free to let me know if you did
(or had any problems -- or want features, I guess, but no promises ;).


Python cmd:

https://pagure.io/fedora-infra/ansible/blob/main/f/scripts/updates-uptime-cmd.py


 Some example commands that you will might find useful:

updates-uptime-cmd.py diff
 ... See what changed, by default between the current main data and the
last historic data that isn't identical.

updates-uptime-cmd.py history
 ... Show the history, and how it's changed (by default the last 8 days
-- including today).

updates-uptime-cmd.py list '*.stg.*'
 ... See what all the machines in staging looks like.

updates-uptime-cmd.py list '*copr*' yesterday
 ... See what all the copr machines looked like yesterday (requires
history for yesterday ;).

updates-uptime-cmd.py uptime 1d
 ... See what machines haven't been rebooted in the last 24 hours.

updates-uptime-cmd.py uptime 25w
 ... See what machines haven't been rebooted in too damn long ;)

updates-uptime-cmd.py stats 2025-08-08
 ... See statistics about all the machines, as it was last Friday
(requires history for 2025-08-08 to be available -- so four more days
on batcave).

updates-uptime-cmd.py host batcave\* all
 ... See the current state of a host(s), for each history snapshot and
the current "main" data.
-- 
_______________________________________________
infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux