not able to create script for the below statement
I have to run in a script; I have tried, but I'm not sure how to call the shell from server.
[root@server ~]# ssh storagenode
storagenode:> shell
Executing shell commands may invalidate your service contract. Continue? (Y/N) Y
Executing raw shell; "exit" to return to appliance shell ...
+-----------------------------------------------------------------------------+
| You are entering the operating system shell. By confirming this action in |
| the appliance shell you have agreed that THIS ACTION MAY VOID ANY SUPPORT |
| AGREEMENT. If you do not agree to this -- or do not otherwise understand |
| what you are doing -- you should type "exit" at the shell prompt. EVERY |
| COMMAND THAT YOU EXECUTE HERE IS AUDITED, and support personnel may use |
| this audit trail to substantiate invalidating your support contract. The |
| operating system shell is NOT a supported mechanism for managing this |
| appliance, and COMMANDS EXECUTED HERE MAY DO IRREPARABLE HARM. |
| |
| NOTHING SHOULD BE ATTEMPTED HERE BY UNTRAINED SUPPORT PERSONNEL UNDER ANY |
| CIRCUMSTANCES. This appliance is a non-traditional operating system |
| environment, and expertise in a traditional operating system environment |
| in NO WAY constitutes training for supporting this appliance. THOSE WITH |
| EXPERTISE IN OTHER SYSTEMS -- HOWEVER SUPERFICIALLY SIMILAR -- ARE MORE |
| LIKELY TO MISTAKENLY EXECUTE OPERATIONS HERE THAT WILL DO IRREPARABLE |
| HARM. Unless you have been explicitly trained on supporting this |
| appliance via the operating system shell, you should immediately return |
| to the appliance shell. |
| |
| Type "exit" now to return to the appliance shell. |
+-----------------------------------------------------------------------------
storagenode#
storagenode# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
test 64.1T 30.5T 33.6T 47% 1.00x ONLINE -
nfs 1.09T 119G 993G 10% 1.00x ONLINE -
storagenode# exit
logout
storagenode:> exit
Connection to storagenode closed.
shell-script scripting solaris zfs
add a comment |
I have to run in a script; I have tried, but I'm not sure how to call the shell from server.
[root@server ~]# ssh storagenode
storagenode:> shell
Executing shell commands may invalidate your service contract. Continue? (Y/N) Y
Executing raw shell; "exit" to return to appliance shell ...
+-----------------------------------------------------------------------------+
| You are entering the operating system shell. By confirming this action in |
| the appliance shell you have agreed that THIS ACTION MAY VOID ANY SUPPORT |
| AGREEMENT. If you do not agree to this -- or do not otherwise understand |
| what you are doing -- you should type "exit" at the shell prompt. EVERY |
| COMMAND THAT YOU EXECUTE HERE IS AUDITED, and support personnel may use |
| this audit trail to substantiate invalidating your support contract. The |
| operating system shell is NOT a supported mechanism for managing this |
| appliance, and COMMANDS EXECUTED HERE MAY DO IRREPARABLE HARM. |
| |
| NOTHING SHOULD BE ATTEMPTED HERE BY UNTRAINED SUPPORT PERSONNEL UNDER ANY |
| CIRCUMSTANCES. This appliance is a non-traditional operating system |
| environment, and expertise in a traditional operating system environment |
| in NO WAY constitutes training for supporting this appliance. THOSE WITH |
| EXPERTISE IN OTHER SYSTEMS -- HOWEVER SUPERFICIALLY SIMILAR -- ARE MORE |
| LIKELY TO MISTAKENLY EXECUTE OPERATIONS HERE THAT WILL DO IRREPARABLE |
| HARM. Unless you have been explicitly trained on supporting this |
| appliance via the operating system shell, you should immediately return |
| to the appliance shell. |
| |
| Type "exit" now to return to the appliance shell. |
+-----------------------------------------------------------------------------
storagenode#
storagenode# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
test 64.1T 30.5T 33.6T 47% 1.00x ONLINE -
nfs 1.09T 119G 993G 10% 1.00x ONLINE -
storagenode# exit
logout
storagenode:> exit
Connection to storagenode closed.
shell-script scripting solaris zfs
what exactly do you want done, and where did your attempt fail? Apart from the verbose warning, it appears that you successfully executed a "zpool list" command.
– Jeff Schaller
55 mins ago
i have to run this from server so if utilization is cross more then 80 then i will set the alert. [root@server ~]# ssh storage shell aksh: confirmation needed for scripted command (scripted commands must be prefixed with "confirm" to automatically confirm or "deny" to automatically deny) [root@server ~]#
– pandi
48 mins ago
@pandi You seem to be working with a very specific, non-standard appliance that is covered by a support agreement. It may be more straightforward to just ask the appliance vendor for support.
– Haxiel
34 mins ago
add a comment |
I have to run in a script; I have tried, but I'm not sure how to call the shell from server.
[root@server ~]# ssh storagenode
storagenode:> shell
Executing shell commands may invalidate your service contract. Continue? (Y/N) Y
Executing raw shell; "exit" to return to appliance shell ...
+-----------------------------------------------------------------------------+
| You are entering the operating system shell. By confirming this action in |
| the appliance shell you have agreed that THIS ACTION MAY VOID ANY SUPPORT |
| AGREEMENT. If you do not agree to this -- or do not otherwise understand |
| what you are doing -- you should type "exit" at the shell prompt. EVERY |
| COMMAND THAT YOU EXECUTE HERE IS AUDITED, and support personnel may use |
| this audit trail to substantiate invalidating your support contract. The |
| operating system shell is NOT a supported mechanism for managing this |
| appliance, and COMMANDS EXECUTED HERE MAY DO IRREPARABLE HARM. |
| |
| NOTHING SHOULD BE ATTEMPTED HERE BY UNTRAINED SUPPORT PERSONNEL UNDER ANY |
| CIRCUMSTANCES. This appliance is a non-traditional operating system |
| environment, and expertise in a traditional operating system environment |
| in NO WAY constitutes training for supporting this appliance. THOSE WITH |
| EXPERTISE IN OTHER SYSTEMS -- HOWEVER SUPERFICIALLY SIMILAR -- ARE MORE |
| LIKELY TO MISTAKENLY EXECUTE OPERATIONS HERE THAT WILL DO IRREPARABLE |
| HARM. Unless you have been explicitly trained on supporting this |
| appliance via the operating system shell, you should immediately return |
| to the appliance shell. |
| |
| Type "exit" now to return to the appliance shell. |
+-----------------------------------------------------------------------------
storagenode#
storagenode# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
test 64.1T 30.5T 33.6T 47% 1.00x ONLINE -
nfs 1.09T 119G 993G 10% 1.00x ONLINE -
storagenode# exit
logout
storagenode:> exit
Connection to storagenode closed.
shell-script scripting solaris zfs
I have to run in a script; I have tried, but I'm not sure how to call the shell from server.
[root@server ~]# ssh storagenode
storagenode:> shell
Executing shell commands may invalidate your service contract. Continue? (Y/N) Y
Executing raw shell; "exit" to return to appliance shell ...
+-----------------------------------------------------------------------------+
| You are entering the operating system shell. By confirming this action in |
| the appliance shell you have agreed that THIS ACTION MAY VOID ANY SUPPORT |
| AGREEMENT. If you do not agree to this -- or do not otherwise understand |
| what you are doing -- you should type "exit" at the shell prompt. EVERY |
| COMMAND THAT YOU EXECUTE HERE IS AUDITED, and support personnel may use |
| this audit trail to substantiate invalidating your support contract. The |
| operating system shell is NOT a supported mechanism for managing this |
| appliance, and COMMANDS EXECUTED HERE MAY DO IRREPARABLE HARM. |
| |
| NOTHING SHOULD BE ATTEMPTED HERE BY UNTRAINED SUPPORT PERSONNEL UNDER ANY |
| CIRCUMSTANCES. This appliance is a non-traditional operating system |
| environment, and expertise in a traditional operating system environment |
| in NO WAY constitutes training for supporting this appliance. THOSE WITH |
| EXPERTISE IN OTHER SYSTEMS -- HOWEVER SUPERFICIALLY SIMILAR -- ARE MORE |
| LIKELY TO MISTAKENLY EXECUTE OPERATIONS HERE THAT WILL DO IRREPARABLE |
| HARM. Unless you have been explicitly trained on supporting this |
| appliance via the operating system shell, you should immediately return |
| to the appliance shell. |
| |
| Type "exit" now to return to the appliance shell. |
+-----------------------------------------------------------------------------
storagenode#
storagenode# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
test 64.1T 30.5T 33.6T 47% 1.00x ONLINE -
nfs 1.09T 119G 993G 10% 1.00x ONLINE -
storagenode# exit
logout
storagenode:> exit
Connection to storagenode closed.
shell-script scripting solaris zfs
shell-script scripting solaris zfs
edited 28 mins ago
Jeff Schaller
38.7k1053125
38.7k1053125
asked 58 mins ago
pandi
11
11
what exactly do you want done, and where did your attempt fail? Apart from the verbose warning, it appears that you successfully executed a "zpool list" command.
– Jeff Schaller
55 mins ago
i have to run this from server so if utilization is cross more then 80 then i will set the alert. [root@server ~]# ssh storage shell aksh: confirmation needed for scripted command (scripted commands must be prefixed with "confirm" to automatically confirm or "deny" to automatically deny) [root@server ~]#
– pandi
48 mins ago
@pandi You seem to be working with a very specific, non-standard appliance that is covered by a support agreement. It may be more straightforward to just ask the appliance vendor for support.
– Haxiel
34 mins ago
add a comment |
what exactly do you want done, and where did your attempt fail? Apart from the verbose warning, it appears that you successfully executed a "zpool list" command.
– Jeff Schaller
55 mins ago
i have to run this from server so if utilization is cross more then 80 then i will set the alert. [root@server ~]# ssh storage shell aksh: confirmation needed for scripted command (scripted commands must be prefixed with "confirm" to automatically confirm or "deny" to automatically deny) [root@server ~]#
– pandi
48 mins ago
@pandi You seem to be working with a very specific, non-standard appliance that is covered by a support agreement. It may be more straightforward to just ask the appliance vendor for support.
– Haxiel
34 mins ago
what exactly do you want done, and where did your attempt fail? Apart from the verbose warning, it appears that you successfully executed a "zpool list" command.
– Jeff Schaller
55 mins ago
what exactly do you want done, and where did your attempt fail? Apart from the verbose warning, it appears that you successfully executed a "zpool list" command.
– Jeff Schaller
55 mins ago
i have to run this from server so if utilization is cross more then 80 then i will set the alert. [root@server ~]# ssh storage shell aksh: confirmation needed for scripted command (scripted commands must be prefixed with "confirm" to automatically confirm or "deny" to automatically deny) [root@server ~]#
– pandi
48 mins ago
i have to run this from server so if utilization is cross more then 80 then i will set the alert. [root@server ~]# ssh storage shell aksh: confirmation needed for scripted command (scripted commands must be prefixed with "confirm" to automatically confirm or "deny" to automatically deny) [root@server ~]#
– pandi
48 mins ago
@pandi You seem to be working with a very specific, non-standard appliance that is covered by a support agreement. It may be more straightforward to just ask the appliance vendor for support.
– Haxiel
34 mins ago
@pandi You seem to be working with a very specific, non-standard appliance that is covered by a support agreement. It may be more straightforward to just ask the appliance vendor for support.
– Haxiel
34 mins ago
add a comment |
1 Answer
1
active
oldest
votes
You could use a here-document to send the four commands into the ssh
call, then use awk
to extract the information you need:
ssh storagenode << EOF | awk '/ ONLINE / { if (match($0, "[[:digit:]]+%")) if (substr($0, RSTART, RLENGTH-1) > 80) print }'
shell
Y
zpool list
exit
EOF
The outer wrapping of ssh storagenode << EOF
followed by the four commands and EOF
simply pipe those four commands into the ssh
session. The output of that ssh
session is then piped through the awk script. The awk script searches for lines that contain the string ONLINE
(as a simple indication that we're looking at zpool output), then additionally searches for the percent utilization in that line. If that utilization is greater than 80, the matching line is printed.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491326%2fnot-able-to-create-script-for-the-below-statement%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could use a here-document to send the four commands into the ssh
call, then use awk
to extract the information you need:
ssh storagenode << EOF | awk '/ ONLINE / { if (match($0, "[[:digit:]]+%")) if (substr($0, RSTART, RLENGTH-1) > 80) print }'
shell
Y
zpool list
exit
EOF
The outer wrapping of ssh storagenode << EOF
followed by the four commands and EOF
simply pipe those four commands into the ssh
session. The output of that ssh
session is then piped through the awk script. The awk script searches for lines that contain the string ONLINE
(as a simple indication that we're looking at zpool output), then additionally searches for the percent utilization in that line. If that utilization is greater than 80, the matching line is printed.
add a comment |
You could use a here-document to send the four commands into the ssh
call, then use awk
to extract the information you need:
ssh storagenode << EOF | awk '/ ONLINE / { if (match($0, "[[:digit:]]+%")) if (substr($0, RSTART, RLENGTH-1) > 80) print }'
shell
Y
zpool list
exit
EOF
The outer wrapping of ssh storagenode << EOF
followed by the four commands and EOF
simply pipe those four commands into the ssh
session. The output of that ssh
session is then piped through the awk script. The awk script searches for lines that contain the string ONLINE
(as a simple indication that we're looking at zpool output), then additionally searches for the percent utilization in that line. If that utilization is greater than 80, the matching line is printed.
add a comment |
You could use a here-document to send the four commands into the ssh
call, then use awk
to extract the information you need:
ssh storagenode << EOF | awk '/ ONLINE / { if (match($0, "[[:digit:]]+%")) if (substr($0, RSTART, RLENGTH-1) > 80) print }'
shell
Y
zpool list
exit
EOF
The outer wrapping of ssh storagenode << EOF
followed by the four commands and EOF
simply pipe those four commands into the ssh
session. The output of that ssh
session is then piped through the awk script. The awk script searches for lines that contain the string ONLINE
(as a simple indication that we're looking at zpool output), then additionally searches for the percent utilization in that line. If that utilization is greater than 80, the matching line is printed.
You could use a here-document to send the four commands into the ssh
call, then use awk
to extract the information you need:
ssh storagenode << EOF | awk '/ ONLINE / { if (match($0, "[[:digit:]]+%")) if (substr($0, RSTART, RLENGTH-1) > 80) print }'
shell
Y
zpool list
exit
EOF
The outer wrapping of ssh storagenode << EOF
followed by the four commands and EOF
simply pipe those four commands into the ssh
session. The output of that ssh
session is then piped through the awk script. The awk script searches for lines that contain the string ONLINE
(as a simple indication that we're looking at zpool output), then additionally searches for the percent utilization in that line. If that utilization is greater than 80, the matching line is printed.
answered 20 mins ago
Jeff Schaller
38.7k1053125
38.7k1053125
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491326%2fnot-able-to-create-script-for-the-below-statement%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what exactly do you want done, and where did your attempt fail? Apart from the verbose warning, it appears that you successfully executed a "zpool list" command.
– Jeff Schaller
55 mins ago
i have to run this from server so if utilization is cross more then 80 then i will set the alert. [root@server ~]# ssh storage shell aksh: confirmation needed for scripted command (scripted commands must be prefixed with "confirm" to automatically confirm or "deny" to automatically deny) [root@server ~]#
– pandi
48 mins ago
@pandi You seem to be working with a very specific, non-standard appliance that is covered by a support agreement. It may be more straightforward to just ask the appliance vendor for support.
– Haxiel
34 mins ago