I'm trying to use Indy SNMP component but is having problems
The following code
try
{
TIdSNMP* client = new TIdSNMP();
String host = "192.168.123.123";
String mib = "1.3.6.1.2.1.1.5.0";
Log(lInfo) << "Test simple SNMP call on server: " << host;
client->Host = host;
client->BoundIP = "192.168.123.1";
client->Community = "public";
client->ReceiveTimeout = 1000;
client->Query->Clear();
client->Query->PDUType = PDUGetRequest;
client->Query->MIBAdd(mib,"");
if (client->SendQuery())
//...
}
else
{
Log(lInfo) << "*** Query not sent *** ";
}
delete client;
}
catch (const Exception & ex)
{
Log(lInfo) << Mylog(L"ERROR [%s] ", ex.Message.c_str());
}
keep returning false on the SendQuery line, while using the snmpget client in a terminal gives proper result
>/Users/matsk:\> snmpget -v 2c -c public 192.168.123.123 1.3.6.1.2.1.1.5.0
SNMPv2-MIB::sysName.0 = STRING: Watchdog 15
where
SNMPv2-MIB::sysName.0 = STRING: Watchdog 15
is an expected return string from a temperature measuring device.
Or using version 1
>/Users/matsk:\> snmpget -v 1 -c public 192.168.123.123 1.3.6.1.2.1.1.5.0
SNMPv2-MIB::sysName.0 = STRING: Watchdog 15
I should add to the question that the device is connected to the local computer using a Ethernet -> USB dongle and is on a different 'subnet' than my regular internet connection. I'm not sure if that may add to Indy's behavior?
Doing a ipconfig /all gives for the relevant ethernet adapter, as suggested by Remy L.
Ethernet adapter Ethernet 2:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Linksys USB3GIGV1
Physical Address. . . . . . . . . : 94-10-3E-B7-D7-0A
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::bc9f:3659:9f91:2627%24(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.123.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 412356670
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-70-32-91-D8-CB-8A-BC-E5-B
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
from where I used BoundIP = 192.168.123.1
However, SendQuery() still returns false.
I copied some code from this post:
Indi TIdSNMP : How use SendQuery
Using Wireshark and a filter gives one line
63 47.723731 192.168.123.1 192.168.123.123 SNMP 82 get-request 1.3.6.1.2.1.1.5.0
Interestingly, when using snmpget I get
476 182.830210 192.168.123.1 192.168.123.123 SNMP 83 get-request 1.3.6.1.2.1.1.5.0
Only difference is that the Length record is being 83, instead of 82 for the request using Indy. Not sure if that helps figuring out whats going on?
Related
Trying to get collectd-5.12.0 work with DPDK 21.11
I followed the docs https://github.com/collectd/collectd/blob/main/docs/BUILD.dpdkstat.md to install collected with custom dpdk installation folder.
pkg-config --libs libdpdk
-Wl,--as-needed -L//lib64 -lrte_node -lrte_graph -lrte_flow_classify -lrte_pipeline -lrte_table -lrte_pdump -lrte_port -lrte_fib -lrte_ipsec -lrte_vhost -lrte_stack -lrte_security -lrte_sched -lrte_reorder -lrte_rib -lrte_dmadev -lrte_regexdev -lrte_rawdev -lrte_power -lrte_pcapng -lrte_member -lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats -lrte_ip_frag -lrte_gso -lrte_gro -lrte_gpudev -lrte_eventdev -lrte_efd -lrte_distributor -lrte_cryptodev -lrte_compressdev -lrte_cfgfile -lrte_bpf -lrte_bitratestats -lrte_bbdev -lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_cmdline -lrte_pci -lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_rcu -lrte_ring -lrte_eal -lrte_telemetry -lrte_kvargs
./configure LIBDPDK_LDFLAGS="-L/root/dpdk-21.11/x86_64-native-linuxapp-gcc/lib64" LIBDPDK_CPPFLAGS="-I/root/dpdk-21.11/x86_64-native-linuxapp-gcc/include"
However, it's still not being picked up by collected.
Am I missing anything ?
Libraries:
libdpdk . . . . . . . no (symbol 'rte_eal_init' not found)
Modules:
dpdkevents. . . . . . no
dpdkstat . . . . . . no
dpdk_telemetry. . . . no
Worked after installing jansson-devel
Steps followed :
1. ./configure LIBDPDK_LDFLAGS="-L/usr/lib64/" LIBDPDK_CPPFLAGS="-I/root/dpdk-21.11/x86_64-native-linuxapp-gcc/include"
2. yum install jansson-devel
Modules:
dpdkevents. . . . . . yes
dpdkstat . . . . . . yes
dpdk_telemetry. . . . yes
I have successfully created a Google Kubernetes Engine (GKE) cluster ($GKE_CLUSTER_NAME) inside of a Google Cloud Platform (GCP) project ($GCP_PROJECT_NAME):
gcloud container clusters list \
--format="value(name)" \
--project=$GCP_PROJECT_NAME
#=>
. . .
$GKE_CLUSTER_NAME
. . .
which uses the node pool $GKE_NODE_POOL:
gcloud container node-pools list \
--cluster=$GKE_CLUSTER_NAME \
--format="value(name)" \
--zone=$GKE_CLUSTER_ZONE
#=>
$GKE_NODE_POOL
I am checking this config. into SCM using Terraform with the following container_node_pool.tf:
resource "google_container_node_pool" ". . ." {
autoscaling {
max_node_count = "3"
min_node_count = "3"
}
. . .
initial_node_count = "3"
. . .
}
and I confirmed that the Terraform configuration above matched $GKE_NODE_POOL running currently inside of $GKE_CLUSTER_NAME and $GCP_PROJECT_NAME:
terraform plan
#=>
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
If I want to make a change to $GKE_NODE_POOL:
resource "google_container_node_pool" ". . ." {
autoscaling {
max_node_count = "4"
min_node_count = "4"
}
. . .
initial_node_count = "4"
. . .
}
and scale the number of nodes in $GKE_NODE_POOL from 3 to 4, I get the following output when trying to plan:
terraform plan
#=>
. . .
Plan: 1 to add, 0 to change, 1 to destroy.
. . .
How can I update $GKE_NODE_POOL without destroying and then recreating the resource?
Changing the initial_node_count argument for any google_container_node_pool will trigger destruction and recreation. Just don't modify initial_node_count and you should be able to modify $GKE_NODE_POOL arguments such as min_node_count and max_node_count.
The output of the plan command should explicitly show you which argument causes destruction and recreation behavior [in red]:
terraform plan
. . .
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# google_container_node_pool.$GKE_NODE_POOL must be replaced
-/+ resource "google_container_node_pool" ". . ." {
. . .
~ initial_node_count = 3 -> 4 # forces replacement
. . .
Plan: 1 to add, 0 to change, 1 to destroy.
. . .
The initial_node_count argument seems to be the only argument for google_container_node_pool that causes this behavior; the initial_node_count argument also appears to be optional.
You can read this warning in the official documentation here.
I have this code that updates the sql table to the files url´s when it´s backuped to amazon s3.
$sql = "update " . PVS_DB_PREFIX . "filestorage_files set filename1='" . $file .
"',filename2='" . $new_filename . "',url='" . $url[0] .
"',filesize=" . filesize( $publication_path .
"/" . $file ) . ",width=" . $width . ",height=" . $height .
" where id_parent=" .
$rs->row["id"] . " and item_id=" . $items_mass[$file];
$db->execute( $sql );
Then i delete from local server the files that was moved to amazon s3 by:
//delete files from the local server
for ( $i = 0; $i < count( $delete_mass ); $i++ ) {
pvs_delete_files( ( int )$delete_mass[$i], false );
}
Now the files are on the Database with the Amazon S3 url but, i need it to be served on the front by Amazon CloudFront, so i will need to update da sql table again to update de url´s from the files moved to Amazon S3 by:
//cloud front update url on tumbs preview
$sql = "update " . PVS_DB_PREFIX .
"filestorage_files set url='http://www.cloudfront.com/exmaple' item_id=" .
$items_mass[$file] == 0;
$db->execute( $sql );
But... something here is not working right, can any one help me with this ?
Regard´s
Actually the last part of your question not clear, but you should deploy a Cloudfront and set your S3 bucket as the origin. Finally, you have a unique URL for your published Cloudfront, and you can quickly add your file name after the main URL.
I am using opencart version : 2.0.1.1. having one product name : AKU SABLJASTA ŽAGA Stanley
google base feed url is:
mysite.com/index.php?route=feed/google_base
the issue is when I check the browser it displays like:
AKU SABLJASTA ŽAGA Stanley
you can see that Ž is replaced with Ĺ˝.
I know there must be some charset changes required. the line is coming from:
catalog/controller/feed/google_base.php
Line 23: $output .= '<title>' . $product['name'] . '</title>';
any idea how to fix this?
Try this:
$output .= '<title>' . iconv(mb_detect_encoding($product['name'], mb_detect_order(), true), "UTF-8", $product['name']) . '</title>';
It detects the encoding and then convert it to UTF-8.
You must have iconv & mbstring extensions enabled in your php installation.
Does anyone know if there is a way to force CakePHP TestSuite to view the Expected and Result values of an assertion when it fails? Typical PHPUnit tests are showing it by default in the output but not Cake's TestSuite (which uses PHPUnit). A side from that, when i debug a test case in NetBeans i get some kind of Socket Exception whenever i try to set a watch for a variable, and it only happens in CakePHP test cases, it works fine in evry other source file. Is there a solution for this aswell?
check out
http://www.dereuromark.de/2011/12/04/unit-testing-tips-for-2-0-and-phpunit/
basically, you can extend the TestCase class and make your own additional methods like
public function details($is, $expected) {
echo 'is:' . $is; echo '<br />';
echo 'expected: ' . $expected; ob_flush();
}
and call it internally or sth on fail.
or you just debug() everywhere.
Ok I somehow worked it out tho the solution will be wiped when u update the Cake Library files. You need to edit the file lib\Cake\TestSuite\Reporter\CakeHtmlReporter and change the method:
public function paintFail($message, $test)
{
$trace = $this->_getStackTrace($message);
$testName = get_class($test) . '(' . $test->getName() . ')';
echo "<li class='fail'>\n";
echo "<span>Failed</span>";
echo "<div class='msg'><pre>" . $this->_htmlEntities($message) . "</pre></div>\n";
echo "<div class='msg'>" . __d('cake_dev', 'Test case: %s', $testName) . "</div>\n";
echo "<div class='msg'>" . __d('cake_dev', 'Stack trace:') . '<br />' . $trace . "</div>\n";
echo "</li>\n";
}
to:
public function paintFail($message, $test) {
$trace = $this->_getStackTrace($message);
$testName = get_class($test) . '(' . $test->getName() . ')';
echo "<li class='fail'>\n";
echo "<span>Failed</span>";
echo "<div class='msg'><pre>" . $this->_htmlEntities($message->getComparisonFailure()->toString()) . "</pre></div>\n";
echo "<div class='msg'>" . __d('cake_dev', 'Test case: %s', $testName) . "</div>\n";
echo "<div class='msg'>" . __d('cake_dev', 'Stack trace:') . '<br />' . $trace . "</div>\n";
echo "</li>\n";
}
And this will output you something like this when the assertion fails:
Failed asserting that two arrays are equal.--- Expected
+++ Actual
## ##
Array (
- 0 => 'Crypto3DS'
- 1 => 'Zlib'
+ 1 => 'Crypto3DS'
+ 2 => 'Zlib'
)
Faster testing in Cake Yeppie :D