.
Porkchop da Python & nbsp yazılmış sadə HTTP-based sistemi informasiya server, siz bunun üçün plugins yazmaq və sizin əsasında məlumatları cavab verir.
Burada bir nümunə:
scott @ beatbox: ~% curl http: // localhost: 5000 / CPUInfo
/ CPUInfo / processor2 / FPU yes
/ CPUInfo / processor2 / f00f_bug heç bir
/ CPUInfo / processor2 / cache_alignment 64
/ CPUInfo / processor2 / vendor_id AuthenticAMD
/ CPUInfo / processor2 / bayraqları FPU
/ CPUInfo / processor2 / BogoMIPS 6384
/ CPUInfo / processor2 / hlt_bug heç bir
/ CPUInfo / processor2 / apicid 2
/ CPUInfo / processor2 / fpu_exception yes
/ CPUInfo / processor2 / gücləndirməklə 3
/ CPUInfo / processor2 / wp yes
/ CPUInfo / processor2 / qardaşları 4
/ CPUInfo / processor2 / model 4
/ CPUInfo / processor2 / coma_bug heç bir
/ CPUInfo / processor2 / fdiv_bug heç bir
/ CPUInfo / processor3 / FPU yes
/ CPUInfo / processor3 / f00f_bug heç bir
/ CPUInfo / processor3 / cache_alignment 64
/ CPUInfo / processor3 / vendor_id AuthenticAMD
/ CPUInfo / processor3 / bayraqları FPU
/ CPUInfo / processor3 / BogoMIPS 6384
/ CPUInfo / processor3 / hlt_bug heç bir
/ CPUInfo / processor3 / apicid 3
/ CPUInfo / processor3 / fpu_exception yes
/ CPUInfo / processor3 / gücləndirməklə 3
/ CPUInfo / processor3 / wp yes
/ CPUInfo / processor3 / qardaşları 4
/ CPUInfo / processor3 / model 4
/ CPUInfo / processor3 / coma_bug heç bir
/ CPUInfo / processor3 / fdiv_bug heç bir
[Kəsik]
/ Vaxt 1311387215
scott @ beatbox: ~%
Application / JSON mövzu: Bu da .json fayl uzantısı və ya qəbul qəbulu ilə JSON ilə cavab verə bilər.
scott @ beatbox: ~% curl http: // localhost: 5000 / cpuinfo.json
{"CPUInfo" {"processor2" {"FPU": "bəli", "f00f_bug": "heç bir", "cache_alignment": "64", "vendor_id": "AuthenticAMD", "bayraqları": "FPU" "BogoMIPS": "6384", "hlt_bug": "heç bir", "apicid": "bəli", "step": "2", "fpu_exception" "3", "wp": "bəli", " bacı ":" 4 "," model ":" 4 "," coma_bug ":" heç bir "," fdiv_bug "" xeyr "}" processor3 "{" FPU ":" bəli "," f00f_bug ":" heç bir "," cache_alignment ":" 64 "," vendor_id ":" AuthenticAMD "," bayraqları ":" FPU "," BogoMIPS ":" 6384 "," hlt_bug ":" heç bir "," apicid ":" 3 " , "step" "bəli": "fpu_exception" "3", "wp": "bəli", "bacı": "4", "model": "4", "coma_bug": "heç bir", " fdiv_bug "" xeyr "}" processor0 "{" FPU ":" bəli "," f00f_bug ":" heç bir "," cache_alignment ":" 64 "," vendor_id ":" AuthenticAMD "," bayraqları ":" FPU "," BogoMIPS ":" 6382 "," hlt_bug ":" heç bir "," apicid ":" bəli "," gücləndirməklə 0 "," fpu_exception "" ":" 3 "," wp ":" bəli " "bacı": "4", "model": "4", "coma_bug": "heç bir", "fdiv_bug" "xeyr"} "processor1" {"FPU": "bəli", "f00f_bug" "xeyr", "cache_alignment": "64", "vendor_id": "AuthenticAMD", "bayraqları": "FPU", "BogoMIPS": "6384", "hlt_bug": "heç bir", "apicid": " 1 "," fpu_exception: bəli "," step "" ":" 3 "," wp ":" bəli "," bacı ":" 4 "," model ":" 4 "," coma_bug "" xeyr " "fdiv_bug" "xeyr"}}, "vaxt": "1311389934"}
scott @ beatbox: ~%
Quraşdırma
Porkchop bərpa PIP
və ya
python bərpa setup.py
Plugins Yazı
Bu yeni plugin yazmaq üçün olduqca asandır. Onlar bir neçə ümumi atributları ilə yalnız Python modulları edirik:
- A plugin porkchop.plugin.PorkchopPlugin yarımsinif lazımdır.
- Plugin sinif Plugin ilə suffixed olmalıdır. Plugin kataloq faktiki fayl adı da prefiks uyğun olmalıdır. Məsələn, FooPlugin fayl foo.py olacaq
- Plugin sinif məlumat lüğət nümayiş qaytarır ki, bir metodu adlanır get_data olmalıdır.
Məlumat daha sonra 60 saniyə köhnə əgər Mənim cari olaraq, bir plugin get_data metodu yalnız adlanacaq. Bu sinif ___init___ metodu self.refresh qəbulu bir başına plugin əsasında dəyişdirilə bilər.
. Bu plugins Porkchop üçün d seçimi keçərək seçdiyiniz bir kataloq yerləşdirilmiş və yüklü edilə bilər
tələblər
- Python
Şərhlər tapılmadı