Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nxos.pm reports current fan speed of device #20

Open
JamesW-AU opened this issue Dec 7, 2020 · 1 comment
Open

nxos.pm reports current fan speed of device #20

JamesW-AU opened this issue Dec 7, 2020 · 1 comment

Comments

@JamesW-AU
Copy link

I added some Cisco MDS devices running NX-OS and noticed when it runs "show environment fan" it dumps the current fan (or fans) speed, causing a diff on every run.

After some testing I've added the below to sub ShowEnv, and although it isn't as neat as the process in ShowEnvTemp it seems to work.

        if (/(fan speed)/i) {
            ProcessHistory("COMMENTS","","","!Env: $_");
            while (<$INPUT>) {
                tr/\015//d;
                goto EndShowEnv if (/^$prompt/);
                if (/(^ChassisFan)(.*)(\d\d\d\d\s\s[-]\s\s\d\d\d\d)/) {
                   $_ = sprintf("%s%-". length($2)."s%s\n", $1, $2, "");
                }
                ProcessHistory("COMMENTS","","","!Env: $_");
                last if (/^\s*$/);
            }
            next;
        }

Perhaps someone who is more skilled than me could take this and do it more cleanly? ShowEnvTemp removes the unused column text (CurTemp), although I'm not sure how.

@JamesW-AU
Copy link
Author

Output from device:

Cisco# show env fan
Fan:
-----------------------------------------------------------------------------------------------------------------
Fan             Model                Hw         Status        Airflow direction        Fan Speed[Fan0-Fan1] (rpm)
-----------------------------------------------------------------------------------------------------------------
ChassisFan1     FAN Module 1         --         Ok              Back to Front               7077  -  5268      
ChassisFan2     FAN Module 2         --         Ok              Back to Front               7133  -  5351      
ChassisFan3     FAN Module 3         --         Ok              Back to Front               7142  -  5335      
ChassisFan4     FAN Module 4         --         Ok              Back to Front               7124  -  5278      
Fan_in_PS1      --                   --         Ok              Back to Front                   --
Fan_in_PS2      --                   --         Ok              Back to Front                   --
Fan Air Filter : NotSupported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant