snmpset -OQ -v 2c -c SNMPv2-MIB::ocStbHostRebootReset.0 i = 1
above written is the code I have executed this in putty as I have to reboot the box, so for true value, i am giving as i=1.
but I am getting below error after executing this
snmpset: Unknown host (SNMPv2-MIB::ocStbHostRebootReset.0) (No such file or directory)
The problem is that -c option is used to specify the community string not the variable to set. Also you have not specified the IP address of your device/host. Your command should look like:
snmpset -v 2c -c public 192.168.100.10 SNMPv2-MIB::ocStbHostRebootReset.0 i 1
The other thing is the ocStbHostRebootReset.0 is a part of OC-STB-HOST-MIB MIB module not the SNMPv2-MIB
Related
I am facing this error while running 'locate -S' command. Is this only executable in mlocate?
My error:
user#Ubuntu:~$ locate -S
locate: invalid option -- 'S'
Is there an alternate command, I can use?
Expected output:
user#ubuntu:~$ locate -S
Database /var/lib/plocate/plocate.db:
16,009 directories
144,928 files
7,826,392 bytes in file names
4,234,872 bytes used to store database
Thanks in anticipation.
I have to run a simple front-end app on docker with nginx.
I'm following a tutorial that says to run in order:
docker build -t mytest
docker run -v $(pwd):/mnt -p 9090:9090 -w /mnt mytest ./scripts/tests.sh
the first command is ok, the app works fine.
When I run the second one I have an error:
docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.
What is $(pwd)?
I read the doc about -v option but I don't understand the meaning of this variable.
I'm using Windows OS.
The cmd.exe equivalent to $PWD (which is what the tutorial should be recommending instead of the much less efficient $(pwd)) is %cd%
Thus:
docker run -v %cd%:/mnt -p 9090:9090 -w /mnt mytest ./scripts/tests.sh
I have a python script that reads last line of a text file (present in location /home/anas/projects) and prints it. Text file contains a single float value on each line. When i run this python script from terminal, it works fine.
The problem i am having is that i want to use this script with snmp. So i have used snmp extend and added
extend snmp-datarate /usr/bin/python2.7 /usr/local/bin/snmp-feedback.py
in /etc/snmp/snmpd.conf file. and when i run this command
snmpwalk -v2c -c public 127.0.0.1 NET-SNMP-EXTEND-MIB::nsExtendObjects
it gives me following error,
NET-SNMP-EXTEND-MIB::nsExtendOutLine."snmp-datarate".4 = STRING: OSError: [Errno 13] Permission denied: '/home/anas/projects'
Now i thought that it could eb due to use of python so i also tried shell script, named it snmp-agra-datarate.sh, which only have two lines of code
#!/bin/bash
echo $( tail -n 1 /home/anas/projects/6780-log.txt )
Running this script from terminal produces the expected output. I then extended snmp with
extend datarate /usr/local/bin/snmp-agra-datarate.sh
then when i try to run snmp walk again. i get similar error
NET-SNMP-EXTEND-MIB::nsExtendOutLine."datarate".2 = STRING: tail: cannot open '/home/anas/projects/6780-log.txt' for reading: Permission denied
Is there something i am missing in order to read external text file with python or shell for extended snmp agent?
-i am using ubuntu 16.04 LTS and net-snmp v5.8
-Both python and shell scripts have execute permissions. (i did chmod 755)
-text file also have all permissions
The error message
Permission denied: '/home/anas/projects'
is pointing to the permissions of that directory. If too restrictive,
then the snmpd cannot go in there.
To solve the problem, do a
ls -ld /home/anas/projects
and that will give you a clue.
I'm trying to run the file sh /usr/local/sbin/script.sh and assigning the stderr as parameter to $msg.
curl -k -X POST https://192.168.0.25/sims/index.php -d "option=com_user&task=sendSMSalert&msg=$(/usr/local/sbin/script.sh 2>&1)"
The above script works fine on Ubuntu but when running the same script on freenas 11, I'm getting the error:
Illegal variable name.
I then tried replacing $(/usr/local/sbin/script.sh 2>&1) with (/usr/local/sbin/script.sh), but instead of output of /usr/local/sbin/script.sh command, It's just assigning the string "/usr/local/sbin" to that parameter.
Please help me.
I have function that is sourced through the .bashrc file on remote host A.
If i use "which" on remote host A , i`m getting function body as output.
I need to run it through ssh remotely from another host B.
Currently , all my tries are ending with "command not found error".
I already tried to pass to
ssh A "source /home/user/.bashrc && function "
, this not help.
Also tried force ssh to assing pseudo-tty with -t key. SHELL on both hosts is bash.
ssh localhost on host A still keeps function status available.
Output :
[user#hostA ~]$ which status
status is a function
status ()
{
dos -s $*
}
[user#hostB ~]$ ssh hostA " source /home/user/deploy/bin/_bashrc && status all "
ls: : No such file or directory
bash: status: command not found
Basically, you can't. To do that you need to copy the sourced file on the remote host and source it in there. Note, that your file may be sourcing in some other files as well… This is almost like running local program on the remote host.
The trick is to get the remote end to properly load your file containing the function into the shell environment.
I found with bash that the following works...
Put your function into .bashrc on the remote:
foo_func()
{
echo Hello World
}
Then on the local side:
ssh user#remote bash -l -c foo_func
The bash -l instructs bash to run as a login shell (sourcing startup files) and then the -c tells the shell to execute the string foo_func.