I built a bash script for some of our Ubuntu servers to get the number of updates available and if the server needs a reboot. This way we can get them taken care of during maintenance windows without needing to log into them all and check for what is needed. The problem I have now is that I cannot figure out how to make a report for this. A web report would be great but I don't mind building something custom in SQL/SWQL if needed but I can't figure out what table keeps the data for me to reference.
This is the script I put together. It's pretty simple and less than perfect but it gets the job done.
#!/bin/bash
updates=$(cat /var/lib/update-notifier/updates-available)
echo $'Statistic.Updates: 1'
echo $'Message.Updates:' $updates
if [ -f /var/run/reboot-required ]; then echo $'Message.RestartCheck: ******Restart Required******';else echo $'Message.RestartCheck: No Restart Needed'; fi
if [ -f /var/run/reboot-required ]; then echo $'Statistic.RestartCheck: 1';else echo $'Statistic.RestartCheck: 0';fi
The app recognizes the outputs and displays the data in the web UI and even tracks the changes so I would have to think that its stored somewhere.
Anyone have any ideas?
Thank you,
Brandon