redis:
kubectl exec -it redismaster-7c4fd4b855-85kvv /bin/bash
cd ~
Sh ma.sh
keys ip*
SMEMBERS ip192.167.1.103
hget res2ip7 restypeid
hgetall res2ip7
smembers resId
es:
kubectl edit statefulset elasticsearch-data-3
[root@matrix2 ~]# kubectl exec -it elasticsearch-master-1 /bin/bash
[root@elasticsearch-master-1 elasticsearch]# curl 'elasticsearch-http-service:9200/_cat/indices?v'
curl '177.177.23.194:9200/_cat/nodes?v'
curl -XDELETE '177.177.23.194:9200/trapdata-2020.10.27?pretty'
查看資料
curl 'http://elasticsearch-http-service:9200/trapdata-2020.05.31,trapdata-2020.06.01/_search?pretty=true'
查看模板
curl 'elasticsearch-http-service:9200/_template/monitor?pretty'
PUT apievent_20190619/_settings
{
"index.mapping.total_fields.limit": 2000
}
或
curl -XPUT "elasticsearch-http-service:9200/trapdata-2020.09.25/_settings" -H 'Content-Type: application/json' -d'
{
"index.mapping.total_fields.limit": 2000
}'
來自 <https://blog.csdn.net/maligebazi/article/details/103539710>
tcpdump:
tcpdump -i any -vnn host 177.177.202.43 and udp and port 162 -w trap.pcap
tcpdump -i any -vnn udp and port 162 -w trap.pcap
DB:
時間戳轉標準時間:
select *, time(from_unixtime(fault_time, '%Y-%m-%d %H:%i:%s')) as time from tbl_trap_forward_record;
SELECT * ,DATEADD(S,fault_time + 8 * 3600,'1970-01-01 00:00:00') as time from monitor_db.imc_monitor.tbl_trap_forward_record
select count(*) from tbl_trap_data_alarm
游標:
delimiter //
create procedure func()
BEGIN
DECLARE resid BIGINT(20);
DECLARE resrestype_id BIGINT(20);
DECLARE no_more_record int default 0;
DECLARE cur_record CURSOR FOR select id,restype_id from permission_db.tbl_resource where id in (select res_source_key from monitor_db.tbl_trap_data_alarm);
DECLARE CONTINUE HANDLER FOR NOT FOUND SET no_more_record = 1;
OPEN cur_record;
FETCH cur_record INTO resid,resrestype_id;
WHILE no_more_record != 1 DO
update monitor_db.tbl_trap_data_alarm set res_source_type = resrestype_id where resid = res_source_key;
update monitor_db.tbl_trap_data_history_2003 set res_source_type = resrestype_id where resid = res_source_key;
FETCH cur_record INTO resid,resrestype_id;
END WHILE;
CLOSE cur_record;
END;
//
delimiter ;
call func();
drop procedure if exists func;
commit;
網關:
網關就是一個概念,來主要是用于轉發二層資料包的,二層資料包跨網段時自就需要由網關進行轉發,體現在計算機上就是網關地址,會對應一個物理設備,可以是路由百器,可以是三層交換機,也可以是防火墻,等等。路由器可以作為網關,但網關并不是路由器。舉個例子,房度間里的人要出去都要走大門,大門就是網關。路由器可以比作實木問門,可以做大門,但是大門不是只答有木門,還有鐵門,金屬包邊的門等等。
(個人理解:譬如要根據資訊找人,網關可通過IP告訴人在哪個屋子,可以節約查找時間,mac則直接對應座位號。)
飛秋抓包分析:
再次發送arp,即便已經有對方的ip及mac資訊
ping這是先發送arp廣播訊息,找到目的ip對應的mac資訊,然后在發送ping報文。
關于深拷貝與淺拷貝
struct STrapDataStruc
{
unsigned long m_ulSerialNo; //-告警流水號
std::list<int> m_listRecoveredSer;//被恢復的告警的序列號集合
STrapDataStruc()
{
m_ulSerialNo = 0;
}
STrapDataStruc(const STrapDataStruc& rv)
{
m_ulSerialNo = rv.m_ulSerialNo;
std::list<int>::const_iterator it = rv.m_listRecoveredSer.begin();
while (it != rv.m_listRecoveredSer.end())
{
m_listRecoveredSer.push_back(*it);
it ++;
}
}
STrapDataStruc& operator=(const STrapDataStruc& rv)
{
if (this != &rv)
{
m_ulSerialNo = rv.m_ulSerialNo;
std::list<int>::const_iterator it = rv.m_listRecoveredSer.begin();
while (it != rv.m_listRecoveredSer.end())
{
m_listRecoveredSer.push_back(*it);
it ++;
}
}
return *this;
}
};
STrapDataStruc a;
a.m_ulSerialNo = 1;
a.m_listRecoveredSer.push_back(2);
a.m_listRecoveredSer.push_back(3);
STrapDataStruc b = a;
排序:
選擇排序:bai每一趟從待排序的資料du元素中選出最小(或最大)的zhi一個元素,順序放在已排好序的數列的最后,直dao到全部待排序的資料元素排完。
選擇排序是不穩定的排序方法。
直接插入排序:每次從無序表中取出第一個元素,把它插入到有序表的合適位置,使有序表仍然有序。
第一趟比較前兩個數,然后把第二個數按大小插入到有序表中;
第二趟把第三個資料與前兩個數從前向后掃描,把第三個數按大小插入到有序表中;依次進行下去,進行了(n-1)趟掃描以后就完成了整個排序程序。
直接插入排序屬于穩定的排序,最壞時間復雜性為O(n^2),空間復雜度為O(1)。
使用范圍主要區別于演算法的執行效率。
snmp++ 3.4.1編譯:
1、下載地址
https://www.agentpp.com/
2、tar -zxvf snmp++-3.4.1.tar.gz
3、配置
./configure --with-tomcrypt=yes --with-libtomcrypt-prefix=/home/temper/newsnmp++/imcbuild/ --prefix=/home/temper/newsnmp++/newsnmpbuild341 --without-ssl --enable-snmpv3 --disable-rpath --disable-namespace --enable-macaddress --disable-logging
./configure --prefix=/root/wfp/snmp++-3.4.1/result/ --without-ssl --disable-rpath --disable-namespace --enable-macaddress --disable-logging
注:報錯如下
configure: error: Cannot find suitable libtomcrypt library
[temper@tanpeng snmp++-3.4.1]$ vi configure
配置錯誤處修改為以下部分
#include <tomcrypt.h>
int main()
{
find_cipher("");
return 0;
}
4、編譯
make && make install
注:報錯如下
auth_priv.cpp:2197: 錯誤:‘unique_ptr’不是‘std’的成員
auth_priv.cpp:2197: 錯誤:expected primary-expression before ‘>’ token
auth_priv.cpp:2197: 錯誤:‘h’在此作用域中尚未宣告
auth_priv.cpp: In member function ‘virtual int AuthSHABase::hash(const unsigned char*, unsigned int, unsigned char*) const’:
auth_priv.cpp:2246: 錯誤:‘unique_ptr’不是‘std’的成員
auth_priv.cpp:2246: 錯誤:expected primary-expression before ‘>’ token
auth_priv.cpp:2246: 錯誤:‘h’在此作用域中尚未宣告
auth_priv.cpp: In member function ‘virtual int AuthSHABase::auth_out_msg(const unsigned char*, unsigned char*, int, unsigned char*)’:
auth_priv.cpp:2260: 錯誤:‘unique_ptr’不是‘std’的成員
auth_priv.cpp:2260: 錯誤:expected primary-expression before ‘>’ token
auth_priv.cpp:2260: 錯誤:‘h’在此作用域中尚未宣告
vi auth_priv.cpp
將unique_ptr修改此auto_ptr
5、編譯成功后生成目錄結構如下:
[temper@tanpeng newsnmpbuild341]$ ls
bin include lib
本地編譯56編譯機上
注./congfig 的編譯引數與上述不一致,并且不支持snmpv3的加解密,因為依賴tomcrypt
/mnt/extd/dm/snmp++-3.4.1/
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/244948.html
標籤:C++ 語言
上一篇:makefile撰寫樣例
下一篇:c語言求助
