• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Let's make scripts!

Scheduled Pinned Locked Moved
FOG Problems
8
32
14.2k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W
    Wayne Workman
    last edited by Wayne Workman Oct 26, 2015, 10:14 PM Mar 6, 2015, 7:45 PM

    I would like to suggest making troubleshooting scripts for every major flavor of Linux, for FOG troubleshooting.

    The scripts should test every relevant service, maybe run basic diagnostics on those services… The scripts could even pull data from configuration files, and definitely the FOG install log.

    All the scripts should put all output into a single text file, for FOG users to post here.

    This should expedite trouble shooting, because we can say, Here, run this script, give us the output (or they themselves use it as a troubleshooting tool).

    We should make a WiKi section just for these.


    EDIT

    This project has been converted into a SourceForge project.

    Here is how you can get it:

    svn checkout svn://svn.code.sf.net/p/fog-troubleshoot-script/svn/ /svn/fog-troubleshoot-script
    

    Here’s a link to the project: https://sourceforge.net/projects/fog-troubleshoot-script/

    Many many thanks to everyone that was involved with improving this script. Hopefully people will continue to collaborate and help to improve this FOG side project. If you would like commit access, just ask me or @Tom-Elliott

    1 Reply Last reply Reply Quote 0
    • W
      Wayne Workman
      last edited by Mar 6, 2015, 9:28 PM

      This post is deleted!
      1 Reply Last reply Reply Quote 0
      • S
        Sebastian Roth Moderator
        last edited by Mar 7, 2015, 1:34 PM

        I quite like the idea but I am wondering if it’s worth the effort to create those scripts?! Most problems are very special and some involve switch configurations, DHCP settings on external (windows) servers and possibly other clients are needed to check boot menu via HTTP or NFS mounts.
        But feel free to start scripting and we’ll jump in as things get rolling. What do you think?!

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • W
          Wayne Workman
          last edited by Mar 9, 2015, 12:22 PM

          [quote=“Uncle Frank, post: 43426, member: 28116”]I quite like the idea but I am wondering if it’s worth the effort to create those scripts?! Most problems are very special and some involve switch configurations, DHCP settings on external (windows) servers and possibly other clients are needed to check boot menu via HTTP or NFS mounts.
          But feel free to start scripting and we’ll jump in as things get rolling. What do you think?![/quote]

          It’s a good opportunity to learn something about Linux scripting.

          The first one will be on Fedora 21. 🙂

          I’m going to rely heavily on the forum to figure out all the commands that need ran.

          1 Reply Last reply Reply Quote 0
          • W
            Wayne Workman
            last edited by Mar 11, 2015, 2:59 AM

            This is my first bash script ever, was really fun.

            The idea behind having scripts like this is for language barriers and people new to Linux.

            And, just a general starting point for troubleshooting.

            [CODE]
            echo ‘----------------------Fedora version below’
            cat /etc/issue >> /tmp/Fedora21Fog.txt
            echo ‘----------------------Installation log below’
            cat /var/log/foginstall.log >> /tmp/Fedora21Fog.txt
            echo ‘----------------------Apache Error log below’
            cat /var/log/httpd/error_log >> /tmp/Fedora21Fog.txt
            echo ‘----------------------TFTP Status below’
            systemctl status xinetd.service >> /tmp/Fedora21Fog.txt
            echo ‘----------------------RPC Status below’
            systemctl status rpcbind >> /tmp/Fedora21Fog.txt
            echo ‘----------------------NFS Status below’
            systemctl status nfs-server >> /tmp/Fedora21Fog.txt
            echo ‘----------------------FTP Status below’
            systemctl status vsftpd.service >> /tmp/Fedora21Fog.txt
            echo ‘----------------------Firewall Status below’
            systemctl status firewalld.service >> /tmp/Fedora21Fog.txt
            echo ‘----------------------SELinux Status below’
            sestatus >> /tmp/Fedora21Fog.txt
            echo ‘----------------------FOGMulticastManager Status below’
            systemctl status FOGMulticastManager.service >> /tmp/Fedora21Fog.txt
            echo ‘----------------------FOGImageReplicator Status below’
            systemctl status FOGImageReplicator.service >> /tmp/Fedora21Fog.txt
            echo ‘----------------------FOGSnapinReplicator Status below’
            systemctl status FOGSnapinReplicator.service >> /tmp/Fedora21Fog.txt
            echo ‘----------------------FOGScheduler Status below’
            systemctl status FOGScheduler.service >> /tmp/Fedora21Fog.txt
            echo ‘----------------------/etc/dnsmasq.d/ltsp.conf file below’
            cat /etc/dnsmasq.d/ltsp.conf >> /tmp/Fedora21Fog.txt
            echo ‘----------------------/etc/vsftpd/vsftpd.conf file below’
            cat /etc/vsftpd/vsftpd.conf >> /tmp/Fedora21Fog.txt
            echo ‘----------------------/etc/rc.d/rc.local file below’
            cat /etc/rc.d/rc.local >> /tmp/Fedora21Fog.txt
            echo ‘----------------------Check for /images/.mntcheck’
            ls /images -a |grep “mntcheck” >> /tmp/Fedora21Fog.txt
            echo ‘----------------------Check for /images/dev/.mntcheck’
            ls /images/dev -a |grep “mntcheck” >> /tmp/Fedora21Fog.txt
            echo ‘----------------------Contents of /opt/fog_trunk/packages/tftp’
            ls /opt/fog_trunk/packages/tftp >> /tmp/Fedora21Fog.txt
            [/CODE]

            1 Reply Last reply Reply Quote 0
            • J
              Joe Schmitt Senior Developer
              last edited by Mar 11, 2015, 6:24 PM

              I’m just going to throw my 2 cents in here. I think what you guys are doing is fantastic. It may be best to outline what debugging information is vital for us, and build the scripts off that. What you’ve posted is great, but I’d like to see a ‘standard’ for the scripts, a list of what information and in what format. That way you/we can build scripts for all platforms that output the same information in the same format.

              If these scripts gain some ground, we could even include them in the repository.

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              1 Reply Last reply Reply Quote 0
              • W
                Wayne Workman
                last edited by Mar 11, 2015, 7:07 PM

                I agree wholesomely.

                So,

                if the commands differ for a different distribution, we can just include all the commands, right?

                The ones that don’t work will just error out.

                I’ll see what I can throw together.

                1 Reply Last reply Reply Quote 0
                • J
                  Joseph Hales Testers
                  last edited by Mar 11, 2015, 8:51 PM

                  I second that emotion 😉 Most of what I do at this point is google and cut and paste to my command line while I am learning a lot as I go along it is a very steep learning curve and this would go a long way to helping you guys who have been so very helpful better understand what the hell we did to our servers this time.

                  RTFM

                  1 Reply Last reply Reply Quote 0
                  • W
                    Wayne Workman
                    last edited by Apr 16, 2015, 2:13 AM

                    Following up on this, I THINK I have the Fedora 21 portion completed…
                    You will find the file attached, along with the output as well (because it’s really long).

                    Ideally, the command groups will go to their designated OS output file.
                    For example, I’ve got Fedora 21 command output going to /tmp/Fedora21Fog.txt
                    Ubuntu could be /tmp/UbuntuX.xFog.txt or something.

                    If at all possible, I’d really like some help to convert all of these commands to Ubuntu equivalents, and eventually other OSs too.

                    Opinions/thoughts/contributions welcome and wanted.

                    [url=“/_imported_xf_attachments/1/1874_Script.zip?:”]Script.zip[/url]

                    1 Reply Last reply Reply Quote 0
                    • cmlC
                      cml Moderator
                      last edited by Apr 16, 2015, 5:41 PM

                      Hacked one together for Debian which may cover Ubuntu as well. I am not sure on the DHCP status and config portion, but I will set up a server to test tonight.

                      [url=“/_imported_xf_attachments/1/1887_DebianScript.zip?:”]DebianScript.zip[/url]

                      1 Reply Last reply Reply Quote 0
                      • ch3iC
                        ch3i Moderator
                        last edited by Apr 17, 2015, 9:59 AM

                        Hi,

                        You can create a single script for each version using uname like this :
                        [CODE]DISTRIB_NAME=($(uname -v | grep -w -o “Debian|Ubuntu|Redhat|Fedora”)) # add other redhat/debian based

                        if [ “$DISTRIB_NAME” == “Debian” ] || [ “$DISTRIB_NAME” == “Ubuntu” ] || [ “$DISTRIB_NAME” == “Other_Debian_Based” ]
                        then
                        your instructions here;
                        elif [ “$DISTRIB_NAME” == “Fedora” ] || [ “$DISTRIB_NAME” == “Redhat” ] || [ “$DISTRIB_NAME” == “Other_Redhat_Based” ]
                        then
                        your instructions here;
                        fi[/CODE]

                        Regards,
                        Ch3i.

                        1 Reply Last reply Reply Quote 0
                        • cmlC
                          cml Moderator
                          last edited by Apr 17, 2015, 12:44 PM

                          Pulled code from the FOG installer scripts to come up with the combination. I left Arch commented out at the end of the script if anyone wants to give a go at it. If not I can after testing completes next week.

                          [url=“/_imported_xf_attachments/1/1891_FogScript.zip?:”]FogScript.zip[/url]

                          1 Reply Last reply Reply Quote 0
                          • W
                            Wayne Workman
                            last edited by Apr 21, 2015, 3:32 AM

                            [quote=“cml, post: 45691, member: 28688”]cml[/quote]
                            Thank you for the logic, it’s exactly what was needed!

                            [quote=“ch3i, post: 45671, member: 2513”]Ch3i.[/quote]
                            Thanks for taking the time to convert the commands to Debian, and putting together all the code.

                            I’ve made a few small changes - mostly to simplify things a bit more.

                            I’ve changed the output path to whatever directory it’s run from.
                            I also changed the Fedora output from “Fedora21Fog.txt” to just “FedoraFog.txt”
                            I changed the name of the file to simply “troubleshoot.sh” for simplicity and obviousness.

                            It works beautifully on Fedora 21.

                            If anyone can think of anything else that should be included in the checks, suggestions are welcome.
                            If someone can test the Debian portions to see if they work on Ubuntu, that’d be great because Ubuntu is the most used distro for FOG.
                            And, as we can, get people to continue adding to the script for other distros of Linux.

                            Before you know it, we will have a one-stop-shop for information collection to aid in troubleshooting - be it here on the forums, or to help people with a starting place so they can help themselves.

                            The latest script is attached.

                            [B]OSs covered so far:[/B]
                            Fedora 20/21
                            Debian

                            [url=“/_imported_xf_attachments/1/1902_troubleshoot.zip?:”]troubleshoot.zip[/url]

                            1 Reply Last reply Reply Quote 0
                            • cmlC
                              cml Moderator
                              last edited by Apr 21, 2015, 2:13 PM

                              Few changes.

                              Ubuntu had to be run with sudo, so added a root check to the beginning of the file.
                              Ubuntu also has UFW as a firewall, added a check for that.
                              Changed the Debian/Ubuntu version check to ‘lsb_release -a’ to get more information.
                              Pointed the log file to a variable that is $Distro-Fog.txt
                              The script now overwrites the log if ran again.

                              Script and Debian/Ubuntu logs attached.

                              [url=“/_imported_xf_attachments/1/1907_troubleshoot.zip?:”]troubleshoot.zip[/url]

                              1 Reply Last reply Reply Quote 0
                              • W
                                Wayne Workman
                                last edited by Apr 21, 2015, 11:44 PM

                                Tom helped with a command to convert the output file to windows-friendly text. I’ve added this at the very bottom of the script.

                                Latest and greatest is attached.

                                [url=“/_imported_xf_attachments/1/1910_troubleshoot.zip?:”]troubleshoot.zip[/url]

                                1 Reply Last reply Reply Quote 0
                                • Tom ElliottT
                                  Tom Elliott
                                  last edited by Apr 22, 2015, 12:46 AM

                                  Here’s a more refined version. This particular should work on CentOS/Redhat (in general e.g. 5,6,7) and Fedora.

                                  It also prints that the file is complete and where it can be located.

                                  [url=“/_imported_xf_attachments/1/1911_troubleshoot.zip?:”]troubleshoot.zip[/url]

                                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                  Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                  Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                  1 Reply Last reply Reply Quote 0
                                  • Tom ElliottT
                                    Tom Elliott
                                    last edited by Tom Elliott May 30, 2015, 7:46 PM Apr 24, 2015, 1:21 AM

                                    Here’s slightly more refined. Log items are somewhat nice now (more informative). Theres also a lot more checking.

                                    troubleshoot.zip

                                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                                    Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                                    Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                                    1 Reply Last reply Reply Quote 0
                                    • W
                                      Wayne Workman
                                      last edited by Apr 24, 2015, 1:41 AM

                                      Now that’s awesome. This is going to be a major help for troubleshooting!

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        Joseph Hales Testers
                                        last edited by May 6, 2015, 9:06 PM

                                        Can we sticky this and add to the wikki.

                                        RTFM

                                        1 Reply Last reply Reply Quote 0
                                        • J
                                          Joseph Hales Testers
                                          last edited by May 6, 2015, 9:11 PM

                                          When I ran the latest version in this thread I got the following output in terminal.
                                          ./troubleshoot.sh: line 19: [: : integer expression expected
                                          rpcbind: unrecognized service
                                          nfs: unrecognized service
                                          iptables: unrecognized service
                                          Usage FOGMulticastManager {start|stop|restart}
                                          Usage FOGSnapinReplicator {start|stop|restart}
                                          Usage FOGImageReplicator {start|stop|restart}
                                          Usage FOGScheduler {start|stop|restart}
                                          Script Completed Wed May 6 16:10:25 CDT 2015
                                          Your logfile can be found in /home/jhales/test/FOGtroubleshoot.log

                                          [url=“/_imported_xf_attachments/1/1977_FOGtroubleshoot.log.txt?:”]FOGtroubleshoot.log.txt[/url]

                                          RTFM

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 2 / 2
                                          • First post
                                            Last post

                                          229

                                          Online

                                          12.0k

                                          Users

                                          17.3k

                                          Topics

                                          155.2k

                                          Posts
                                          Copyright © 2012-2024 FOG Project